Dotcpp   >   练题 - 第221页

全部知识点

第4401题

若有定义语句

char*s1="OK",*s2="ok";

以下选项中能够输出"OK"的语句是()。

第4402题

若有定义语句:

char str1[] = "string", str2[8], *str3, str4[10] = "string";

库函数strcpy的功能是复制字符串,以下选项中错误的函数调用是()。

第4403题

以下不能将s所指字符串正确复制到t所指存储空间的是()。

第4404题

若有以下定义和语句:

char s1[10]="abcd!", *s2="n123\\";
printf("%d%d\n", strlen(s1), strlen(s2));

则输出结果是()。

第4405题

以下语句的输出结果是()。

printf("%d\n",strlen("\t\"\065\xff\n"));
第4406题

有如下程序:

#include <stdio.h>
#include <string.h>
main()
{
printf("%d\n",strlen("0\t\nA011\1"));
}

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

第4407题

有以下程序:

#include<stdio.h>
#include<string.h>
main()
{
    char a[10]= "abcd";
    printf("%d,%d\n",strlen(a),sizeof(a));
}

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

第4408题

有以下程序:

#include <stdio.h>
#include <string.h>
main()
{
    char str[]={"Hello,Beijing"};
    printf("%d,%d\n",strlen(str),sizeof(str));
}

程序的运行结果是()。

第4409题

有以下程序:

#include <stdio.h>
#include <string.h>
main()
{
    char x[]="STRING";
    x[0]=0;
    x[1]='\0';
    x[2]='0';
    printf("%d %d\n",sizeof(x),strlen(x));
}

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

第4410题

有如下程序:

#include <stdio.h>
#include <string.h>
main()
{
    char a[]="THIS", *b="OK";
    printf("%d,%d,%d,%d\n", strlen(a), sizeof(a), strlen(b), sizeof(b));
}

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

第4411题

有如下程序:

#include <stdio.h>
#include <string.h>
main()
{
    char name[10]="c-book";
    char *str=name;
    printf("%d,%d,%d,%d\n", sizeof(name), strlen(name), sizeof(str),
    strlen(str));
}

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

第4412题

有以下程序:

#include <stdio.h>
#include <string.h>
main()
{
    char name[9]="c##line";
    char *str=name;
    printf("%d,%d,%d,%d\n", sizeof(name), strlen(name), sizeof(str),
    strlen(str));
}

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

第4413题

有以下程序

#include <stdio.h>
main()
{
    char *p1 = 0;
    int *p2 = 0;
    float *p3 = 0;
    printf("%d,%d,%d\n", sizeof(p1), sizeof(p2), sizeof(p3));
}

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

第4414题

有以下程序(strcpy为字符串复制函数,strcat为字符串连接函数):

#include <stdio.h>
#include <string.h>
main()
{
    char a[10] = "abc",b[10] = "012",c[10] = "xyz";
    strcpy(a+1,b+2);
    puts(strcat(a,c+1));
}

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

第4415题

有以下程序:

#include <stdio.h>
#include <string.h>
main()
{
    char a[20]="ab",b[20]="cdef";
    int k=0;
    strcat(a,b);
    while(a[k]!='\0')
    {
        b[k]=a[k];
        k++;
    }
    puts(b);
}

程序的运行结果是()。

第4416题

有以下程序(其中的strstr()函数头部格式为:char *strstr(char*p1,char *p2)确定p2字符串是否在p1中出现,并返回p2第一次出现的字符串首地址):

#include <stdio.h>
#include <string.h>
char *a="you";
char *b="Welcome you to Beijing!";
main()
{
    char *p;
    p=strstr(b,a)+strlen(a)+1;
    printf("%s\n",p);
}

程序的运行结果是()。

第4417题

有以下程序:

#include <stdio.h>
#include <string.h>
char *a="you";
char *b="Welcome you to Beijing!";
main()
{
    char *p;
    p=b;
    while(*p != *a)p++;
    p+=strlen(a)+1;
    printf("%s\n",p);
}

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

第4418题

有以下程序:

#include <stdio.h>
#include <string.h>
main()
{
    char s[]="Beijing";
    printf("%d\n",strlen(strcpy(s,"China")));
}

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

第4419题

有以下程序:

#include<stdio.h>
#include<string.h>
main()
{
char w[20],a[5][10]={"abcdef","ghijkl","mnopq","rstuv","wxyz."};
int i;
for(i=0;i<5;i++)w[i]=a[i][strlen(a[i])-1];
w[5]='\0';
puts(w);
}

程序的运行结果是()。

第4420题

有以下函数:

int fun(char *x,char *y)
{
    int n=0;
    while((*x==*y)&&*x!='\0')
    {
    x++;
    y++:
    n++;
    }
}

函数的功能是()。