C C 題 含答案和解析

2021-10-21 12:01:26 字數 1686 閱讀 8372

1. c語言中,凡未指定儲存類別的區域性變數的隱含儲存類別是( )

a  auto

b  static

c  extern

d  register

2. 設int型別的資料長度為2個位元組,則unsigned int型別資料的取值範圍( )

a  0~65535

b  -32768~32767

c  -256~255

d  0~255

3. 在c語言中,全域性變數的儲存類別是( )

a  static

b  extern

c  void

d  tegiste

4. 已知同乙個目錄下的兩個原始檔file1.c和file2.c,內容如下:

file1.c:

char str = 「abcdefg」

file2.c:

extern char *str;

int main (int argc, char* ar**)

以下說法正確的是( )

a  執行語句str[0] = 『a』後str的內容為 「abcdefg」

b  extern char *str;編譯錯誤

c  str[0] = 『a』編譯錯誤

d  str[0] = 『a』執行時出錯

5. 下面**會輸出什麼( )

int main (int argc, char **ar**)

;int *ptr = (int*) (&a+1);

printf( 「%d」 ,*(ptr-1));

}a  1

b  2

c  3

d  4

6. 下面哪乙個是sort的template的正確寫法( )

a  void sort(class a first, class a last, class b pred)

b  void template sort(a first, a last, b pred)

c  template void sort(a first, a last, b pred)

d  template void sort(a first, a last, b pred)

7. 在c++中,,輸出是多少( )

a  0,1

b  1,1

c  1,0

d  0,0

8. 不能把字串」hello!」賦給數b的語句是( )

a  char b[10] = ;

b  char b[10]; b = 「hello!」 ;

c  char b[10]; strcpy(b, 「hello!」 );

d  char b[10] = 「hello!」 ;

9. 假定x=65530,下面函式的返回值是多少( )

int func(x)

return count_x;

}a  100

b  14

c  20

d  16

10. 開發c**時,經常見到如下型別的機構體定義:

typedef struct list_t

list_t;

最後一行char data[0];的作用是( )

a  方便管理記憶體緩衝區

b  減少記憶體碎片化

c  標識結構體結束

d  沒有作用

獲取答案和詳細的答案解析:

C C 題 含答案和解析

1.有如下程式 include iostream using namespace std class myclass myclass const myclass x myclass operator const myclass x myclass int main 執行時的輸出結果是 a 11214...

C C 題 含答案和解析

1.int x 2 y 3 z 4 則表示式!x y z的值為 a 1 b false c true d 0 2.下面哪乙個不是由標準模板庫提供的合法的雜湊表 a hash multiset b hash table c hash set d hash multimap e hash map 3.關...

C C 題 含答案和解析

1.設a 1,b 2,則 a b 和 a b 這兩個表示式的值分別是 a 4 4 b 3 4 c 4 3 d 3 3 2.執行 int a 1 3 11 int b a 後,b的值是多少 a 11 b 1 c 3 d 15 e 3.下列哪乙個是析構函式的特徵 a 析構函式定義只能在類體內 b 乙個類...