浙江大学2004-2005上学期“程序设计基础--C”试卷
浙江大学C语言程序设计理论考试模拟试题答案

浙江大学C语言理论考试模拟试题答案一、判断题共10题,每题1分,共10分。
正确的请选择A,错误的请选择B。
1、在C语言中,函数不可以嵌套定义,但函数可以嵌套调用。
AA、正确B、错误解答:A2、在程序中else 子句可以单独使用。
BA、正确B、错误解答:B3、C 语言源程序文件通过了编译、连接之后, 生成一个后缀为.EXE 的文件。
( ) AA、正确B、错误解答:A4、_ya是不合法的C语言标识符。
BA、正确B、错误解答:B5、在数组初始化时,如果初值个数多于数组长度,将出现错误。
AA、正确B、错误解答:A6、C语言规定,函数返回值的类型是由return语句中的表达式类型所决定。
BA、正确B、错误解答:B7、若有定义int *p, 则表达式p++ 的值就是p 所指向的变量的地址值加1。
BA、正确B、错误解答:B8、'\n'不是一个字符常量。
BA、正确B、错误解答:B9、表达式(z=0, (x=2)||(z=1),z) 的值是1。
BA、正确B、错误解答:B10、若打开文件的方式为“w”而该文件已经存在,则文件中原有数据被清空。
A、正确B、错误二、单选题请从给定的选项中选择一个唯一正确的选项。
每小题2分,共10题,20分。
1、 C下面有关变量的命名,不合法的是:( )A. _intB. __intintC. __int&intD. ___intintintC解答:C2、有变量定义int a;float c;下面输入语句有语法错误的是( )。
A. scanf("%d,%f", &a, &c);B. scanf("x=%d, c=%f", &a, &c);C. scanf("%d%f", &a, &c);D. scanf("%f %d",&a, &c);D解答:D3、下面关于函数参数使用的说法,不正确的是:()A. 函数调用时实参按顺序传递到形参;B. 函数调用时实参把值传递给形参;C. 函数的实参和形参个数可以不一致,但使用时应尽量一致;D. 函数的实参和形参可以同名;C解答:C4、已知int k=1; for(k=1;1;k++) if(k) break; for语句的循环次数是( )。
C语言程序设计试题4

浙江大学“程序设计基础-C”试题卷2001-2002学年春季学期考试时间: 2002年6月30日下午2:00-4:00注意:答题内容必须写在答题卷上,写在本试题卷上无效一.单项选择题(每题2分,共20分)1. 1. C 语言程序的三种基本结构是顺序结构、选择结构和______结构。
A.递归B.转移C.循环D.嵌套2. 2.下列运算符中,优先级最高的是_____。
A.-> B.++ C.&& D.=3. 3.表达式!(x>0&&y>0) 等价于_____。
A.!(x>0)||!(y>0) B.!x>0||!y>0 C.!x>0&&!y>0 D.!(x>0)&&!(y>0)4. 4.表达式sizeof("\nsum=%d\n") 的值是______。
A.8 B.9 C.10 D.115. 5.以下选项中不正确的实型常量是_____。
A.0.23E B.2.3e-1 C.1E3.2 D.2.3e06. 6.表达式______的值不是1。
A.0?0:1 B.5%4 C.!EOF D.!NULL7. 7.数组定义为int a[11][11],则数组a 有_____个数组元素。
A.12 B.144 C.100 D.1218. 8.对于以下的变量定义,表达式______是不正确的。
struct node {int j, k;} x, *p=&x;A.p->k=2 B.(*p).k=2 C.x.k=2 D.x->k=29. 9.不正确的赋值或赋初值的方式是______。
A.char str[ ]="string"; B.char str[10]; str="string";C.char *p="string"; D.char *p; p="string";10. 10.设程序中不再定义新的变量,写出在函数main中可以使用的所有变量______。
浙大_建筑构造00-05年真题整理版带答案解...

浙江大学建筑学建筑构造部分2000一名词解释:1勒脚及其作用:墙角是指室内地面以下,基础以上的这段墙体,外墙的墙角称勒角。
P192圈梁及其作用:圈梁是沿砌体房屋外墙四周及横墙设置的连续封闭的水平梁。
圈梁的作用是增加房屋的整体刚度和稳定性,减轻地基不均匀沉降对房屋的破坏,抵抗地震力的影响。
P233隔断及其作用:4刚性防水屋面及其优缺点:刚性防水屋面只指用细石混凝土作防水层的屋面,因混凝土属于脆性材料,抗拉强度教低,故叫刚性防水屋面。
主要优点是构造简单,施工方便,造价较低;缺点是易开裂,对气温变化和屋面基层的变形的适应较差。
P124二问答题1简述建筑构造设计的原则。
1.坚固实用2.技术先进3.经济合理4.美观大方三做一楼梯剖面图。
某中学教学楼层高为米,楼梯间宽度为米。
进深为米,室内外地坪高差为米。
试设计一双折式梯段的楼梯。
要求在梯段休息平台下做出入口,并保证平台梁第净高大于等与2100mm.2001图为某单元式错层住宅底层平面及其剖面示意图。
该住宅层高米,室内外高差为600。
采用砖混结构,墙厚240,楼板均为现浇钢筋混凝土板,底层地面结构层作法自定。
卧室地面采用木装修面层,阳台面层为防滑地砖,阳台栏杆采用漏空栏杆。
1请作出勒脚详图A-A,(自室外地面至窗台)2请作出阳台详图B-B,(自标高为中心,上下各取约1米)3请通过计算确定楼梯踏步尺寸(宽和高)和楼梯开间、进深的最经济尺寸,并作出楼梯间的标准层(二层)平面图1:50。
图中应注出必要的尺寸和平台标高。
2002图为某办公楼局部平面,剖面示意图。
该办公室采用砖混结构。
所有墙厚都为240。
楼面、屋面均采用现浇钢筋混凝土结构。
屋面找坡采用材料垫坡。
防水方式自定。
所有房间地面面层采用木装修,外廊面层及栏杆做法自定。
1请做(1)剖面详细图2请做(2)剖面详细图3请做(3)剖面详细图(范围:以标高为中心,上下各约米)注:以上所有详土中均应注明各部位材料做法及有关尺寸。
浙江大学“C程序设计及实验”试题卷

浙江大学“C程序设计及实验”试题卷2003-2004学年春季学期考试时间: 2004年6月25日上午8:30-10:30注意:答题内容必须写在答题卷上,写在本试题卷上无效一.单项选择题(每题1分,共10分)1. C 语言程序的三种基本结构是顺序结构、选择结构和__C____结构。
A.递归B.转移C.循环D.嵌套2. 下列运算符中,优先级最高的是__B___。
A.+= B.[ ] C.? : D.&3. 运算符___A__ 不能做为单目运算符。
A./ B.& C.* D.+4. 以下选项中不正确的字符常量是___C__。
A.'1' B.'\0' C.'%d' D.105. 表达式x&&1 等价于_C____。
A.x==0B.x==1C.x != 0D.x != 16. 已知字符‘a’ 的ASCII码为97 ,执行下列语句的输出是__A___。
printf ("%c%d", ’b’, ’b’+1 ) ;A.b99B.98c C.9899D.bc7. 在C 语言程序中,在函数内部定义的变量称为__C____。
A.全局变量B.外部变量C.局部变量D.内部变量8. 执行语句printf(" ___D___", "hello"); 将得到出错信息。
A.%u B.%s C.%x D.%f9. 对于以下的变量定义,表达式___D___是不正确的。
struct node {float x, y;} point, *p=&point;A.p->x=2.0 B.(*p).y=3.0 C.point.x=2.0 D.*p->y=3.010. 对于变量定义:int **p[10], p 是一个__B___。
A.指针B.数组C.函数D.数组元素二、填空题(每题2分,共30分)1. 写出计算s(s-a)(s-b)(s-c)的C语言表达式______。
浙江大学“程序设计基础-C”试题卷

浙江大学“程序设计基础-C”试题卷一.单项选择题(每题2分,共20分)1.C语言程序的三种基本结构是顺序结构、选择结构和______结构。
A.递归B.转移C.循环D.嵌套2.下列运算符中,优先级最高的是_____。
A.->B.++C.&&D.=3.表达式!(x>0&&y>0)等价于_____。
A.!(x>0)||!(y>0)B.!x>0||!y>0C.!x>0&&!y >0D.!(x>0)&&!(y>0)4.表达式sizeof("\nsum=%d\n")的值是______。
A.8B.9C.10D.115.以下选项中不正确的实型常量是_____。
A.0.23EB.2.3e-1C.1E3.2D.2.3e06.表达式______的值不是1。
A.0?0:1B.5%4C.!EOFD.!NULL7.数组定义为inta[11][11],则数组a有_____个数组元素。
A.12B.144C.100D.1218.对于以下的变量定义,表达式______是不正确的。
structnode{intj,k;}x,*p=&x;A.p->k=2B.(*p).k=2C.x.k=2D.x->k=2 9.不正确的赋值或赋初值的方式是______。
A.charstr[]="string";B.charstr[10];str="stri ng";C.char*p="string";D.char*p;p="string";10.设程序中不再定义新的变量,写出在函数main中可以使用的所有变量______。
#include<stdio.h>intz;intp(intx){staticinty;return(x+y);}voidmain(){inta,b;printf("%d\n",p(a));……}A.a,bB.a,b,zC.a,b,y,zD.a,b,x,y,z二、填空题(每题2分,共30分)1.设字符型变量ch的值是小写英文字母,将它转换为相应大写字母的表达式是______。
浙大C程序设计期末试卷-c_2004A

A.3
B.7
C.10
D.11
9. After running the following code fragment, the value of s is ______.
int i=5, s=0;
《C Programming》TEST PAPER, Jan 22, 2005
1/8
do if (i%2) continue; else s+=i; while (--i);
1. The precedence of operator _____ is the lowest one.
A.? :
B.==
C.+=
D.&
2. _____ is correct if it is used as a character constant.
A.’\’
B.'\080'
C.'%d'
D.0xa
1 4 7 10 13 16 19 22 25. 6. According to the declaration: int a[10], *p=&a[1]+2; the last element of array a is p[__]. 7. Write the declaration_____ with typedef, which makes PA a synonym for a character pointer
{
int x = 2; P(x*F(2));
}
{ for (; x < 10; x += 50)
P2(x, 9.15*x+32);
}
《C Programming》TEST PAPER, Jan 22, 2005
浙江大学“程序设计基础-C”试题卷 (2)

2000~2001学年“程序设计基础--C”试卷考试时间:2000年6月27日下午2:00-4:00注:请将答案写在答题卷上一、单项选择题(每题2分,共30分)1.______是合法的用户自定义标识符。
A、b-bB、floatC、<fr>D、_isw2.若变量已正确定义并赋值,表达式______不符合C语言语法。
A、a*b/c;B、3.14%2C、2,bD、a/b/c3._____是不正确的字符常量。
A、'\n'B、'1'C、"a"D、'\101'4.在C程序中,用_____表示逻辑值“真”。
A、1B、非0的数C、非1的数D、大于0的数5.______把x、y定义成float类型变量,并赋同一初值3.14。
A、floatx,y=3.14;B、floatx,y=2*3.14;C、floatx=3.14,y=x=3.14;D、floatx=y=3.14;6.若变量已正确定义,表达式______的值不是2。
A、2&3B、1<<1C、a==2D、1^37.若变量已正确定义,语句“if(a>b)k=0;elsek=1;”和______等价。
A、k=(a>b)?1:0;B、k=a>b;C、k=a<=b;D、a<=b?0:1;8.设变量定义为“inta,b;”,执行下列语句时,输入_____,则a和b的值都是10。
scanf("a=%d,b=%d",&a,&b);A、1010B、10,10C、a=10b=10D、a=10,b=109.下列程序的输出结果是_____。
fun(inta,intb,intc){c=a*b;}main(){intc;fun(2,3,c);printf(”%d\n”,c);}A、0B、1C、6D、无法确定10.在C程序中,若对函数类型未加说明,则函数的隐含类型为_____。
浙大C++2005~2006春浙江大学考试答答案和评分标准

浙江大学2005–2006学年_春_季学期《面向对象程序设计》课程期末考试试卷开课学院:计算机学院,考试形式:闭卷考试时间:_2006_年_4_月_18_日,所需时间: 120 分钟,任课教师_________ 考生姓名: _____学号:专业: ________1. Write the output of the code below(20%):每题4分1)int aa1=53,aa2=69;void f(int a1,int &a2){a2=a1;a1+=a2;cout << aa1 << aa2 << endl; //看清楚题目aa2 -= 7;a2++;}void main(){f(aa1,aa2);cout << aa1 << aa2 <<endl;}535353472) class A{static int m; //careint n;public:A(int m,int n){this->m=m;this->n=n;}Print(){ cout << m <<"---" << n << endl;}};int A::m; //改错时候注意void main(){A a1(3,4);A a2(5,6);a1.Print();a2.Print();}5---45---63)char a['z'];for (char i='a';i<='z';i++)a[i] = 'A'+i-'a';cout << a['e'] << endl;for (char i='a';i<='z';i++)a[i] = '1'+i-'a';cout << a['e'] << endl;E54)#include <iostream>using namespace std;class A {int i;public:A():i(10) { cout << "A() " <<i <<"\t"; f(); }virtual ~A() { cout << "~A() " << "\t"; }virtual void f() { i+=11; cout << "A::f() " <<i <<"\t"; }void g() { i+=12; cout << "A::g() "<<i<<"\t"; }};class B : public A {int i;public:B():i(20) { cout << "B() " <<i <<"\t"; f();}~B() { cout << "~B() " << "\t"; }void f() { i+=22; cout << "B::f() " <<i <<"\t"; }void g() { i+=12; cout << "B::g() "<<i<<"\t"; }};B gen(){return B();}int main(){A* p = new B();p->f();cout <<endl;A a;B b = gen();a = b;a.f();cout <<endl;b.g();delete p;return 0;}A() 10 A::f() 21 B() 20 B::f() 42 B::f() 64A() 10 A::f() 21 A() 10 A::f() 21 B() 20 B::f() 42 A::f() 32 B::g() 54 ~B() ~A() ~B() ~A() ~A()此题答案不要求tab的对齐,但是如果存在换行错误(多余的或缺少的),所有的换行错误合计扣1分5)void main(){int m = 555;int n = 666;int &k = m;k++;cout << m <<”----“ << n << endl;k = n;k++;cout << m <<”----“ << n << endl;}556----666667----6662. Please choose the correct answer(15%)1-6每题2分,第7题3分D1、In C++ Language,function prototype doesn’t identify ( )A. The return type of the function.B. The number of arguments of the functionC. The type of arguments of the function.D. The functionality of the functionB 2、In C++ program, objects communicate each other by ( )A. InheritanceB. Calling member functionsC. EncapsulationD. Function overloadingB 3、For an arbitrary class,the number of destructor function can’t be bigger than ( )A. 0B. 1C. 2D. 3C 4、 Suppose a class is defined without any keywords such as public, private and protected,all members default to: ( )A. publicB. protectedC. privateD. staticC 5、About inline function, which statement is correct? ( )A. When the program is executed, inline function will insert the object code to every place where this function is called.B. When the program is compiled, inline function will insert the object code to every place where this function is called.C. Inline function must be defined inside a class.D. Inline function must be defined outside a class with keyword “inline”.B 6、During public inheritance, which statement is incorrect concerning the base class objects and the derived class objects? ( )A. Derived class objects can be assigned to base class objects.B. Derived class objects can initialize base class references.C. Derived class objects can access the members of base class.D. The addresses of derived class objects can be assigned to base class pointers.C 7、For the class definition:class A{public:virtual void func1( ){ }void func2( ){ }};class B: public A{public:void func1( ){cout<< ″ class B func 1 ″ <<end1;}virtual void func2( ){cout<< ″ class B func 2 ″ <<end1;}};Which statement is correct? ( )A. Both A::func2( ) and B::func1( ) are virtual functionsB. Both A::func2( ) and B::func1( ) are not virtual functionsC. B::func1( ) is virtual function, while A::func2( ) is not virtual functionD. B::func1( ) is not virtual function, while A::func2( ) is virtual function3. Please correct the following programs(point out the errors and correct them)(15%) 1) 6分,每错2分class A{protected:static int k;int m;public:};int A::k;class B : public A{int n;public:static void F(int k){this->A::k = k;}void F2(int m){this->m = m;}};void main(){B b1,b2;b1.F(3);b2.F2(5);}2)2分char a[3];const char *const ptr = a;const char c = 'a';ptr = &c;3) 2分class base{...public:virtual void f(void)=0;virtual void g(void)=0;}class derived: public base{...public:virtual void f(void);virtual void g(void);};derived d;4) 5分,前3错各1分,最后一题错2分(基本正确给一分),class A{int *m_ip;public:A(int *ip = NULL){if(ip){m_ip = new int[5];::memcpy(m_ip,ip,sizeof(int)*5);}elsem_ip = NULL;}~A(){delete m_ip; //改成 delete [] m_ip更好}A operator+(const A &a) const { // (1)(2)A temp(m_ip);for (int i=0; i<5; i++)temp.m_ip[i] += a.m_ip[i];return temp;}const A &operator=(const A &a){ // (3)if(a.m_ip){m_ip = new int[5];::memcpy(m_ip,a.m_ip,sizeof(int)*5);}elsem_ip = NULL;return *this;}friend ostream operator<<(ostream &,const A &);};ostream operator<<(ostream &out ,const A &a); // (4){out << “(“ ;for (int i=0;i<4;i++)out << a.m_ip[i] << “,”;return out << a.m_ip[5] << “)”;}// Suppose the following code is correctvoid main(){const int k[5]={3,5,6,2,1};const A a1(k),a2(k);A a3(k);a3 = a1+a2;cout << a3 << endl;}4、Fill in the blanks(30%)每格2分1)The function template MaxMin() can find out the max and min of a two dimension array,row is first dimension of length and col is second dimension of length . #include <iomanip.h>template <class T> void MaxMin(T* array,int row,int col){T max = array[0],min = array[0];for(_int i=0 ;i<row;i++)for( int j=0 ;j<col;j++){if( max <array[i*col+j] )max = array[i*row+j];if( min > array[i*col+j] )min = array[i*row+j];}cout << "max=" << max << endl;cout << "min=" << min << endl;}void main(){int ai[2][3]={{8,10,2},{14,4,6}};MaxMin( (int*)ai, 2, 3 );}2) Please fill in the suitable code to make the program results 60。
《C程序设计基础及实验》课程期中考试试卷参考答案

《C程序设计基础及实验》课程期中考试试卷参考答案浙江⼤学《C程序设计基础及实验》课程期中考试试卷参考答案考试⽇期: 2017年 12 ⽉ 8 ⽇,考试时间: 70 分钟诚信考试,沉着应考,杜绝违纪。
考⽣姓名:学号:所属院系: _ (注意:答题内容必须写在答题卷上,写在本试卷上⽆效)试题⼀、单选题(每⼩题2分,共20分)1. 以下正确的字符常量是______。
A.’\412’B.255 C.’\08’D.’\’【解答】A.⼋进制412超出了8位⼆进制所能表⽰的范围03ff;B.255是⼀个合法的整数,可以表⽰⼀个字节的值;C. 8不是⼀个合法的⼋进制数字;D. \是转义字符,\’表⽰单个单引号字符本⾝,所以。
字符常量缺少右单引号。
2. 假设有定义:float x=16/5/2.0, y=16/5.0/2; 则x 和y 的值分别为______。
A.1.5 1.6 B.1.6 1.6 C.1.5 1.5 D.1.6 1.5【解答】16/5/2.0 → (16/5)/2.0 → 3/2.0 → 1.516/5.0/2 → (16/5.0)/2 → 3.2/2 → 1.63. 下列语句中,_____ 将输出%d。
A.printf(“%d”); B.printf(“%%d”); C.printf(“\%d”); D.printf(“%%%d”)【解答】A.%d表⽰输出⼗进制整型量,但缺少相应的输出表达式,故输出结果是随机值;B.%%表⽰输出⼀个%符号本⾝,d是普通字符,原样输出,所以输出%d;C.\%表⽰符号%,%d表⽰输出⼗进制整型值,故输出结果是随机值;D.%%表⽰输出符号%本⾝,%d表⽰输出⼗进制整型值。
4. 下列程序段输出结果为_____。
.int x=1, y=012;printf(“%d”,y*x++);A.12 B.10 C.20 D.24【解答】x++表达式的值是1,y*x++ → y*1 → y → 012 → 105. 下列程序段输出结果为_____。
浙大发教〔2005〕112号关于印发《浙江大学本科课程考核管理办法(2005年11月制订)的通知

关于印发《浙江大学本科课程考核管理办法(2005年11月制订)》的通知文件编号:浙大发教(2005)112号发文日期:2005-11-10浙大发教〔2005〕112号关于印发《浙江大学本科课程考核管理办法(2005年11月制订)的通知各学院,各部门,各校区管委会,直属各单位:现将〘浙江大学本科课程考核管理办法(2005年11月制订)〙印发给你们,请遵照执行。
浙江大学二○○五年十一月十日浙江大学本科课程考核管理办法总则第一条为建设和维护求是、创新的优良学风,严肃考纪,端正考风,使考核工作进一步科学化和规范化,根据〘普通高等学校学生管理规定〙(中华人民共和国教育部第21号令)、〘教育部国家发展改革委财政厅关于做好2005年高等学校收费工作有关问题的通知〙(教财[2005]10号),特制定本办法。
第二条考核是检验教学效果、保证教学质量的重要手段,其目的在于指导、督促学生系统地复习和巩固所学知识和技能,检验其理解程度和灵活运用能力,调动学生学习的主动性和积极性,培养学生的创新精神和创新思维。
第三条考核工作是教学管理的重要环节,是教学质量管理与评价的重要内容,应坚持公平、公正、诚实、严谨的原则。
凡属教育教学计划规定的课程应当进行学期考核,实习、实验、课程设计、毕业(设计)论文等实践性教学环节也应当进行考核。
第四条学校实行补考制。
课程考核不及格者有1次补考机会。
第五条凡本校在籍的本科学生必须参加所修课程(含实践环节)的考核,并取得相应的成绩,成绩合格者可获得相应的学分。
第一章考核组织工作第六条考核工作由教务处在主管校长的领导下,依照本办法和学校相关规定进行组织和协调,各院系依照本办法、教育教学计划及相关规定组织实施。
第七条各院系主管领导要认真抓好考核工作的各个环节,在期末考核前应召开院系领导、任课教师、班主任、监考人员和学生等会议,以保证考核工作的顺利进行。
第八条考核时间依据当学年校历安排,具体时间由教务处排定。
1浙江大学2004—2005学年秋学期期终考试《软件工程》课程试卷

浙江大学2004 —2005 学年秋学期期终考试《软件工程》课程试卷考试时间:__120__分钟开课学院_ 计算机学院_ 专业__姓名______________ 学号_____________任课教师_______________题序一二三四总分评分评阅人I. Please select the correct answers and fill in the answer sheet: (20 pts.)Note: Zero point for a blank selection since there is at least one answer for each problem.1. Approximately which activity listed below will consume the least amount of time in a project?(A)analysis (B) design (C) coding (D) testing2. The first step in project planning is to(A) determine software scope (B) select project team leader(C) determine the budget (D) determine the process model3. Which factors are important when choosing a project team leader?(A) managerial identity (B) outstanding programming ability(C) problem solving ability (D) ability of communicating to other people4. The importance of software design can be summarized in a single word:(B)accuracy (B) complexity (C) efficiency (D) quality5. Which of the following interface design principles reduce the user's memory load? .(A) define intuitive shortcuts (B) disclose information in a progressive fashion(C) each application should have its own distinctive look and feel (D) establish meaningful defaults6. Cohesion is a qualitative indication of the degree to which a module(A) can be written more compactly (B) is connected to other modules and the outside world(C) is able to complete its function in a timely manner (D) focuses on just one thing7. Notations for depicting procedural detail include(A) box diagram (B) ER diagram (C) flow chart (D) decision table8. The best reason for using independent software test teams is that(A)software developers do not need to do any testing(B)testers do not get involved with the project until testing begins(C) strangers will test the software mercilessly(D) the conflicts of interest between developers and testers is reduced9. Which ones of the following are the primary benefits of object-oriented architectures?(A)improved execution performance (B) simplified interfaces(C) information hiding (D) easy component reuse10. Which diagrams are to be built in an object-behavior model?(A)use-case (B) event trace (C) data flow (D) state transitionII. Please specify “T” (true) or “F” (false) for the following statements: (10 pts.)1.Customers, end-users, practitioners, project managers and sales people are all considered as players in the software process.2.Software configuration includes all information produced as part of the software process, such as programs, documents, data, and possibly some developing tools.3.A good software is flexible, so it can easily accommodate changes brought up with the requirement change. 4.Software engineering includes three generic phases: software design, code generation, and software testing.5.We should consider the implementation view first during software requirements analysis.6.Class responsibilities are defined by both its attributes and operations.7.Every computer-based system can be modeled as an information transform using an input-processing-output template. 8.Test cases should be designed long before testing begins.9.Recovery testing is a system test that forces the software to fail in a variety of ways and verifies that software is able to continue execution without interruption.10.C lass testing for OO software is to test operations or algorithms individually for classes.III. Please give brief answers to the following questions: (20 pts.)1.As a modern software project manager, what must you do to begin a project? Please briefly describe the majoractivities of project management. (6 pts.)2.Please give explanations on why requirements elicitation is so difficult. (4 pts.)3.Given a procedure for computing the average of positive numbers:i=0;sum=0;inputa;do while a!=0 { if(a>0){ i++;sum+=a;}inputa;} if(i>0)average=sum/i; elseaverage=-999;Please:(1) draw the corresponding flow graph; (2 pts.)(2) tell the cyclomatic complexity of the procedure; (2 pts.) and(3) list all the independent paths for basis path testing. (2 pts.)4.Please describe the OO recursive/parallel process model for developing software systems. (4 pts.)IV. Given the description of the Football Player System, please analyze the system requirements and complete the requested models. (50 pts.)Football Player System description: The system is to control the motion of robots in a multi-robot football competition. The software must be able to decode the images obtained by the cameras in the robots’ eyes, analyze the information and judge the current state of the field (i.e. the positions of collaborators, rivals, and the ball). Then the system is supposed to send a signal of action (i.e. forward, backward, turn, or stop) to the engine. At the mean time, the software must be able to recognize foul plays. The system can be connected to the main server and be loaded with knowledge such as the rules and strategies of the competition.1.Please draw the data flow diagram for the system. (12 pts.)2.Please give the 4 most important data dictionary cards. (8 pts.)3.Please draw the system state transition diagram. (10 pts.)4.Please give the 4 most important CRC cards. (8 pts.)5.Please draw the relationship diagram between objects according to the above 4 CRC cards. (12 pts.)Answer SheetPart I1. 2. 3. 4. 5.6. 7.8. 9. 10.Part II1. 2. 3. 4. 5.6. 7. 8. 9. 10.Part III1.2.3.4.Part IV。
浙江大学“程序设计基础-C”试题卷

浙江大学“程序设计基础-C”试题卷2001-2002学年秋季学期考试时间: 2002年1月20日上午8:30-10:30注意:答题内容必须写在答题卷上,写在本试题卷上无效一.单项选择题(每题2分,共30分)1. C语言源程序文件经过编译连接之后生成一个后缀为___C___的文件。
A.”.c”B.“.obj”C.“.exe”D.“.bas”2. 以下选项中不正确的整型常量是___C__。
A.12L B.-10 C.1,900 D.123U3. 表达式___C___的值是0。
A.3%5 B.3/5.0 C.3/5 D.3<54. 表达式!(x>0||y>0) 等价于___D__。
A.!x>0||!y>0 B.!(x>0)||!(y>0) C.!x>0&&!y>0 D.!(x>0)&&!(y>0)5. 若变量已正确定义并赋值,表达式___D___不符合C语言语法。
A.4&&3 B.+a C.a=b=5 D.int(3.14)6. 若变量已正确定义,执行语句scanf("%d%d%d ",&k1,&k2,&k3);时,___B___是正确的输入。
A.203040 B.20 30 40 C.20, 30 40 D.20, 30,407. 执行语句printf(" ___D___", 2); 将得到出错信息。
A.%d B.%o C.%x D.%f8. 设变量定义为char s[ ]="hello\nworld\n";,则数组s中有___B__个元素。
A.12 B.13 C.14 D.159. 若x是整型变量,表达式(x=10.0/4.0) 的值是__D___ 。
A.2.5 B.2.0 C.3 D.210. 若变量已正确定义并赋值,表达式-k++ 等价于__A____。
程序设计基础(C)离线作业-答案-2017-浙江大学远程教育学院

浙江大学远程教育学院《程序设计基础(C)》课程作业姓名:袁洋学号:717129012012年级:2017春学习中心:紫金港校区—————————————————————————————第1章C语言的基本构成由add、main、scanf、printf函数组成,调用了scanf、printf两个系统函数。
保留字:int、return。
自定义标识符:add、a、b、c、x、y、z。
第2章输入输出程序设计1.用printf输出一个中空的五角星。
#include<stdio.h>void main(){printf(" * \n");printf(" * * \n");printf(" * * \n");printf(" * * \n");printf(" * * * * * * * *\n"); printf(" * * \n");printf(" * * \n");printf(" * *\n");printf(" * * * \n");printf(" * * * * \n");printf(" * * * * \n");printf(" * * * * \n");}2.仿照例子2.2,定义一个字符数组,从键盘输入一字符串,然后输出的程序。
#include<stdio.h>void main(){char charshuz[20];puts(gets(charshuz));}3.从键盘输入十六进制整数,转化为八进制数输出。
#include<stdio.h>void main(){int shiliu;scanf("%x",&shiliu);printf("%o\n",shiliu);}4.只定义两个整型数据并赋值,实现两个整型数的互换。
浙江大学C程序设计 答案二

浙江大学C程序设计答案二20021程序填空,不要改变与输入输出有关的语句。
输入一个正整数repeat (0<repeat<10),做repeat 次下列运算:输入x,计算并输出下列分段函数f(x) 的值(保留1位小数)。
当x 不等于0时,y = f(x) = 1/x,当x 等于0时,y = f(x) = 0。
输入输出示例:括号内是说明输入2 (repeat=2)10 (x=10)0 (x=0)输出f(10.00) = 0.1f(0.00) = 0.0#include <stdio.h>int main(void){int repeat, ri;double x, y;scanf("%d", &repeat);for(ri = 1; ri <= repeat; ri++){scanf("%lf", &x);/*---------*/if(x!=0) y=1/x;else y=0;printf("f(%.2f) = %.1f\n", x, y);}}20022程序填空,不要改变与输入输出有关的语句。
输入华氏温度,输出对应的摄氏温度。
计算公式:c = 5*(f-32)/9,式中:c表示摄氏温度,f表示华氏温度。
输入输出示例:括号内为说明输入150 (fahr=150)输出celsius = 65#include <stdio.h>int main(void){int celsius, fahr;/*---------*/scanf(“%d”,&fahr);celsius=5.0*(fahr-32)/9;printf("celsius = %d\n", celsius);}20023程序填空,不要改变与输入输出有关的语句。
输入存款金额money、存期year 和年利率rate,根据下列公式计算存款到期时的利息interest(税前),输出时保留2位小数。
浙江大学远程教育程序设计基础C在线作业

单选题1.【第1章】合法的C语言长整型常数是()。
A 0LB 5712700CD正确答案:A单选题2.【第1章】以下选项中不合法的用户标识符是()。
A abc.cB fileC MainD PRINTF正确答案:A单选题3.【第1章】以下选项中不合法的用户标识符是()。
A l23B printfC $D Dim正确答案:B单选题4.【第1章】以下选项中不正确的实型常量是()。
A -1B .CD 456e-2正确答案:B单选题5.【第1章】以下选项中正确的整型常量是()。
A 12.B -20C l,000D 0458正确答案:B单选题6.【第1章】C语言中,要求运算数必须是整型的运算符是()。
A %B /C <D !正确答案:A单选题7.【第1章】()是C语言提供的合法的数据类型关键字。
A FloatB signedC integerD character正确答案:B单选题8.【第1章】C语言中运算对象必需是整型的运算符是()。
A \C *D %正确答案:D单选题9.【第1章】()是构成C语言程序的基本单位。
A 函数B 过程C 子程序D 文件正确答案:A单选题10.【第3章】执行语句for(i=0;i++<5;);后,变量i 的值是()。
A 6B 5C 4D 0正确答案:A单选题11.【第3章】若int i=0;下列语句计算1+2+…+10的是()。
A while(s+=i);B for(;i<=10;i++,s+=i)C for(;i<=10;s+=i,i++)D for(;i<9;i++,s+=i)正确答案:B单选题12.【第9章】下列程序输出的结果是()。
#include void f(int * x ){ *x = 10 ; }void main(){ int a,*p=&a; f(p); printf("%d",++(*p));}提示:指针x指与指针p指向同一个变量,10赋给指针x所指的地址上的内容,++(*p)是指指针p所指地址上内容++。
大学计算机基础试卷

浙江大学2004-2005学年第一学期期末考试<<大学计算机基础>>课程试卷 A一.单选题(每一小题1分,共20分)1.从功能上看,计算机数据处理的结果除了取决于输入的数据,还取决于:A.处理器B.程序 C.存储器 D.外设2.计算机的特点可以简单地归纳为精确高速的运算、准确的逻辑判断、强大的存储、自动处理以及:A.网络的能力B.多媒体的能力C.应用设计的能力D.辅助学习的能力3.计算机知识是指:A.能够认识计算机带来的积极和消极影响B.理解计算机基本知识的能力C.能够将它作为工具完成适当的任务D.以上都是4.哪种发明使研制者成功地设计出现代广泛使用的微型计算机:A.电子管 B.集成电路(IC)C.半导体晶体管 D.磁带和磁盘5.硬件和软件是组成计算机的两个部分,而指令系统是连接这两个部分的。
指令由CPU执行。
下列叙述哪一个是不正确的:A.指令是用户通过键盘(或者其他输入设备)输入后并被CPU直接执行的。
B.指令是计算机能够直接识别的二进制代码,任何一种高级语言编写的程序都需要翻译为指令代码才能够被CPU执行。
C.所有指令的集合就是指令系统。
D.汇编语言的语句和指令系统具有一一对应的关系。
6.在计算机中使用的数制是A.十进制 B.八进制C.十六进制D.二进制7.为了适应不同的运算需要,在计算机中使用不同的编码方式,主要是:A.原码、反码和补码B.原码、补码和ASCII码C.原码、反码和Uincode码D.二进制、ASCII和Unicode码8.现代计算机中的CPU为中央处理器,它包含了:A.存储器和控制器B.运算器和控制器C.存储器和运算器D.存储器、运算器和控制器9.计算机中使用半导体存储器作为主存储器,它的特点是:A.速度快,体积小,在计算机中和CPU一起被安装在主板上B.程序在主存中运行,它和外部存储器交换数据C.相对于外部磁盘或者光盘存储器,其容量小,价格贵D.以上都是10.计算机有很多类型的外部设备,它们以哪种方式和主机实现连接:A.插件方式和固定方式B.并行方式和固定方式C.并行方式和串行方式D.无线方式和固定方式11.计算机软件有一个重要的特点,也是软件知识产权保护的核心:A.可以被授权复制B.可以被有条件复制 C.可以无限制地复制 D.不能复制12.计算机系统软件包括以下几个部分:A.操作系统、语言处理系统和数据库软件B.操作系统、网络软件和数据库系统C.操作系统、语言处理系统、系统服务程序D.语言处理系统、系统服务程序、网络软件13.一般情况下,特定格式的数据被计算机处理:A.需要专门的处理程序B.需要使用Windows程序C.大多数系统软件都可以处理D.只要符合标准,不需要专门程序14.计算机用户在使用计算机文件时:A.按照文件的所有权使用文件B.按文件性质寻找存放的位置并使用C.按照存放文件的存储器类型使用D.一般是按照文件名进行存取的15.在计算机科学中,算法这个术语是指:A.求解问题的数学方法B.求解问题并选择编程工具C.选择求解问题的计算机系统D.求解计算机问题的一系列步骤16.软件文档(Document)也可以叫做“文件”,它和下列哪一个共同构成计算机软件:A.计算机数据B.计算机编程语言C.计算机程序D.计算机系统17.在计算机通信系统中,数据同时进行发送和接受的传输模式叫做:A.异步通信B.同步通信C.全双工D.半双工18.为了在联网的计算机之间进行数据通信,需要制订有关同步方式、数据格式、编码以及内容的约定,这些被称为:A.OSI参考模型B.网络操作系统C.网络通信软件D.网络通信协议19.URL(统一资源定位器)的作用是:A.定位在网络中的计算机的地址B.定位网络中的网页的地址C.定位IP地址并实现域名的转换D.定位收发电子邮件的地址20.计算机病毒是一种特殊的计算机程序,它除了具有破坏性外,还具有:A.传染性B.潜伏性C.自我复制D.以上都是二.多选题(在每小题后的数字表示应选择的项数,例如2表示该小题有两个正确的选择项。
浙江大学2007–2008学年夏季学期C程期末试卷

浙江大学2007–2008学年夏季学期《 C程序设计基础与实验》课程期末考试试卷开课学院:计算机学院,考试形式:闭卷,允许带 / 入场考试时间:2008年6月26日上午10:30-12:30, 所需时间:120分钟任课教师:______________考生姓名: _____学号: ______专业:_______________ 注意:答题内容必须写在答题卷上,写在本试题卷上无效。
一、单选题(每题1分,共10分)1. 假定以下表达式中所有变量均已定义为int类型并已赋值,请问其中哪个表达式没有语法错误?A. x = 3.14%2;B. y = 2a+b;C. m = a<b<c;D. n = (-x)++;2. 表达式 'A'+'B' 的类型为:A. charB. intC. doubleD. void3. 执行以下这段程序后,unsigned char a=0;int b=1;do {b++;a--;} while(a!=0);变量b的值等于多少?A. 0B. 1C. 128D. 2574. 如果一个函数的返回值类型为void,则以下哪个说法是正确的?A. 该函数中不可以用return语句B. 该函数中可以用return语句,但必须是最后一个语句C. 该函数中可以用return语句,但return后面不能跟任何表达式D. 该函数可以返回一个任意类型的值,也可以没有返回值5. 执行以下程序后,char a[]="ABC\\XYZ\007\xFF";int n;n = sizeof(a);变量n的值等于多少?A. 10B. 14C. 9D. 176. 用scanf()输入一个double类型的变量的值,则输入格式要用A. "%f"B. "%lf"C. "%f"或"%lf"D. "%ld"7. 假定有以下变量定义语句,float * p,q;请问哪个说法是正确的?A. p和q的类型均为(float *)B. p的类型为(float *),q的类型为floatC. p的类型为float,q的类型为(float *)D. 此变量定义语句有语法错误8. 执行以下程序后,char a = '0';printf("%X", a);将输出什么结果?A. 30B. 0x30C. 0X30D. 09. 假定有如下定义,struct st {char name[10];int score;} a[3], *p=a;请问哪个用法是正确的?A. p->name="Tom";B. *[0]='B';C. (*p)->name[0]='C';D. *(*p).name='D';10. 执行以下语句后,int n = strcmp("ABC", "AB");则以下关于n值的描述哪一个是正确的?A. n=0B. n=1C. n>1D. n<0二、填空题(每题2分,共20分)1. 执行以下代码后,将输出______________。
浙江大学远程教育程序设计基础(C)作业

《程序设计基础(C)》作业第1章C语言的基本构成一、选择题1.(A )是构成C语言程序的基本单位。
(A)函数(B)过程(C)子程序(D)文件2.(B )是C语言提供的合法的数据类型关键字。
(A)Float (B)signed(C)integer (D)Char3.以下选项中不合法的用户标识符是(A )。
(A)abc.c (B)file(C)Main (D)PRINTF4.以下选项中不合法的用户标识符是(B )。
(A)l23 (B)printf(C)A$(D)Dim5.合法的C语言长整型常数是(B )。
(A)0L (B)5712700(C)0.054838743 (D)2.1869e106.C语言中,要求运算数必须是整型的运算符是( A )。
(A)% (B)/(C)< (D)!7.以下选项中正确的整型常量是(B )。
(A)12. (B)-20(C)l,000 (D)04588.以下选项中不正确的实型常量是(B )。
(A)2.607E-1 (B)0.8103e2.(C)77.77 (D)456e-29.C语言中运算对象必需是整型的运算符是(D )。
(A)\ (B)+(C)* (D)%二、程序调试题1.编辑、调试以下程序步骤1:在Visual C++环境下新建文件可用[开始]→[程序]→[Microsoft Visual C++6.0] →[Microsoft Visual C++6.0] →[文件] →[新建]→[文件] →[C++ Sourse File],输入文件请思考文件ex1-1.c由几个函数构成?调用了那几个系统函数?此程序中用到了哪几个保留字?哪几个用户自定义标识符?步骤3:编译并运行程序,程序运行时输入两个整数,20 40 ,观察程序运行的结果。
答案:1、由2个函数组成;2、调用了scanf,printf两个系统函数;3、用到 int ,main,return,scanf,print;4、add,a,b,c,z,x,y;5、20+40=602.编辑、调试以下程序步骤1:在Visual C++环境下新建文件可用[开始]→[程序]→[Microsoft Visual C++6.0] →[Microsoft Visual C++6.0] →[文件] →[新建]→[文件] →[C++ Sourse File],输入文件名ex1-2.c步骤3:[文件] →[新建]→[文件] →[C++ Sourse File],输入文件名ex1-2-2.c,源程序代步骤4:[文件] →[新建]→[文件] →[C++ Sourse File],输入文件名ex1-2-3.c,源程序代码为:步骤5:点击编译图标,编译程序1-2.c步骤4:点击执行图标,执行程序1-2.c ,当程序运行时,键盘输入20 40,按回车。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
浙江大学2004-2005学年冬季学期《C Programming》课程期末考试试卷开课学院:计算机学院, 考试形式:闭卷考试时间:2005年1月22日, 所需时间:120 分钟考生姓名: 学号: 专业:(注意:答题内容必须写在答题卷上,写在本试题卷上无效) Section 1: Single Choice(2 mark for each item, total 20 marks)1. The precedence of operator _____ is the lowest one.A.? : B.== C.+= D.&2. _____ is correct if it is used as a character constant.A.’\’ B.'\080' C.'%d' D.0xa3. According to the declaration: char c1=92,c2=92; the value of expression _____ is 0.A.c1^c2 B.c1&c2 C.~c2 D.c1|c24. According to the declaration: int x=11; the value of expression (x++*1/3) is_____.A.3B.4 C.0D.3.6675. The value of expression sizeof("\num=%d\t") is ______.A.7 B.8 C.9 D.106. In the following assignments or initialization, ______ is wrong.A.char s[ ]="hello"; B.char s[10]; s="hello";C.char *p="hello"; D.char *p; p="hello";7. The following code fragment prints out ______.#define MA(x, y) (x)*(y)int i = 2;i = 3/MA(i, i+2)+5;printf(“%d\n”, i);A.5 B.8 C.9 D.118. static struct {int x, y[3];} a[3] = {{1,2,3,4},{5,6,7,8},{9,10,11,12}}, *p;p = a+1;The value of expression *((int *)(p+1)+2) is ______.A.3 B.7 C.10 D.119. After running the following code fragment, the value of s is ______.int i=5, s=0;《C Programming》TEST PAPER, Jan 22, 2005 1 / 8do if (i%2) continue; else s+=i; while (--i);A.15 B.9 C.6 D.510. According to the declaration: int (*p)[10], p is a(n) ______.A.pointer B.array C.function D.element of arraySection 2: Fill in the blanks(2 mark for each item, total 30 marks)1. The value of expression 1+4/5+15<7+4%5+(8,10) is ______.2. The value of expression !!10 is _____.3. The value of expression 3>2>1 is _____.4. The value of expression ~(-1<<1) is ______.5. The statement for (i=1; i<=9; i++) printf(“%3d”, ______);prints out the following numbers:1 4 7 10 13 16 19 22 25.6. According to the declaration: int a[10], *p=&a[1]+2; the last element of array a is p[__].7. Write the declaration_____ with typedef, which makes PA a synonym for a character pointerarray, which contains 100 elements.8. The following code fragment prints out _____.static int a[3][4]={{1,2,3},{4,5,6}};printf(“%d”,a[0][5]);9. The following code fragment prints out _____.char a[]={“678”,”45”},**p=a+1;printf(“%s,%c”,*p,**p-1);10. The following code fragment prints out _____.int *p, *q, k = 1, j=10 ;p=&j; q = &k ; p = q ; (*p)++;printf("%d",k);11. The following program prints out _____.#include <stdio.h>void f(int *x,int *y){ int *p;p=x; x=y; y=p;}void main(){ int x=1, y=2;f(&y, &x);printf("%d, %d", x, y);}12. The following program prints out _____.#include <stdio.h>#include <string.h>main(){ char st[20]=”hello\0world!”;《C Programming》TEST PAPER, Jan 22, 2005 2 / 8printf(“%d,%d\n”,strlen(st),sizeof(st));}13. To execute the command: prog 123 456 ABC, the value of *(++argv[2]) is_____.14. The following program fragment prints out _____.i;intint f(int x){ static int k = 0;x+=k++;x;return}i=f(2);i=f(3);printf(“%d”,i);15. The following program fragment prints out _____.int f(int x){ return ((x>0)? x*f(x-1):3); }printf(“%d”,f(f(1)));Section 3: Read each of the following programs and answer questions (5marks for each item, total marks: 30)1.The output of the following program is _______.#include <stdio.h>void main(){int i,j,k=19;while (i=k-1) {k-=3;if(k%5==0) { i++; continue; }else if(k<5) break;i++;}printf(“i=%d,k=%d\n”,i,k);}2.When input: AabD <ENTER>, The output of the following program is _______.#include <stdio.h>void main(){char s[81];int i=0;gets(s);《C Programming》TEST PAPER, Jan 22, 2005 3 / 8while (s[i]!=‘\0’){if(s[i]<= ’z’&&s[i]>= ’a’)s[i]= ’z’+’a’-s[i];i++;}puts(s);}3.The output of the following program is _______.#include <stdio.h>x,y,z,w;intvoid p(int x, int *y)z;{ int++x;++*y;z=x+*y;w+=x;x,*y,z,w);printf(“%2d%2d%2d%2d#”,}main()void{ x=y=z=w=2;p(y, &x);x,y,z,w);printf(“%2d%2d%2d%2d\n”,}4.The output of the following program is _______.#include <stdio.h>#define F(k) k+3.14#define P(a) printf("a=%d\n", (int)(a))#define P1(a) P(a);putchar('\n');#define P2(a, b) P(a);P1(b);void main(){int x = 1;{int x = 2;P(x*F(2));}{for (; x < 10; x += 50)P2(x, 9.15*x+32);}《C Programming》TEST PAPER, Jan 22, 2005 4 / 8}5.When input: this is a test.<ENTER>, The output of the following program is _______.#include <stdio.h>#define TRUE 1#define FALSE 0int change(char *c,int status);void main(){int flag=TRUE;ch;chardo{ch=getchar();flag=change(&ch,flag);putchar(ch);} while(ch!=’.’);printf(“\n”);}int change(char *c,int status){if(*c==’ ‘) return TRUE;if(status&&*c<=’z’&&*c>=’a’) *c+=’A’-‘a’;return FALSE;}6.There are three text files f1,f2 & f3, each of them contains some characters as following: file name contentsaaa!f1f2 bbb!f3 ccc!Compiling the following C source codes, and linking the related object codes, an executable command file ex12.exe will be produced. To execute the command at DOS prompt: ex12 f1 f2 f3<ENTER>,the output is: .#include <stdio.h>main(int argc, char *argv[]){FILE *fp;*);voidsub(FILEint i=1;(--argc>0)whileif ((fp=fopen(argv[i++],“r”))==NULL) {printf(“Cannot open file!\n”);《C Programming》TEST PAPER, Jan 22, 2005 5 / 8《C Programming 》TEST PAPER, Jan 22, 2005 6 / 8 exit(1);} else {sub(fp);fclose(fp);}}void sub(FILE *fp){char c;while((c=getc(fp))!=‘!’) putchar(c+1);}Section 4: According to the specification, complete each program (2 mark for each blank, total: 20 marks)1.The following program is to calculate the value of “e ” according to the formulaΛ++++=!31!21!111e , while the value of the last item must be less than 10- 6. #include <stdio.h>main(){int i;double e,item;(1) ;item=1.0;for (i=1; (2) ;i++) {item/=(double)i;e+= (3) ;}printf(“e=%f\n”,e);}2.The following program deletes the non-nested comments which be included between /* and */from the C source program file exam.c , and stores the results in the file exam.out .#include <stdio.h>void delcomm(FILE *fp1,FILE *fp2){int c,i=0;while(( (4) )!=EOF)if (c==‘\n’)fprintf(fp2,“\n”);elseswitch(i){case 0:i=1;if(c==‘/’)fprintf(fp2,“%c”,c);elsebreak;1:casei=2;if(c==‘*’)else {fprintf(fp2,“/%c”,c);i=0;}break;2:casei=3;if(c==‘*’)break;case3:i=(c==‘/’)? (5);break;}}void main(){FILE *fp1,*fp2;fp1=fopen(“exam.c”,“r”);fp2=fopen(“exam.out”,“w”);delcomm( (6));(7);return;}3.Given: the pointer head points to the first node of the simple list. The following function del() deletes the first node which value is equal to num from the simple list.#include <stdio.h>struct student {int info;student*link;struct};struct student *del(struct student *head,int num){struct student *p1,*p2;if(head==NULL)《C Programming》TEST PAPER, Jan 22, 2005 7 / 8printf(“\nlistnull!\n”);else {p1=head;(8)) {while(p2=p1;p1=p1->link;}if(num==p1->info){(9);if(p1==head)else (10);printf(“delete:%d\n”,num);else}printf(“%d not been found!\n”,num);}return(head);}《C Programming》TEST PAPER, Jan 22, 2005 8 / 8。