Dotcpp   >   练题 - 第219页

全部知识点

第4361题

设有如下程序段:

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

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

第4362题

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

第4363题

有以下说明语句:

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

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

第4364题

若有说明和语句:

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

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

第4365题

有以下程序:

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

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

第4366题

有以下程序

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

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

第4367题

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

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

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

第4368题

有以下程序:

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

程序的运行结果是()。

第4369题

有如下程序:

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

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

第4370题

有以下程序:

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

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

第4371题

有以下程序:

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

程序的运行结果是()。

第4372题

有以下程序:

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

第4373题

有以下程序:

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

程序的运行结果是()。

第4374题

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

第4375题

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

第4376题

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

第4377题

有定义语句:

char s[10];

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

第4378题

有以下程序:

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

第4379题

有以下程序:

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

第4380题

有以下程序

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