[閒聊] facebook上的C語言測驗
看板C_and_CPP (C/C++)作者runtime (LLLLL)時間15年前 (2009/08/13 00:25)推噓53(53推 0噓 36→)留言89則, 33人參與討論串1/3 (看更多)
http://apps.facebook.com/mentaltest-zmacgno/
facebook上的C語言測驗
試試看自己的程度吧
有一些題目還不賴
沒有臉書的 看以下
==全部copy過來==
1. void *i = 3; int j = 7; printf("%d\n",i+j); 請問結果為何者?
a 跑出一連串亂碼的數字
b 無法編譯此程式
c 10
d 7
2. int *num; 請問要如何把 num 當作陣列使用(num[index]), 並初始化大小為10, 再塞入0~9的數字?
a 這是指標 無法這樣使用
b num=(int[10]){0,1,2,3,4,5,6,7,8,9};
c *(num+0)=0;*(num+1)=1...*(num+9)=9;以此類推
d num[0]=0;num[1]=1;....num[9]=9;以此類推
3. 以下這段程式碼會跑出什麼結果?? int i=100;char str[20]="%d";printf(str,i);
a 100
b 編譯階段錯誤
c 執行階段錯誤
d %d100
4. 如果老師今天要你使要迴圈來寫一支聖誕樹程式 請問最少需要使用幾個迴圈?
a 3個以上
b 不需要迴圈
c 2個
d 1個
5. for(;;); 執行後會有什麼結果
a 沒有功能的語法
b 無限迴圈
c 直接結束
d 沒有這種寫法
6. i=5;printf("%d",i++); 這段語法執行後會有下列何者答案?
a %d
b 6
c 7
d 5
7. i=7;j=44;i^=j^=i^=j; 請問執行以上程式後 i 為多少? j 為多少? (已修正)
a i=44 j=7
b C語言無法這樣寫
c 程式無法編譯
d i=7 j=44
8. 任何程式語言的第一支程式通常叫什麼
a Hello C
b Hello World
c How are you
d Hello
9. int num[10]={8,3,4,7,5,1,2,9,0,6}; 若要取得 7 這個數字, 以下何者語法正確?
a *(num+3)
b *(num+4)
c num[4]
d num[7]
==以下是正確解答==
cbadbdaba
--
███◣ █◣◥◣ █◣◥◣ ███◣ ██◣ ███◣ ███◣
████ ██ █ ██◣█ ◥███ ◥██ ████ ████
██▆█ ██◣█ ████ ██ ◣ █ █▉▉█ ██▆▆
◥█◥◣ ◥███ ◥█◥█ ◥█ ◥██ ◥▉◥█ ◥█▆▆
小小器材控的成長日記 450D 50mm F1.8II 24-70 F2.8L 430EXII (持續增加中)
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 163.22.18.76
推
08/13 00:37, , 1F
08/13 00:37, 1F
推
08/13 00:48, , 2F
08/13 00:48, 2F
推
08/13 01:07, , 3F
08/13 01:07, 3F
推
08/13 01:08, , 4F
08/13 01:08, 4F
推
08/13 01:13, , 5F
08/13 01:13, 5F
推
08/13 01:22, , 6F
08/13 01:22, 6F
推
08/13 01:26, , 7F
08/13 01:26, 7F
推
08/13 01:28, , 8F
08/13 01:28, 8F
推
08/13 01:29, , 9F
08/13 01:29, 9F
→
08/13 01:30, , 10F
08/13 01:30, 10F
推
08/13 01:32, , 11F
08/13 01:32, 11F
第七題...我好像run錯了
題目有多出一個^=i
所以第七題應該是 3 4
哇 沒答案耶
→
08/13 01:32, , 12F
08/13 01:32, 12F
咦 Dev C 跑得出來是 10
※ 編輯: runtime 來自: 163.22.18.76 (08/13 01:36)
推
08/13 01:35, , 13F
08/13 01:35, 13F
→
08/13 01:36, , 14F
08/13 01:36, 14F
→
08/13 01:38, , 15F
08/13 01:38, 15F
→
08/13 01:40, , 16F
08/13 01:40, 16F
→
08/13 01:40, , 17F
08/13 01:40, 17F
→
08/13 01:41, , 18F
08/13 01:41, 18F
推
08/13 01:43, , 19F
08/13 01:43, 19F
推
08/13 01:48, , 20F
08/13 01:48, 20F
推
08/13 01:55, , 21F
08/13 01:55, 21F
→
08/13 01:55, , 22F
08/13 01:55, 22F
推
08/13 01:59, , 23F
08/13 01:59, 23F
推
08/13 02:06, , 24F
08/13 02:06, 24F
推
08/13 02:42, , 25F
08/13 02:42, 25F
推
08/13 03:15, , 26F
08/13 03:15, 26F
推
08/13 03:22, , 27F
08/13 03:22, 27F
→
08/13 03:25, , 28F
08/13 03:25, 28F
→
08/13 03:26, , 29F
08/13 03:26, 29F
推
08/13 03:28, , 30F
08/13 03:28, 30F
推
08/13 05:19, , 31F
08/13 05:19, 31F
→
08/13 05:20, , 32F
08/13 05:20, 32F
推
08/13 06:09, , 33F
08/13 06:09, 33F
推
08/13 07:20, , 34F
08/13 07:20, 34F
→
08/13 07:20, , 35F
08/13 07:20, 35F
→
08/13 07:37, , 36F
08/13 07:37, 36F
→
08/13 08:22, , 37F
08/13 08:22, 37F
→
08/13 08:58, , 38F
08/13 08:58, 38F
推
08/13 09:21, , 39F
08/13 09:21, 39F
推
08/13 09:27, , 40F
08/13 09:27, 40F
→
08/13 09:27, , 41F
08/13 09:27, 41F
→
08/13 09:28, , 42F
08/13 09:28, 42F
→
08/13 09:28, , 43F
08/13 09:28, 43F
推
08/13 09:31, , 44F
08/13 09:31, 44F
→
08/13 11:33, , 45F
08/13 11:33, 45F
→
08/13 12:23, , 46F
08/13 12:23, 46F
推
08/13 12:25, , 47F
08/13 12:25, 47F
推
08/13 13:05, , 48F
08/13 13:05, 48F
→
08/13 13:05, , 49F
08/13 13:05, 49F
推
08/13 13:41, , 50F
08/13 13:41, 50F
推
08/13 13:43, , 51F
08/13 13:43, 51F
推
08/13 13:46, , 52F
08/13 13:46, 52F
推
08/13 13:55, , 53F
08/13 13:55, 53F
→
08/13 13:56, , 54F
08/13 13:56, 54F
→
08/13 13:57, , 55F
08/13 13:57, 55F
→
08/13 13:58, , 56F
08/13 13:58, 56F
推
08/13 14:07, , 57F
08/13 14:07, 57F
推
08/13 14:12, , 58F
08/13 14:12, 58F
推
08/13 14:15, , 59F
08/13 14:15, 59F
→
08/13 14:15, , 60F
08/13 14:15, 60F
推
08/13 14:55, , 61F
08/13 14:55, 61F
推
08/13 15:29, , 62F
08/13 15:29, 62F
推
08/13 15:32, , 63F
08/13 15:32, 63F
推
08/13 15:35, , 64F
08/13 15:35, 64F
→
08/13 15:35, , 65F
08/13 15:35, 65F
推
08/13 15:38, , 66F
08/13 15:38, 66F
→
08/13 15:39, , 67F
08/13 15:39, 67F
→
08/13 15:39, , 68F
08/13 15:39, 68F
→
08/13 16:04, , 69F
08/13 16:04, 69F
推
08/13 16:11, , 70F
08/13 16:11, 70F
→
08/13 16:12, , 71F
08/13 16:12, 71F
→
08/13 16:12, , 72F
08/13 16:12, 72F
→
08/13 16:13, , 73F
08/13 16:13, 73F
→
08/13 16:14, , 74F
08/13 16:14, 74F
推
08/13 16:17, , 75F
08/13 16:17, 75F
推
08/13 16:23, , 76F
08/13 16:23, 76F
※ 編輯: runtime 來自: 163.22.18.76 (08/13 16:28)
推
08/13 16:34, , 77F
08/13 16:34, 77F
推
08/13 16:35, , 78F
08/13 16:35, 78F
推
08/13 17:21, , 79F
08/13 17:21, 79F
推
08/13 21:49, , 80F
08/13 21:49, 80F
※ weii:轉錄至看板 SFFamily 08/13 22:14
推
08/13 22:23, , 81F
08/13 22:23, 81F
→
08/13 23:50, , 82F
08/13 23:50, 82F
推
08/14 02:59, , 83F
08/14 02:59, 83F
推
08/14 11:09, , 84F
08/14 11:09, 84F
推
08/15 02:44, , 85F
08/15 02:44, 85F
→
08/15 02:44, , 86F
08/15 02:44, 86F
→
08/15 11:16, , 87F
08/15 11:16, 87F
推
08/15 18:26, , 88F
08/15 18:26, 88F
推
08/18 02:45, , 89F
08/18 02:45, 89F
討論串 (同標題文章)
C_and_CPP 近期熱門文章
PTT數位生活區 即時熱門文章