執行下列C 程式時int len=0, num=0;float sum=0;while (ch=getchar()!='\n'){if (ch!=' ')len++;else{sum+=len;len=0;num++;}}printf("%.1f", sum/num);若輸入以下一段文字後再輸入換行鍵It was deja vu all over again.則輸出為?
(A)1.2
(B)2.3
(C)3.4
(D)4.5
執行下列C 程式後,產生的輸出為何?#include<stdio.h>int main(){int i;for(i= 0; i < 3; i++){switch(i){case 0: break;case 1: printf("one ");case 2: printf("two ");case 3: printf("three ");}printf("four ");}return 0;}
(A)four one four two four
(B)four one two three four two three four
(C)one two three four two three four three four
(D)four one two three four two three four three four
執行下列C 語言的程式,輸出結果為何?#include <stdio.h>int main(void) {int x = 0;char s = ‘b’;switch (s) {case ‘a’: x += 1;case ‘b’: x += 2;case ‘c’: x += 3;default: x += 2;}printf("%d", x);return 0;}
(A)0
(B)2
(C)4
(D)7
下列C 程式的執行結果為何?int fn(char s[]){int i=0, num=0;while (s[i])if (str[i++]=='e')num++;return num;}int main(){char c[]="To be or not to be, that's the question";printf("%d", fn(c));return 0;}
(A)1
(B)2
(C)3
(D)4
分級網路定址法(Classful Internet Addressing)依據網路的大小以及用途的不同,將其分為Class A ~ Class E五種不同的網路,如果有一IP 位址為168.95.42.86,在分級上該位址屬於下列何者?
(A)Class A
(B)Class B
(C)Class C
(D)Class D