Dotcpp   >   练题 - 第220页

全部知识点

第4381题

有以下程序:

#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);
    }
}

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

第4382题

有如下程序:

#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<回车>,输出结果是()。

第4383题

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

第4384题

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

第4385题

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

第4386题

若有以下程序段

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

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

第4387题

有以下程序:

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

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

第4388题

有以下程序:

#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.<回车>则输出结果是()。

第4389题

有以下程序:

#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.<回车>
则输出结果是()。

第4390题

有以下程序:

#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.<回车>
则输出结果是()。

第4391题

有以下程序:

#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);
}

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

第4392题

有以下程序:

#include <stdio.h>
main()
{
    char *a[]={"abcd","ef","gh","ijk"};
    int i;
    for(i=0;i<4;i++)printf("%c",*a[i]);
}

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

第4393题

有以下程序:

#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");
}

程序的运行结果是()。

第4394题

有以下程序:

#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");
}

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

第4395题

有以下程序

#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);
}

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

第4396题

有以下程序

#include <stdio.h>
void fun(char **p)
{
    ++p;
    printf("%s\n",*p);
}
main()
{
    char *a[] = {"Morning", "Afternoon", "Evening", "Night"};
    fun(a);
}

程序的运行结果是()。

第4397题

以下关于字符串的叙述中正确的是()。

第4398题

若有定义语句char s[10]="1234567\0\0",则strlen(s)的值是()。

第4399题

下列选项中,能够满足“若字符串s1等于字符串s2,则执行ST”要求的是()。

第4400题

字符数组a和b中存储了两个字符串,判断字符串a和b是否相等,应当使用的是()。