Dotcpp   >   练题 - 第233页

全部知识点

第4641题

有如下程序:

#include <stdio.h>
struct pair
{
int first,second;
}st;ruct pair get_min_max(int*array, int len)
{
int i;
struct pair res;
res.first=array[0];
res.second=array[0];
for(i=1;i<len;i++)
{
if(array[i]<res.first)
res.first=array[i];
if(array[i]>res.second)
res.second=array[i];
}return res;
}
main()
{
int array[5]={9,1,3,4};
struct pair min_max = get_min_max(array,5);
printf("min=%d,max=%d\n", min_max.first, min_max.second);
}

程序运行后的输出结果是()。

第4642题

有如下程序:

#include <stdio.h>
#include <string.h>
struct S
{
char name[10];
}voi; d change(struct S *data,int value)
{
strcpy(data->name, "****");
value=13;
}
main()
{
struct S input;
int num = 4;
strcpy(input.name, "THIS");
change(&input,num);
printf("%s,%d\n",input.name,num);
}

程序运行后的输出结果是()。

第4643题

有以下程序

#include <stdio.h>
#include <string.h>
struct S
{
char name[10];
}voi; d change(struct S *data, int value)
{
strcpy(data->name, "#");
value = 6;
}
main()
{
struct S input;
int num = 3;
strcpy(input.name, "OK");
change(&input, num);
printf("%s,%d\n", input.name, num);
}

程序运行后的输出结果是()。

第4644题

为了建立如图所示的存储结构(即每个结点含两个域,data是数据域,next是指向结点的指针域)

链表结构.png

则在下面结构体定义中划线处应填入的选项是()。

struct link
{
char data;
______;
}node;
第4645题

若有以下定义和语句:

struct st
{
int n;
struct st*next;
}st;ruct st a[3] = {5,&a[0], 6,&a[1],7,&a[2]}, *p;
p = &a[0];

则值为6的表达式是(提示:运算符->的优先级高于++)()。

第4646题

若有以下程序段

struct st
{
int n;
struct st*next;
}st;ruct st a[3] = {5,&a[1],7,&a[2],9,'\0'}, *p;
p = &a[0];

则以下选项中值为6的表达式是()。

第4647题

有以下程序:

#include <stdio.h>
struct link
{
int data;
struct link *next;
};
main()
{
struct link *h,a,b;
h=&a;
a.data=10;
a.next = &b;
b.data = 20;
}

程序运行时不能输出10,20的语句是()。

第4648题

有以下程序:

#include <stdio.h>
main()
{
struct node
{
int n;
} *sp;truct node *next;
struct node x[3] = {{2,x+1},{4,x+2},{6,NULL}};
p=x;
printf("%d,",p->n);
printf("%d\n",p->next->n);
}

程序运行后的输出结果是()。

第4649题

假定已建立以下数据链表结构,且指针p和q已指向如下图所示的结点:

链表结构

则以下选项中可将q所指结点从链表中删除并释放该结点的语句是()。

第4650题

下面选项中关于位运算的叙述正确的是( )。 

第4651题

以下不属于C语言位运算符的是( )。

第4652题

以下选项中错误的是( )。

第4653题

变量a中的数据用二进制表示的形式是01011101,变量b中的数据用 二进制表示的形式是11110000。若要求将a的高4位取反,低4位不变, 所要执行的运算是( )。

第4654题

若有定义语句

int b=2;

则表达式(b<<2)/(3ǁb)的值是( )。

第4655题

设有定义:

int a=64,b=8;

则表达式(a&b)ǁ(a&&b)和(a|b) && (aǁb)的值分别为( )。 

第4656题

有以下程序:

#include <stdio.h>
main()
{
 int a=3;
 int b=3;
 printf("%d\n", a&b);}

程序运行后的输出结果是( )。

第4657题

有以下程序:

#include <stdio.h>
main()
{
 int c,d;
 c=13&5;
 d=10&&5;
 printf("%d,%d\n",c,d);
}

程序的运行结果是( )。

第4658题

有以下函数:

#include <stdio.h>
main()
{ int a=12,c;
 c=(a<<2)<<1;
 printf("%d\n",c);
}

程序运行后的输出结果是( )。 

第4659题

有以下程序:

#include <stdio.h>
main()
{
 int a=2,b;
 b=a<<2;
 printf("%d\n",b);
}

程序运行后的输出结果是( )。 

第4660题

有以下程序

#include <stdio.h>
void main()
{
 unsigned char a=8, c;
 c = a>>3;
 printf("%d\n",c);
}

程序运行后的输出结果是( )。