C语言试卷

第581题

以下能正确进行字符串赋值的语句组是()。

第582题

以下涉及字符串数组、字符指针的程序段,不会产生编译错误的是()。

第583题

有以下程序:

#include <stdio.h>
#include <string.h>
main()
{
    char str[12]={'s', 't', 'r', 'I', 'n', 'g'};
    printf("%d\n",strlen(str));
}

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

第584题

有以下程序:

#include <stdio.h>
main()
{
    char s[] = "012xy\08s34f4w2";
    int i,n = 0;
    for(i = 0;s[i]!='0';i++)
        if(s[i]>'0'&& s[i]<='9')n++;
    printf("%d\n",n);
}

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

第585题

有以下程序:

#include <stdio.h>
main(){
    char s[]={"012xy"};
    int i,n=0;
    for(i=0;s[i]!=0;i++)  if(s[i]>='a'&&s[i]<='z')n++;
    printf("%d\n",n);
}

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

第586题

有以下程序:

#include <stdio.h>
main()
{
    char name[10] = {'S','T','R'};
    name[2]='#';
    name[6]=0;
    printf("%s\n",name);
}

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

第587题

有如下程序:

#include <stdio.h>
main()
{
    char name[10] = {'S','T','R','I','N','G'};
    name[3]='E';
    name[5]=0;
    printf("%s\n",name);
}

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

第588题

有以下程序:

#include <stdio.h>
main()
{
    int i,j=0;
    char a[] = "How are you!",b[10]={0};
    for(i=0;a[i];i++)
        if(a[i]==' ')
            b[j++]=a[i-1];
    printf("%s\n",b);
}

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

第589题

有以下程序:

#include <stdio.h>
main()
{
    int i,j=0;
    char a[] = "How are you",b[10]={0};
    for(i=0;a[i];i++)
        if(a[i]==' ')
            b[j++]=a[i+1];
    printf("%s\n",b);
}

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

第590题

以下选项中正确的语句组是()。

第591题

以下使指针指向一个字符串的选项错误的是()。

第592题

下列语句中,正确的是()。

第593题

以下叙述中正确的是()。

第594题

设有如下程序段:

char s[20]= "Bejing",*p;
p=s:

则执行p=s;语句后,以下叙述正确的是()。

第595题

设有定义:char *c;以下选项中能够使字符型指针c正确指向一个字符串的是()。

第596题

有以下说明语句:

char *s = "'Name\\Address\n";

指针s所指字符串的长度是( )。

第597题

若有说明和语句:

char str[]="Hello", *p; p=str;

则此时*(p+5)中的值为()。

第598题

有以下程序:

#include <stdio.h>
main()
{
    char s[]="rstuv";
    printf("%c\n",*s+2);
}

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

第599题

有以下程序

#include <stdio.h>
main()
{
    char ch[]="uvwxyz",*pc;
    pc=ch;
    printf("%c\n",*(pc+5));
}

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

第600题

有以下程序(注:字符a的ASCII码值为97):

#include <stdio.h>
main()
{
    char *s={"abc"};
    do
    {
        printf("%d",*s%10);
        ++s;
    }while(*s);
}

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