C语言试卷
第621题
有以下程序:
#include <stdio.h>
main()
{
char b[4][10];
int i;
for(i=0;i<4;i++)
scanf("%s",b[i]);
printf("%s%s%s%s\n",b[0],b[1],b[2],b[3]);
}执行时若输入:Fig flower is red.<回车>则输出结果是()。
第622题
有以下程序:
#include <stdio.h>
main()
{
char b[3][10],c;
int i;
for(i=0;i<2;i++)scanf("%s",b[i]);
i=0;
while((c=getchar())!='\n')b[2][i++]=c;
b[2][i] = '\0';
printf("%s%s%s\n",b[0],b[1],b[2]);
}执行时若输入以下字符串:
Peach flower is pink.<回车>
则输出结果是()。
第623题
有以下程序:
#include <stdio.h>
main()
{
char b[4][10],c;
int i,j;
for(i=0;i<4;i++)
{
j=0;
while((c=getchar())!=' '&& c!='\n')b[i][j++]=c;
b[i][j] = '\0';
}
printf("%s%s%s%s\n",b[0],b[1],b[2],b[3]);
}程序运行时从第一列开始输入: Peach flower is pink.<回车>
则输出结果是()。
第624题
有以下程序:
#include <stdio.h>
#include <string.h>
main()
{
char w[20], a[5][10] = {"abcdef", "ghijkl", "mnopq", "rstuv", "wxyz"};
int i,j;
for(i=0;i<5;i++)
{
j=0;
while(a[i][j]!='\0')j++;
w[i]=a[i][j-2];
}
w[5]='\0';
puts(w);
}程序运行后的输出结果是()。
第625题
有以下程序:
#include <stdio.h>
main()
{
char *a[]={"abcd","ef","gh","ijk"};
int i;
for(i=0;i<4;i++)printf("%c",*a[i]);
}程序运行后的输出结果是()。
第626题
有以下程序:
#include <stdio.h>
#include <string.h>
main()
{
char *mm[4]= {"abcd", "1234", "mnop", "5678"};
char **pm= mm;
int i;
for(i=0;i<4;i++) printf("%s",pm[i]+i);
printf("\n");
}程序的运行结果是()。
第627题
有以下程序:
#include <stdio.h>
main()
{
char *s[6]={"ABCD","EFGH","IJKL","MNOP","QRST","UVWX"},**p;
int i;
p=s;
for(i=0;i<4;i++)printf("%s",p[i]);
printf("\n");
}程序运行后的输出结果是()。
第628题
有以下程序
#include <stdio.h>
main()
{
char c[2][5]={"6938","8254"},*p[2];
int i,j,s=0;
for(i=0;i<2;i++)
p[i]=c[i];
for(i=0;i<2;i++)
for(j=0;p[i][j]>0;j+=2)
s=10*s+p[i][j]-'0';
printf("%d\n",s);
}程序运行后的输出结果是()。
第629题
有以下程序
#include <stdio.h>
void fun(char **p)
{
++p;
printf("%s\n",*p);
}
main()
{
char *a[] = {"Morning", "Afternoon", "Evening", "Night"};
fun(a);
}程序的运行结果是()。
第630题
以下关于字符串的叙述中正确的是()。
第631题
若有定义语句char s[10]="1234567\0\0",则strlen(s)的值是()。
第632题
下列选项中,能够满足“若字符串s1等于字符串s2,则执行ST”要求的是()。
第633题
字符数组a和b中存储了两个字符串,判断字符串a和b是否相等,应当使用的是()。
第634题
若有定义语句
char*s1="OK",*s2="ok";
以下选项中能够输出"OK"的语句是()。
第635题
若有定义语句:
char str1[] = "string", str2[8], *str3, str4[10] = "string";
库函数strcpy的功能是复制字符串,以下选项中错误的函数调用是()。
第636题
以下不能将s所指字符串正确复制到t所指存储空间的是()。
第637题
若有以下定义和语句:
char s1[10]="abcd!", *s2="n123\\";
printf("%d%d\n", strlen(s1), strlen(s2));则输出结果是()。
第638题
以下语句的输出结果是()。
printf("%d\n",strlen("\t\"\065\xff\n"));
第639题
有如下程序:
#include <stdio.h>
#include <string.h>
main()
{
printf("%d\n",strlen("0\t\nA011\1"));
}程序运行后的输出结果是()。
第640题
有以下程序:
#include<stdio.h>
#include<string.h>
main()
{
char a[10]= "abcd";
printf("%d,%d\n",strlen(a),sizeof(a));
}程序运行后的输出结果是()。