![暨南大學(xué)C語言樣題_第1頁](http://file2.renrendoc.com/fileroot_temp3/2021-10/29/e276cae7-00e2-403c-8571-dd5c3b00163d/e276cae7-00e2-403c-8571-dd5c3b00163d1.gif)
![暨南大學(xué)C語言樣題_第2頁](http://file2.renrendoc.com/fileroot_temp3/2021-10/29/e276cae7-00e2-403c-8571-dd5c3b00163d/e276cae7-00e2-403c-8571-dd5c3b00163d2.gif)
![暨南大學(xué)C語言樣題_第3頁](http://file2.renrendoc.com/fileroot_temp3/2021-10/29/e276cae7-00e2-403c-8571-dd5c3b00163d/e276cae7-00e2-403c-8571-dd5c3b00163d3.gif)
![暨南大學(xué)C語言樣題_第4頁](http://file2.renrendoc.com/fileroot_temp3/2021-10/29/e276cae7-00e2-403c-8571-dd5c3b00163d/e276cae7-00e2-403c-8571-dd5c3b00163d4.gif)
![暨南大學(xué)C語言樣題_第5頁](http://file2.renrendoc.com/fileroot_temp3/2021-10/29/e276cae7-00e2-403c-8571-dd5c3b00163d/e276cae7-00e2-403c-8571-dd5c3b00163d5.gif)
版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)
文檔簡介
1、I.True/False第1 頁共6 頁1. ( F)Identifiers consist of letters and digits in any order, but must be in lowercase.2. (T)We create modular programs because they are easier to develop, correct and modify.3. (F)All computers use twice the amount of storage for double precision than floating point data type4.
2、 (F)Static variable is not created and destroyed each time the function is called, it is the default storage class used by C.5. (T)A compound statement may be used anywhere in C program in place of a single statement.6. (F)In C language, all operators are binary operator which connecting tow operand
3、s side-by-side.7. (T)The Escape Sequence is a combinations of a backslash () and a character that tells the compiles to escape from the ways these character would be normally interpreted8. (T)Extern storage class is to extend the scope of a global variable beyond its normal boundary-file. it does no
4、t cause the creation of a new variable.9. (F)After defined, the symbolic names can be used in any statement and the program can change the value of the symbolic names.10. (T)The mistake of u sing the assignment operator” =” in place of the relationaloperator ”=” results in ainvalid C expressionII. C
5、hoice11. (C)For the algebraic expression 3ae/bc, which of the following C expression is invalidA) a/b/c*e*3B) 3*a*e/b/cC) 3*a*e/b*cD) a*e/c/b*312. (D)For the declarations: char w; int x; float y; double z; the data type of the value of w*x+z-y isA) floatB) charC) intD) double13. (B)For following dec
6、laration, which expression will not result in 3 ? int x10 = 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, *p1 ;A) x3B) p1 = x +3, *p1+C) p1 = x +2, *( p1+ )D) p1 = x +2, *+p114. (A)Which one is not endless loop?A) for (y = 0, x = 1 ; x > +y ; x = i+ ) i = x ;B) for ( ; ; x + = i ) ;C) while (1) x +;D) for ( i =1
7、0 ; ; i-) sum += i ;15. (B)The result of the following program ismain() int a = -2, bdo b = +a;if (!b) printf( “#”);else printf( “* ”);while(a<1)A#*#B *#*C)#D) *16. (D)Which one of the following functions is valid ?A) double fun ( int x , int y ) z = x + y ; return z ;B) fun ( int x , y ) int z ;
8、return z ;C) fun ( x , y ) int x ,y ; double z ;z = x + y ; return z ;D) double fun ( int x , int y ) double z ;z = x + y ; return z ;17. (D)In a source codes file of C language, if a variable can only be used by all functions with the file itself, the storage class of the variable is A) externB) re
9、gisterC) autoD) static18. (B)The C programming language the symbol “= = ” isA) rational operatorB) logical operatorC) conditional operatorD) assignment operator19. (D)For the definition statement: double s = 123.5; , which one is the correct output statement?A) printf( “s=%d ”,s);B) printf(“s=%ld ”,
10、 s);C) printf( “s=%f ”, s);D) printf(“s=%lf ”,s);20. ( C)Which of the following expressions will result in 0?A) 3%5B) 3/5.0C) 3>5D) 3<5III. Fill in the blanks in each program to implement the purpose according to the descriptionDescription#1: The following program can accept elements of an arr
11、ay from the keyboard, andfind the maximum element and corresponding index in the array. mai n() int x10, *p1, *p2, k;for(k = 0; k < 10; k+) scanf("%d", x+k); for(p1 = x, p2 = x; p1-x < 10; p1+ )if(*p1 > * p2) p2 =【21 】prin tf("MAX = %d, INDEX = %dn", *p2,21. A) pl22. A)
12、p1 -xB) p2p1B) p1C) xp2C) p2 -x【22】);D) x -p1D) x -p2Description#2: For each x, the program will calculate a corresponding y according to thexy2 < x <= 10x(x+2)-1 < x <= 22xx <= -1x - 1relati on ship of x and y illustrated in the followi ng table.mai n() int x, y;scanf(%d”,&x);if(
13、 【23 】)y = x * (x + 2); else if(【24 】)y = 2 * x;else if(x <= -1) y = x - 1;else 【25】;if(y != -1) pri ntf("%d", y); else prin tf("error");23. A) x > 2 | x <= 10C) x < 2 && x <= 1024. A) x < -1 | x >= 2C) x > -1 && x <= 225. A) y = -1B) y
14、= 0B) x > 2 && x <= 10D) x < 2 | x >= 10B) x > -1 | x <= 2D) x > -1 A A x <= 2C) x = 0 D) x = -1IV. (1)What is the purpose of the followi ng program?#in clude<stdio.h>#define N 10main ()int t, i, j, aN+1;printf('please in put 10 in tegers:”);for (i=1; i<=
15、N; i+)scanf(%d", &ai);第7頁共6頁printf(“n ”);for (i=1; i<=N-1; i+) for (j=1; j<=N-i; j+)if (aj<aj+1)t=aj+1; aj+1=aj; aj=t;for (i=1; i<=N; i+) printf(“%d”, ai);printf(“ ”n);從大到小排列數(shù)字。(2)Read the grogram and guess the result of the program#include <stdio.h>int k = 1;char a = int
16、fuc();IBM computer ”, b =C program ”main() int p = 3;while (putchar(ak) k+; /*k=12*/ putchar( n ');printf(“k=%d, ”, k);k=fuc(p);printf(“%d, %dn ”, p,k);printf(“%c%sn ”, a0, &bp);puts(&a3);int fuc(int m)int k = 0;while (putchar(bk) k+; printf("k=%dn", k);k +=m; m *=k;printf(&quo
17、t;%d, %dn", m, k);return (m+k);OUTPUT:BM computer k=12,C program k=936, 123, 48Irogram computerV. Check Error in the program according to the following description and correct them, write the whole corrected program on the an swer sheetA programmer wants to write a program to simulate a roll of
18、 the dice. The programmer decides to have the program choose two pseudo-ra ndom nu mbers from 1 to 6 and output the two nu mbers. If two values are the same, the program should also output the stri ng "That's a pair!" after printing the two values.The programmer writes the followi ng c
19、ode:#in clude <stdio.h>#in clude <stdlib.h>#in clude <time.h> int mai n(void) int dice2;sran d(time(NULL);for (x = 0; x <= 2; x+);dice x = ran d() % 6;printf ("You rolled a %d and a %d.n", dice0, dice1); if (dice0 = dice1)prin tf("That's a pair!n");return
20、 0;The above code has 5 errors in it! What are they?沒有定義x/*超纟岡*/for (x = 0; x <= 2; x+);應(yīng)改為 for (x = 0; x <= 2; x+) dicex = rand() % 6; 應(yīng)改為(dicex = rand() % 7) +1for (x = 0; x <= 2; x+);應(yīng)改為 x < 2if (dice0 = dice1)應(yīng)改為=VI. Writing a programWrite a complete program that allows the user to e
21、nter a string (assumed to be less than 25 characters long). If N is the length of the string, the program should output N rows to standard output. The first row should be the string entered by the user.The second row should be thestring without its last character. The third row should be the string without its last two characters. Etc. The Nth and final row should be only
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 溫州市南浦小學(xué)2022年藝術(shù)節(jié)活動方案范文
- 環(huán)保教育培養(yǎng)下一代綠色生活意識
- 現(xiàn)代教育技術(shù)助力創(chuàng)新教學(xué)方法的推廣
- 現(xiàn)代辦公家具中的穩(wěn)固與美觀并存
- 國慶節(jié)成都漢服活動方案
- 現(xiàn)代遠(yuǎn)程教育在海外的發(fā)展趨勢分析
- 汽車行業(yè)的社交媒體廣告投放策略
- 國慶節(jié)旅游宣傳活動方案
- 溫控技術(shù)在綠色辦公樓宇的革新發(fā)展
- 現(xiàn)代建筑設(shè)計的情感化表達(dá)
- 《港珠澳大橋演講》課件
- 《有機(jī)化學(xué)》課件-第十章 羧酸及其衍生物
- 人教版道德與法治五年級下冊《第一單元 我們一家人》大單元整體教學(xué)設(shè)計2022課標(biāo)
- 2024年海南公務(wù)員考試申論試題(A卷)
- 中醫(yī)培訓(xùn)課件:《經(jīng)穴推拿術(shù)》
- 臨床藥師進(jìn)修匯報課件
- 北京市首都師大附中2025屆數(shù)學(xué)高三第一學(xué)期期末達(dá)標(biāo)測試試題含解析
- 專升本-英語高頻詞匯
- excel培訓(xùn)課件教學(xué)
- 2024年貴州省高職(??疲┓诸惪荚囌惺罩新毊厴I(yè)生文化綜合考試語文試題
- 政治丨廣東省2025屆高中畢業(yè)班8月第一次調(diào)研考試廣東一調(diào)政治試卷及答案
評論
0/150
提交評論