b2科目四模拟试题多少题驾考考爆了怎么补救
b2科目四模拟试题多少题 驾考考爆了怎么补救

C语言问题集(指针)

电脑杂谈  发布时间:2020-03-24 22:11:39  来源:网络整理

(char*)calloc_char * char_char* char[] string

第7章指针7.1多项选择* q = p;(char*)calloc,下面的非法赋值语句是(d). (指针变量的类型相同. )如果已定义: inta = 511,则已经定义int * p1 =&a,* p2 =&a;无法正确执行的赋值语句是(b). 相同的含义意味着为指针变量p分配了一个值. 语句(1)和(2)的执行结果都将变量a的地址值分配给指针变量p. (1)在解释p的同时初始化p,使p指向a; (2)将变量a的值分配给指针变量p. (1)与p同时初始化p,使p指向a; (2)将变量a的值分配给* p. x = 0.2345;然后正确的赋值语句如图1所示. 要实现下图所示的存储结构,可选的赋值语句为(C). 0.2345 11.在下面的程序中,调用scanf函数以输入变量a的值的方法错误,并且错误原因为(B). #include main()指示指针变量p的地址. 它指示变量a的值,而不是变量a的地址. 它只能用于指示p是指针变量. 以下程序的功能是从十个输入字符串中找到最长的字符串. 请在____A____处填写空白. #include“ stdio.h” #include“ string.h” #define 10main()chars [N] [81],printf(“最大长度tenstrings char * s =” girl“;等同于char chars [10] = { “ girl”};等同于char s [10]; s [10] = {“ girl”}; char * s =“ girl”;等同于char“ boy”;等同于char“ boy” 14. 设置char * s =“ \ ta \ 017bc”;则指针变量s指向的字符串所占用的字节数为(C).

char * char_(char*)calloc_char* char[] string

(\ 017,对应于基本ASCII码的字符)15. 在以下程序段中,for循环的执行次数为(C). char * s =“ \ ta \ 018bc”; (字符8)\ 01表示与八进制ASCII码charstr [5] =“ good!”相对应的字符; char * str =“好!”; charstr [] =“好!”; charstr [5] = {'g',17.如果正确定义了指针p,以使p指向两个连续的整数动态存储单元,则错误的语句为(a). p = 2 *(int *)malloc(sizeof(int)); p =(int *)malloc(2 * sizeof(int)); p =(int *)malloc(2 * 2); p =(int * calloc(2,sizeof(int)); 18.下一个块的运算结果为(c). char * s =“ abcde”;无确定输出设置以下程序段: char s [] =“ girl”,数组s和指针变量t的内容相等. 数组的长度和t指向的字符串等于s [0]20. 下面的正确块是(c). 20];字符[20];字符[20],21. 下一个块的运算结果为(c).

(char*)calloc_char * char_char* char[] string

#include“ stdio.h” main()intm = 10,n = 20; char * format =“%s,m = 200,n = 20以上结果均不正确22.以下与库函数strcpy(char char * q)有关. 不等函数为(D). strcpy2(char strcpy4(字符23. 以下程序的结果是(c). #include“ stdio.h” main()char [] =“ example!”,printf(“%c”,* t-32);示例! 24.下面的正确块是(C). chars [] =“ 12345”,t [] =“ 6543d21”; strcpy(s,t);(大多数分配给更少,不能容纳)chars [20],* t =“ 12345”; strcat(s,t);(字符串链接函数(char*)calloc,必须初始化为s)chars [20] =“ * t =” 12345“; strcat(s,char * s =” 12345“,* t =“ 54321”; strcat(s,t);(不能直接复制常量区域)25.以下是库函数strcmp(char char * t)的功能等效块是(C). strcmp2(char strcmp3(char strcmp4(char26. 如果有以下定义和声明,则为: int(* ps)[5]; ps = s; *(ps +3))(指向第16个元素,第一个元素第四个数组的地址)*(ps +1)+327. main函数的非法命令行参数表示为: (main(int main(intarg(intargc,char * argv))main(int arc,char ** arv)main(int argv,char * argc [])28. 如果存在一个语句: char表示第一个字符i的地址,s +1表示第二个字符i在字符t. 29的地址中只能存储16个字符. 如果已定义char s [10],则s的地址以下表达式中的[1]是(B).

char * char_char* char[] string_(char*)calloc

代表一个空格)#include“ stdio.h” main()=“ abcd”; printf(“ \”%s \“ \ n”,编译错误31. 执行以下程序后,#include main()b =(-* p)/(* q)+7; printf(“ a =% d \ n“,1032. 以下程序的功能是将字符串s的所有字符传输到字符串t,要求每个字符后每三个A空格,例如,字符串s为“ abcdefg”,则字符串t为“ abc def g”,请选择填写空白. #include“ stdio.h” #include“ string.h” main()字符[60],t [100],获取(p);而(* p)33.以下程序的功能是将八进制正整数字符串转换为十进制整数. 请填写空格. #include“ stdio.h” #include“ string.h” main()34.函数以下程序的步骤是在字符串s中找到最大的字符,并将其放在第一个位置,然后将原始字符按向后的顺序移至该字符之前,例如: boy&girl成为ybo&girl. #include“ stdio.h” #include“ string.h” main()第7章chars [80],获取(t);最大= *(t ++);而* t = max;放(t); 35.以下程序的功能是删除字符串s中的所有空格(包括TAB,回车符),请填写空格.

(char*)calloc_char * char_char* char[] string

#include“ stdio.h” #include“ string.h” #include“ ctype.h” main()字符[80];得到(s);空格(s);放置字符[80];请选择空白. #include“ stdio.h” #include“ string.h” main()字符[80],子[80]; int得到(s);得到(子); printf(“%d \ n”,count(s,sub)); intcount(char num ++; break;} return(num); 37.以下程序的输出为(). #include“ stdio.h” main()printf(“%d \ n”,* p +9 ); 38.下面程序的输出是(). #include“ stdio.h” char cchar(char ch)ch = b1)strcpy(b2,pb); printf(“%d \ n”,strlen(b2)); 40.有以下程序#include“ string.h” #include“ stdio.h” main()char * p =“ abcde \ 0fghjik \ 0”; printf(“%d \ n”,strlen(p)); 41.下面的程序void ss(char charstr [100] =“ abcddfefdbd”,printf(“%s \ n”,str1);程序运行后的输出为().

第7章10A. ABCDDEFEDBD Abcddfefdbd 42.以下程序调用findmax函数以返回数组中的最大值. 下划线应填写在()中. #include“ stdio.h” findmax(int intx [5] = {12,21,13,6,18}; printf(“%d \ n”,findmax(x,5)); pa> p-s43. 有以下程序#include“ stdio.h” #include“ malloc.h” main()p =(char *)malloc(sizeof(char)* 20); / *为指针p指定地址* /如果输入从键盘上输入: Abcdef,输出为: defdef abcdef44. 以下程序的运行结果为(). #include“ stdio.h” #include“ string.h” fun(字符图表[10]; strcpy(t ,“ example”); fun(s); puts(s); 11A. example C. exampleD. 不确定的值45. 下一个块的输出为(). #include“ stdio.h” void fun(int 46. 以下程序的输出为().

#include“ stdio.h” main()* p = a + 5; printf(“%d”,47. 有以下过程#include“ stdio.h” #include“ string.h” main(int argc,char * argv [])length + = strlen(argv [m]); printf(“%d \ n”,length);编译并链接程序后生成的可执行文件是file.exe. 命令行是: file 1234 567 89,结果是(). 48.有以下内容: 函数: char * fun(char


本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/jisuanjixue/article-151075-1.html

    相关阅读
      发表评论  请自觉遵守互联网相关的政策法规,严禁发布、暴力、反动的言论

      • 杨守
        杨守

        凡是在划定区域内的任何船只都是属于靶标

      • 吴福昊
        吴福昊

        女性

      • 陈维崧
        陈维崧

        欢迎美国军舰南海一日游

      每日福利
      热点图片
      拼命载入中...