注意:此页面搜索的是所有试题
川北医学院口腔医学院
下列语句组中,正确的是( )。
·char *s;s={"Olympic"};

以下关于retur语句的叙述中正确的是( )。
·一个自定义函数中必须有一条retur语句
·一个自定义函数中可以根据不同情况设置多条retur语句
·定义成void 类型的函数中可以有带返回值的retur语句
·没有retur语句的自定义函数在执行结束时不能返回到调用处

下列选项中,能正确定义数组的语句是( )。
·int num[0..2008];
·int num[];
·int N=2008;int num[N];
·#define N 2008int num[N];

有以下程序#include <stdio.h>void fun( char *c, int d ){*c = *c + 1; d = d + 1;printf( "%c,%c,", *c, d );}main(){char b = .a., a = .A.;fun( &b, a ); printf( "%c,%c\n", b, a );}程序运行后的输出结果是( )。
·b,B,b,A
·b,B,B,A
·a,B,B,a
·a,B,a,B

若有定义int (*pt)[3];,则下列说法正确的是( )。
·定义了基类型为int 的三个指针变量
·定义了基类型为int 的具有三个元素的指针数组pt
·定义了一个名为*pt、具有三个元素的整型数组
·定义了一个名为pt 的指针变量,它可以指向每行有三个整数元素的二维数组

设有定义double a[10],*s=a;,以下能够代表数组元素a[3]的是( )。
·(*s)[3]
·*(s+3)
·*s[3]
·*s+3

有以下程序:#include <stdio.h>main(){int a[5] = { 1, 2, 3, 4, 5 }, b[5] = { 0, 2, 1, 3, 0 }, i, s = 0;for ( i = 0; i < 5; i++ )s = s + a[b[i]];printf( "%d\n", s );}程序运行后的输出结果是( )。
·6
·10
·1l
·15

有以下程序#include <stdio.h>main(){int b[3][3] = { 0, 1, 2, 0, 1, 2, 0, 1, 2 }, i, j, t = 1;for ( i = 0; i < 3; i++ )for ( j = i; j <= i; j++ )t += b[i][b[j][i]];printf( "%d\n", t );}程序运行后的输出结果是( )。
·1
·3
·4
·9

若有以下定义和语句:char s1[10]="abcd!",*s2="\n123\";printf("%d %d\n",strlen(s1),strlen(s2));则输出的结果是( )。
·5 5
·10 5
·l0 7
·5 8

有以下程序:#include <stdio.h>int f( int t[], int );main(){int a[4] = { 1, 2, 3, 4 }, s;s = f( a, 4 ); printf( "%d\n", s );}int f( int t[], int ){if ( > 0 )return(t[- 1] + f( t, - 1 ) );else return(0);程序运行后的输出结果是( )。
·4
·}
·10
·14
·6

有以下程序:#include <stdio.h>int fun(){static int x = 1;x *= 2; return(x);}main(){int i, s = 1;for ( i = 1; i <= 2; i++ )s = fun();printf( "%d\n", s );}程序运行后的输出结果是( )。
·0
·l
·4
·8

设有定义:Struct complex{ int real,unreal;} data1={1,8},data2;则以下赋值语句中错误的是( )。
·data2=datal ;
·data2=(2,6);
·data2. real=datal. real;
·data2. real=datal. unreal;

有以下程序:#include <stdio.h>#include <string.h>struct A{ int a; char b[10]; double c; };void f( struct A t );main(){struct A a = { 1001, "ZhangDa", 1098.0 };f( a ); printf( "%d,%s,%6.1f\n", a.a, a.b, a.c );}void f( struct A t ){t.a = 1002; strcpy( t.b, "ChangRong" ); t.c = 1202.0;}程序运行后的输出结果是( )。
·100l, zhangDa, 1098.0
·1002, ChangRong, 1202.0
·100l, ChangRong, 1098.0
·1002, zhangDa, 1202.0

有以下定义和语句:struct workers{ int num; char name[20]; char c;struct{ int day; int month; int year; } s; };struct workers w, *pw;pw = &w;能给w 中year 成员赋1980 的语句是()。
·*pw. year=1980;
·w. year=1980;
·pw->year=1980;
·w. s. year=1980;

有以下程序:#include <stdio.h>main(){FILE *fp; char str[10];fp = fopen( "myfile.dat", "w" );fputs( "abc", fp ); fclose( fp );fp = fopen( "myfile.dat", "a+" );fprintf( fp, "%d", 28 );rewind( fp );fscanf( fp, "%s", str ); puts( str );fclose( fp );}程序运行后的输出结果是( )。
·abc
·28c
·abc28
·因类型不一致而出错