[计算机类试卷]国家二级(C语言)章节练习试卷21及答案与解析.doc

上传人:figureissue185 文档编号:503241 上传时间:2018-11-29 格式:DOC 页数:6 大小:30.50KB
下载 相关 举报
[计算机类试卷]国家二级(C语言)章节练习试卷21及答案与解析.doc_第1页
第1页 / 共6页
[计算机类试卷]国家二级(C语言)章节练习试卷21及答案与解析.doc_第2页
第2页 / 共6页
[计算机类试卷]国家二级(C语言)章节练习试卷21及答案与解析.doc_第3页
第3页 / 共6页
[计算机类试卷]国家二级(C语言)章节练习试卷21及答案与解析.doc_第4页
第4页 / 共6页
[计算机类试卷]国家二级(C语言)章节练习试卷21及答案与解析.doc_第5页
第5页 / 共6页
点击查看更多>>
资源描述

1、国家二级( C语言)章节练习试卷 21 及答案与解析 1 设 char型变量 x中的值为 10000111,则表达式 (x-2)( 4)的值是 _。 ( A) 10110 ( B) 10000111 ( C) 101100 ( D) 10110000 2 下面程序段的输出结果是 _。 main() char x=10000111,c; c=(x-2)(x+2); printf(“%dn“, c); ( A) 25 ( B) 26 ( C) 27 ( D) 28 3 有以下程序: main() int x=5, y=2, z=1; printf(“%dn“, x%yj1=j; printf(“%

2、d, %d, %dn“, m, i1, j1); 11 以下程序中用户由键盘输入一个文件名,然后输入一串字符 (用 $结束输入 )存放到此文件中,形成文本文件,并将字符的个数写到文件尾部。请填空。 #include string.h main() FILE*fp: char ch, fname32 int count=0: prinft(“input the filename: “): scanf(“%s“, fname); if(fp=fopen(_, “w+“)=NULL) printf(“cant open file: %sn“, fname); exit(0): printf(“ent

3、er data: n“): while(ch=getchar()!= ) fputc(ch, fp): count+; fprintf(_, “n%dn“, count); fclose(fp): 12 以下程序可将磁盘中的一个文件复制到另一个文件中,两个文件的文件名在可执行命令的命令行中 (相当于 COPY命令 ),假定文件在当前目录下。 #include stdio.h void main(int argc,char *argv) FILE*f1*f2; if(argc _) printf(“parameter error!n“); exit(0); f1=fopen(argv1, “r“

4、); f2=fopen(argv2,“w“); while(_)fputc (fgetc (f1), f2); fclose(f1): fclose(f2); 13 以下程序的功能是将文件 filel.c的内容输出到 屏幕上并复制到文件 file2.c中。请在横线处填入适当的内容。 #include stdio.h void main() FILE_; fp1=fopen(“file1.c“, “r“); fp2=fopen(“file2.c“, “w“); while(!feof(fp1) putchar(fgetc(fp1); _ while(!feof(fp1)fputc(_); fclose(fp1); fclose(fp2); 国家二级( C语言)章节练习试卷 21 答案与解析 1 【正确答案】 A 2 【正确答案】 D 3 【正确答案】 D 4 【正确答案】 D 5 【正确答案】 C 6 【正确答案】 C 7 【正确答案】 C 8 【正确答案】 2 8 26 9 【正确答案】 1 1 2 3 5 8 13 21 34 55 10 【正确答案】 38 1 0 11 【正确答案】 fname, fp 12 【正确答案】 3, !feof(f1) 13 【正确答案】 *fp1, *fp2 rewind(fp1) getc(fp1), fp2

展开阅读全文
相关资源
猜你喜欢
  • API PUBL 4611-1995 Interlaboratory Study of EPA Methods 1662 1654A and 1663 for the Determination of Diesel Mineral and Crude Oils in Drilling Muds from Offshore Oil and Gas Indust.pdf API PUBL 4611-1995 Interlaboratory Study of EPA Methods 1662 1654A and 1663 for the Determination of Diesel Mineral and Crude Oils in Drilling Muds from Offshore Oil and Gas Indust.pdf
  • API PUBL 4612-1994 Study of Refinery Fugitive Emissions from Equipment Leaks《1993年炼厂设施泄漏的易散发性排放物的研究》.pdf API PUBL 4612-1994 Study of Refinery Fugitive Emissions from Equipment Leaks《1993年炼厂设施泄漏的易散发性排放物的研究》.pdf
  • API PUBL 4613-1994 Study of Refinery Fugitive Emissions from Equipment Leaks Appendices《1993年炼厂设施泄漏引起的易散发性排放物的研究》.pdf API PUBL 4613-1994 Study of Refinery Fugitive Emissions from Equipment Leaks Appendices《1993年炼厂设施泄漏引起的易散发性排放物的研究》.pdf
  • API PUBL 4615-1995 Emission Factors for Oil and Gas Production Operations《油气开发作业的排放系数》.pdf API PUBL 4615-1995 Emission Factors for Oil and Gas Production Operations《油气开发作业的排放系数》.pdf
  • API PUBL 4616-1994 Importance of Using Alternative Base Cases in Photochemical Modeling《光化建模利用替代基地情况的重要性》.pdf API PUBL 4616-1994 Importance of Using Alternative Base Cases in Photochemical Modeling《光化建模利用替代基地情况的重要性》.pdf
  • API PUBL 4617-1995 Monte Carlo Approach to Generating Equivalent Ventilation Rates in Population Exposure Assessments《室外暴露评估中用蒙特卡洛方法产生当量通风率》.pdf API PUBL 4617-1995 Monte Carlo Approach to Generating Equivalent Ventilation Rates in Population Exposure Assessments《室外暴露评估中用蒙特卡洛方法产生当量通风率》.pdf
  • API PUBL 4618-1995 Characteristics and Performance of Supercritical Fluid Extraction (SFE) in the Analysis of Petroleum Hydrocarbons in Soils and Sludges《分析土壤和淤泥中石油烃时超临界流体(SFE)萃取的特.pdf API PUBL 4618-1995 Characteristics and Performance of Supercritical Fluid Extraction (SFE) in the Analysis of Petroleum Hydrocarbons in Soils and Sludges《分析土壤和淤泥中石油烃时超临界流体(SFE)萃取的特.pdf
  • API PUBL 4619-1995 Study to Characterize Air Concentrations of Methyl Tertiary Butyl Ether (MTBE) at Service Stations in the Northeast《表征东北部加油站空气中所含甲基叔丁基醚(MTBE)的研究》.pdf API PUBL 4619-1995 Study to Characterize Air Concentrations of Methyl Tertiary Butyl Ether (MTBE) at Service Stations in the Northeast《表征东北部加油站空气中所含甲基叔丁基醚(MTBE)的研究》.pdf
  • API PUBL 4620-1995 International Oil Spill Conference Proceedings Achieving and Maintaining Preparedness《实现和维护准备国际溢油会议程序》.pdf API PUBL 4620-1995 International Oil Spill Conference Proceedings Achieving and Maintaining Preparedness《实现和维护准备国际溢油会议程序》.pdf
  • 相关搜索

    当前位置:首页 > 考试资料 > 职业资格

    copyright@ 2008-2019 麦多课文库(www.mydoc123.com)网站版权所有
    备案/许可证编号:苏ICP备17064731号-1