假设有定义: int d[3]={10,20,30}; struct sp { int a; int *b; }t[3]={70,&d[0],80,&d[1],90,&d[2]},*p=t; 则表达式++(p->a)+*++p->b的值为();
第1题:
有以下程序 #include <string.h> struct STU { char name[10]; int num; }; void f(char *name, int num) { struct STU s[2]={{"SunDan",20044},{"Penghua",20045}}; num=s[0].num; strcpy(name,s[0].name); } main() { struct STU s[2]={{"YangSan",20041},{"LiSiGuo",20042}},*p; p=&s[1]; f(p->name,p->num); printf("%s %d\n",p->name,p->num); } 程序运行后的输出结果是
A.SunDan 20042
B.SunDan 20044
C.LiSiGuo 20042
D.YangSan 20041
第2题:
阅读下列说明和C代码,将应填入(n)处的字句写在对应栏内。
【说明】
本题给出四个函数,它们的功能分别是:
1.int push(PNODE*top,int e)是进栈函数,形参top是栈顶指针的指针,形参e是入栈元素。
2.int pop(PNODE*top,int*e)是出栈函数,形参top是栈顶指针的指针,形参e作为返回出栈元素使用。
3.int enQueue(PNODE*tail,int e)是入队函数,形参tail是队尾指针的指针,形参e是入队元素。
4.int deQueue(PNODE*tail,int*e)是出队函数,形参tail是队尾指针的指针,形参e作为返回出队元素使用。
以上四个函数中,返回值为。表示操作成功,返回值为-1表示操作失败。
栈是用链表实现的;队是用带有辅助结点(头结点)的单向循环链表实现的。两种链表的结点类型均为:
typedef struct node {
int value;
struct node * next;
} NODE, * PNODE;
【函数1】
int push(PNOOE * top,int e)
{
PNODE p = (PNODE) malloc (sizeof (NODE));
if (! p) return-1;
p->value=e;
(1);
*top=p;
return 0;
}
【函数2】
int pop (PNODE * top,int * e)
{
PNODE p = * top;
if(p == NULL) return-1;
* e = p->value;
(2);
free(p);
return 0;
}
【函数3】
int enQueue (PNODE * tail,int e)
{ PNODE p,t;
t= *tail;
p = (PNODE) malloc(sizeof(NODE));
if(!p) return-1;
p->value=e;
p->next=t->next;
(3);
* tail = p;
return 0;
}
【函数4】
int deQueue(PNODE * tail,int * e)
{ PNODE p,q;
if(( * tail)->next == * tail) return-1;
p= (* tail)->next;
q = p ->next;
* e =q ->value;
(4)=q->next;
if(,tail==q) (5);
free(q);
return 0;
}
第3题:
有以下程序:
#inClude <stdlib.h>
struct NODE{
int num;
struct NODE *next;
};
main()
{ Struct N00E *p,*q,*r;
int sum;0;
p=(struct NODE *)malloc(sizeof(struct NODE));
q=(struct NODE *)malloc(sizeof(struct NODE));
r=(struct NODE *)malloc(Sizeof(struct NODE));
p->num=1;q->num=2;r->num=3;
p->next=q;q->next=r;r->next=NULL;
sum+=q->next->num;sum+=p->num;
printf("%d\n",sum);
}
执行后的输出结果是
A.3
B.4
C.5
D.6
第4题:
有以下程序: #include <string.h> struct STU (char name[10]; int num; }; void f(char *name, int num) {struct STU s[2]={{"SunDan",20044}.{"Penghua",20045}}; num=s[0].num; strcpy(name,s[0].name); } main() {struct STU s[2]={{"YangSall",20041},{"LiSiGao",20042}},*p;p=&s[1]; f(p->name,p->num); printf("%s%d\n",p->name,p->num); } 程序运行后的输出结果是 ______。
A.SunDan 20042
B.SunDan 20044
C.LiSiGuo 20042
D.YangSan 20041
第5题:
以下程序的输出结果是( )。 {int x;int*y;}*p; int dt[4]={1,2,3,4}; struct st aa[4]={2,&dt[0],3,&dt[0],4,&dt[0],5,&dt[0],}; {p=aa; pfintf("%d\n",++(p->x)); }
A.1
B.2
C.3
D.4
第6题:
有以下程序 #include<stdio.h> struct ord { int x,y;} dt[2]={1,2,3,4}; mare() { struct ord*p=dt; printf("%d,",++p->x); printf("%d\n",++p->y); } 程序的运行结果是______。
A.1,2
B.2,3
C.3,4
D.4,1
第7题:
有以下程序:
#include<stdlib.h>
struct NODE{
int num;
struct NODE *next;
}
main()
{ struct NODE *p,*q,*r;
int sum=0;
p=(struct NODE *)malloc(sizeof(struct NODE));
q=(Struct NODE *)malloc(sizeof(struct NODE));
r=(Struct NODE *)malloc(sizeof(struct NODE));
p->num=1; q->num=2; r->num=3;
p->next=q; q->next=r; r->next=NULL;
sum+=q->next->num;sum+=p->num;
printf("%d\n",sum);
}
执行后的输出结果是( )。
A.3
B.4
C.5
D.6
第8题:
下面程序的输出结果为( )。 struct st {int x;int *y;}*p; int dt[4]={10,20,30,40); struct st aa[4]={50,&dt[0],60,&dt[1],70,&dt[2],80,&dt[3]}; main() { p=aa; printf("%d\n",++p->x); printf("%d|n",(++p)->x); printf("%d\n",++(*p->y)); }
A.10 20 20
B.50 60 21
C.51 60 21
D.60 70 31
第9题:
n-1;i++)fo
有以下程序: struct S{int n;int a[20];}; void f(struct S*P) { int i,j,t; for(i=0;i<P->n-1;i++) for(j=j+1;j<P->n-1;j++) if(p->a[i]>p->a[j]) {t=P->a[i];p->a[i]=P->a[j];p->a[j]=t} } main() {int i;struct S s{10,{2,3,1,6,8,7,5,4,10,9}}; f(&s); for(i=0;i<s.n;i++)printf("%d",s.a[i]);} 程序运行后的输出结果是( )。
A.3
B.4
C.5
D.6
第10题:
设有以下C语言说明语句,则值为210的表达式是(33)。 struct s { int a;int *b;}; Int x0[]={110,120},x1[]={210,220}; struct s x[]={{100},{200}},*p=x; x[0].b=x0;x[1].b=x1;
A.(++p)->a
B.*p->b
C.*(p++)->b
D.*(++p)->b
第11题:
有以下程序
#inGlude<stdlib.h>
struct NODE {
int num;
struct NODE *next;
}
main()
{ struct NODE *p,*q,*r;
int sum=0;
p=(struct NODE*)malloc(sizeof(struct NODE));
q=(struct NODE*)malloc(sizeof(struct NODE));
r=(stnlct NODE*)malloc(sizeof(struct NODE));
p->num=1;q->num=2;r->num=3;
p->next=q;q->next;r;r->next=NULL;
sum+=q->next->Num,sum+=p->num;
printf("%d\n",sum);
}
执行后输出结果是
A.3
B.4
C.5
D.6
第12题:
若已定义 struct num{ int a; int b; float f; } n={1,3,5.0}; struct num *p=&n; 则表达式p->b/n.a*++p->b的值是 ① ,表达式(*p).a+p->f的值是 ② 。
第13题:
阅读以下说明和C++程序,将应填入(n)处的字句写在对应栏内。
[说明]
下面程序实现十进制向其它进制的转换。
[C++程序]
include"ioStream.h"
include"math.h"
include
typedef struct node {
int data;
node*next;
}Node;
Class Transform.
{
DUDlic:
void Trans(int d,int i); //d为数字;i为进制
void print();
private:
Node*top;
};
void Transform.:Trans(int d,int i)
{
int m,n=0;
Node*P;
while(d>0)
{
(1);
d=d/i;
p=new Node;
if(!n){
p->data=m;
(2);
(3);
n++;
}
else{
p->data=m;
(4);
(5);
}
}
}
void Transform.:print()
{
Node*P;
while(top!=NULL)
{
p=top;
if(p->data>9)
cout<<data+55;
else
cout<<data;
top=p->next;
delete p;
}
}
第14题:
以下程序的输出是( )。 struct st { int x;int *y; } *p; int dt[4]={10,20,30,40}; struct st aa[4]= {50,&dt[0],60,&dt[1],70,&dt[2],80,&dt[3]}; main() { p=aa; cout<<++p->x; cout<<(++p)->x; cout<<++(*p->y); }
A.10 20 20
B.50 60 21
C.51 60 21
D.60 70 31
第15题:
以下程序的输出是______。 struct st {int x;int*y; }*p; int dt[4]={10,20,30,40}; struct st aa[4]={50,&dt[0],60,&dt[1],60,&dt[2],60,&dt[3]}; main() { p=aa; printf("%d\n",++(p->X)); }
A.51
B.11
C.50
D.60
第16题:
有以下程序 #include <stdio.h> struct tt { int x; struct tt *y; } *p; struct tt a[4]= {20,a+ 1,15,a+2,30,a+3,17,a}; main() { int i; p=a; for(i=1; i<-2; i++) { printf("%d,", p->x ); p=p->y; }
A.20,30,
B.30,17
C.15,30,
D.20,15,
第17题:
以下程序运行后的输出结果是【 】。
struct NODE
{int num;struct NODE *next;
};
main()
{struct NODE s[3]={{1,'\0'},{2,'\0'},{3,'0'}},*p,*q,*r;
int sum=0;
s[0].next=s+1;s[1].next=s+2;s[2].next=s;
p=s; q=p->next; r=q->next;
sum+=q->next->num; sum+=r->next->next->num;
printf("%d\n",sum);
}

第18题:
对于下述说明,不能使变量p->b的值增1的表达式是______。 struct exm { int a; int b; float c }*p;
A.++p->b
B.++(p++)->b
C.p->b++
D.(++p)->b++
第19题:
有以下程序
#include <stdlib.h>
struct NODE{
int num;
struct NODE *next;};
main( )
{ struct NODE *p,*q,*r;
int sum=0;
p=(struct NODE *)malloc(sizeof(struct NODE));
q=(struct NODE *)malloc(sizeof(struct NODE));
r=(struct NODE *)malloc(sizeof(struct NODE));
p->num=1;q->num=2;r->num=3;
p->next=q;q->next=r;r->next=NULL;
sum+=q->next->num;sum+=p->num;
printf(“%d\n”,sum);}
执行后的输出结果是
A.3
B.4
C.5
D.6
第20题:
下而程序实现十进制向其他进制的转换。
[C++程序]
include"ioStream.h"
include"math.h"
include <conio.h>
typedef struct node{
int data;
node *next;
}Node;
class Transform
{
public:
void Trans(int d,int i); //d为数字;i为进制
void print();
private:
Node *top;
};
void Transform.:Trans(int d,int i)
{
int m,n=0;
Node *P;
while(d>0)
{
(1) ;
d=d/i;
p=new Node;
if(!n){
P->data=m;
(2) j
(3) ;
n++;
}
else{
p->data=m;
(4) ;
(5) ;
}
}
}
void Transform.:print()
{
Node *P;
while(top!=NULL)
{
p=top;
if(P->data>9)
cout<<data+55:
else
cout<<data;
top=p->next;
delete P;
}
}
第21题:
以下程序的输出是( )。 struct st { int x;int *y; } *p; int dt[4]={10,20,30,40}; struct st aa[4]={50,&dt[0],60,&dt[0],60,&dt[0],60,&dt[0],}; main() { p=aa; cout<+<+(p->x); }
A.10
B.11
C.51
D.60
第22题:
设有以下C语言说明语句。 struct { int x,y;} s[2]={{1,2),{3,4}),*p=s,*q=s; 则表达式++p->x和表达式(++q)->x的值分别为(34)。
A.1、1
B.1、3
C.2、3
D.3、3
第23题:
有以下程序:
#include <stdlib.h>
struct NODE{
int nurn;
struct NODE *next;
};
main()
{ struct NODE *p,*q,*r;
int sum=0;
P=(struct NODE*)malloc(sizeof(struct NODE));
q=(struct NODE*)malloc(sizeof(struct NODE));
r=(struct NODE*)malloc(sizeof(struct NODE));
p->num=1;q->num=2;r->num=3;
p->next=q;q->next=r;r->next=NULL;
sum+=q->next->num;sum+=p->num;
Printf("%d\n",sum);
}
执行后的输出结果是( )。
A.3
B.4
C.5
D.6
第24题: