C语言试卷

第601题

有以下程序:

#include <stdio.h>
main()
{
    char s[10] = "verygood", *ps = s;
    ps += 4;
    ps = "nice";
    puts(s);
}

程序的运行结果是()。

第602题

有如下程序:

#include <stdio.h>
int disp(char *str)
{
    while(*str) putchar(*str++);
    return *str;
}
main()
{
    printf("%d\n",disp("NAME"));
}

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

第603题

有以下程序:

#include <stdio.h>
int disp(char *str)
{
    while(*str) putchar(*str++);
    putchar('#');
    return *str;
}
main()
{
    printf("%d\n",disp("C##123"));
}

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

第604题

有以下程序:

#include<stdio.h>
int fun(char *s)
{
    char *p=s;
    while(*p++!='\0');
    return(p-s);
}
main()
{
    char *p="01234";
    printf("%d\n",fun(p));
}

程序的运行结果是()。

第605题

有以下程序:

#include <stdio.h>
main()
{
    int password;
    char *p,old_str[10]="wind";
    scanf("%d",&password);
    p = old_str;
    while(*p)
    {
        printf("#%c",*p+password);
        p++;
    }
}

程序运行时,从键盘输入2<回车>,输出结果是()。

第606题

有以下程序:

#include <stdio.h>
main()
{
    char s1[]="programe",s2[]="Language";
    char *p1=s1,*p2=s2;
    int k;
    for(k=0;k<8;k++)
        if(*(p1+k)==*(p2+k))
            printf("%s ",(p1+k));
}

程序的运行结果是()。

第607题

若要求从键盘读入含有空格字符的字符串,应使用函数()。

第608题

设有定义:char s[81];int i=0;,以下不能将一行(不超过80个字符)带有空格的字符串正确读入的语句或语句组是()。

第609题

以下不能将键盘输入的字符串:This is a string<回车>读入到str中的程序段是()。

第610题

有定义语句:

char s[10];

若要从终端给s输入5个字符,错误的输入语句是()。

第611题

有以下程序:

#include <stdio.h>
main()
{
    char a[30],b[30];
    scanf("%s",a);
    gets(b);
    printf("%s\n%s\n",a,b);
}

程序运行时若输入:
how are you?I am fine<回车>
则输出结果是()。

第612题

有以下程序:

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

当执行程序时,按下列方式输入数据(从第一列开始,代表回车,注意:回车是一个字符)
12
34
则输出结果是()。

第613题

有以下程序

#include <stdio.h>
char fun(char *c)
{
    if(*c<='Z'&&*c>='A')
        *c-='A'-'a';
    return *c;
}
main()
{
    char s[81],*p=s;
    gets(s);
    while(*p)
    {
        *p=fun(p);
        putchar(*p);
        p++;
    }
    printf("\n");
}

若运行时从键盘上输入OPEN THE DOOR<回车>,程序的输出结果是()。

第614题

有以下程序:

#include <stdio.h>
main()
{
    char A,B,C;
    B='1';
    C='A';
    for(A=0;A<6;A++)
    {
        if(A%2)putchar(B+A);
        else putchar(C+A);
    }
}

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

第615题

有如下程序:

#include <stdio.h>
main()
{
    char *p,old_str[10]="wind";
    int password;
    scanf("%d",&password);
    p = old_str;
    while(*p)
    {
        printf("%c",*p+password);
        p++;
    }
    printf("\n");
}

程序运行时,从键盘输入2<回车>,输出结果是()。

第616题

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

第617题

以下语句中存在语法错误的是( )。

第618题

若有定义:char*ps[]={"aa","bb","cc","dd"};,则以下叙述正确的()。

第619题

若有以下程序段

char str[4][12] = {"aa","bbb","ccccc","d"},*strp[4];
int i;
for(i=0;i<4;i++)
    strp[i]=str[i];

不能正确引用字符串的选项是()。

第620题

有以下程序:

#include <stdio.h>
main()
{
    char ch[3][5] = {"AAAA","BBBB","CC"};
    printf("%s\n",ch[1]);
}

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