考试试卷-A.doc

上传人:sk****8 文档编号:3532439 上传时间:2019-06-02 格式:DOC 页数:9 大小:89.50KB
下载 相关 举报
考试试卷-A.doc_第1页
第1页 / 共9页
考试试卷-A.doc_第2页
第2页 / 共9页
考试试卷-A.doc_第3页
第3页 / 共9页
考试试卷-A.doc_第4页
第4页 / 共9页
考试试卷-A.doc_第5页
第5页 / 共9页
点击查看更多>>
资源描述

1、1中山大学授予学士学位工作细则第六条考 试 作 弊 不 授 予 学 士 学 位计 算 机 科 学 系 2009 上 学 期 程 序 设 计 I 期 末 考 试 试 题 (A)任 课 教 师 : 肖 菁 、 吴 维 刚 考 试 形 式 : 闭 卷 考 试 时 间 : 2 小 时年级: 09 专业: 计科、网工、信安 姓名: _ 学号: _成绩 _ 1. Single Answer Questions (Only one choice is correct). 20points.Choose the alternative(s) that best completes the statement

2、or answers the question.1) _ translates high-level language program into machine language program. A) CPU B) A compiler C) An assembler D) The operating system 2) _ is an object-oriented programming language. A) Pascal B) Java C) Ada D) C 3) Which of the following is a valid user-defined identifier?

3、 A) _343 B) 9X C) 8+9 D) class 4) To improve readability and maintainability, you should declare _ instead of using literal values such as 3.14159. A) classes B) constants C) variables D) functions 5) What is the value of (double)(5/2)? A) 2.5; B) 2.0; C) 2; D) 3; E) 3.0; 6) Suppose x is a char vari

4、able with a value b. What is the printout of the statement cout 0)if (y 0)cout 0 and y 0“;else if (z 0)cout 0“; A) x 0 and y 0; B) x 0; C) no printout. D) x =5) D) (x = 1) | (x != 1) 10) What is the value of “1.0 + 1.0 + 1.0 = 3.0“? A) true B) false C) There is no guarantee that 1.0 + 1.0 + 1.0 = 3.

5、0 is true.11) What is the execution result of the following statements? char *p =”abcdefgh”; p+=3;cout#include using namespace std;int countVowels(char *text)int novowels;for(int x =0; xstr; /Get the text string from keboardcout#include using namespace std;enum TYPE CAT, DOG, TORTOISE, OTHER;class P

6、etpublic:Pet()strcpy(name, “unknown“);age = 0;type = OTHER;Pet(char *name, int age,TYPE type)strcpy(this-name, name);this-age=age;this-type=type;516)17)18)19)20)21)22)23)24)25)26)27)28)29)30)31)32)33)34)35)36)37)38)39)40)return 0;void showSound()switch (type)case CAT:coutusing namespace std;int num

7、=0;void func1()static int num_1=0;num_1+;num+;6cout using namespace std;int func(int number, int sn)int factor;if(number = 1) return 1;factor =2;while(number %factor!=0) factor+;if(sn =0) coutusing namespace std;7#define MAXWIN 3class Windowpublic:Window()coutn;if (is_circle_num(n,10)else cout”false

8、”endl;return 0; 95. Programming design. 20points.Please write a program to handle an Addressbook. What to do?1. Design a class Addressbook that encapsulates your friends information, e.g. name, phone number, address;a) The class should provide functions to read information from keyboard and set the

9、data fields accordingly;b) The class should also provide a function to print your friends information in your addressbook into a file named “output.txt”. 2. Write a main function to show how to create Addressbook objects and call the functions.a) Your friends information is originally input from keyboard.Requirements and hints:1. Make sure that the data fields are marked as private to protect them from illegal access. 2. You are required to store 3 friends information in your addressbook.

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 实用文档资料库 > 策划方案

Copyright © 2018-2021 Wenke99.com All rights reserved

工信部备案号浙ICP备20026746号-2  

公安局备案号:浙公网安备33038302330469号

本站为C2C交文档易平台,即用户上传的文档直接卖给下载用户,本站只是网络服务中间平台,所有原创文档下载所得归上传人所有,若您发现上传作品侵犯了您的权利,请立刻联系网站客服并提供证据,平台将在3个工作日内予以改正。