1、全国自考(高级语言程序设计)模拟试卷 19 及答案与解析一、单项选择题1 以下叙述中错误的是( )(A)使用三种基本结构构成的程序只能解决一些简单的问题(B)结构化程序设计提倡模块化(C) C 语言是结构化程序设计语言(D)结构化程序的基本结构为顺序、选择、循环2 现有定义 int a;double b;f1oat c;char k;则表达式 a/b +c-k 的值的类型为( )(A)int(B) f1oat(C) double(D)char3 当整型变量 c 的值不为 2,4,6 时,值也为“ 真 ”的表达式是( )(A)(c=2)|(c=4)|(c=6)(B) (c=2&c=2&c=2&c
2、main() int x;scanf(“df“,&x);if(xmain()int a22=1,2,3,4 ,*p,i;p=&a00;for(i=0;imain() char b = “CDEFGH“ ;char * chp = &b4 ;while( - - chp main() int i,a20,sum,count;sum=count=0;for(_)scanf(“ d“,&ai);/*第一空*/for(i =0;1void cp(char *p,char *b) int i,k=0;while(*p)i=0;while(_)/*第一空*/bk=*p;k +;p+;i+ ;if( *p)
3、_;/*第二空*/_;/*第三空*/main() chara20, b20;gets(a);cp(a, b);puts(b);printf(“n“);32 以下程序由终端输入一个文件名,然后把从终端键盘输入的字符依次存放到该文件中,用“#”作为结束输入的标志。#include#includemain() FILE*fp;char ch,fname10;printf( “input the name of fijen“);gets(fname );if(fp=_)=NULL) printf(“cannot openn“);exit(0);/*第一空*/elseprintf(“enter data
4、n“);wlule(_)futc(_ ,fp );/* 第二、三空*/fc10se(fp );五、程序设计题33 设计一个程序,输入一个字符,判断它是数字、字母还是其他字符。34 输入一个 34 矩阵,求其中的最大元素。全国自考(高级语言程序设计)模拟试卷 19 答案与解析一、单项选择题1 【正确答案】 A【试题解析】 使用顺序、选择、循环三种基本结构构成的程序可以解决所有问题,而不是简单问题,所有 A 错误。2 【正确答案】 C【试题解析】 按照“就长不就短”的规则,double 长度最长,最后类型都转化为double。3 【正确答案】 B【试题解析】 “| ”只要有一个为真即为真,“&”要全真才为真。对于 B,满足表达式(c=2&c0sum+=ai31 【正确答案】 imain() char a;a= getchar();if(a=0&a=a&a=A&amain( ) int a3 4,i,j,d,b,max ;if( max ad b )printf(“最大元素是 d“ ,max) ;