SlideShare une entreprise Scribd logo
1  sur  4
BÀI TRẮC NGHIỆM SỐ 2
                                       Ngôn ngữ lập trình C
                                          Thời gian: 15’
Họ tên:………………………………………
Lớp………………………………………….




1) Chỉ thị nào sau đây là đúng khi sử dụng để khai báo một mảng 10 ký tự có tên letters?

   a) letters: char[10];

   b) char[10] letters;

   c) char letters[10];

   d) char array letters[10];



2) Câu lệnh nào sau đây là đúng khi gán ký tự ‘Z’ cho phần tử thứ tư của mảng letters?

   a) letters[4]:= “Z”;

   b) letters[3] = 'Z';

   c) letters[4] = quot;Zquot;;

   d) letters[3] = 'z';



3) Chỉ thị nào sau đây là đúng khi khai báo mảng hai chiều balances có 3 hàng và 5 cột?

   a) float balances[3][5];

   b) balances[3][5] of float;

   c) float balances[5][3];

   d) array of float balances[0..2][0..5];



4) Câu lệnh nào sau đây là đúng để gán xâu “Hello” cho mảng ký tự words tại thời điểm khai báo?

   a) char words[10] = 'Hello';

   b) static char words[] = quot;Helloquot;;
c) static char words[quot;helloquot;];

   d) static char words[] = { Hello };



5) Câu lệnh nào sau đây là đúng để gán xâu “Welcome” cho xâu ký tự stuff?

   a) strcpy( stuff, 'Welcome' );

   b) stuff = quot;Welcomequot;;

   c) stuff[0] = quot;Welcomequot;;

   d) strcpy(stuff, quot;Welcomequot; );                 true



6) Câu lệnh nào sau đây là đúng để in ra màn hình giá trị của phần tử thứ 3 của mảng số nguyên có
   tên totals?

   a) printf(quot;%dnquot;, &totals[3] );

   b) printf(quot;%dnquot;, totals[3] );

   c) printf(quot;%cnquot;, totals[2] );

   d) printf(quot;%dnquot;, totals[2] );



7) Câu lệnh nào sau đây là đúng để in ra màn hình xâu ký tự có tên words?

   a) printf(quot;%snquot;, words);        true

   b) printf(quot;%cnquot;, words);

   c) printf(quot;%dnquot;, words);

   d) printf(quot;%snquot;, words[2]);



8) Câu lệnh nào sau đây là đúng để nhập vào giá trị cho xâu ký có tên words từ bàn phím?

   a) scanf(quot;%snquot;, words);

   b) scanf(quot; %cquot;, words);
c) scanf(quot;%cquot;, words);

   d) scanf(quot;%squot;, words);



9) Chỉ thị nào sao đây là đúng để khai báo một biến con trỏ nguyên có tên address?

   a) int address;

   b) address *int;

   c) int *address;

   d) *int address;



10) Câu lệnh nào sau đây là đúng khi gán địa chỉ của biến thực balance cho con trỏ thực temp?

   a) temp = &balance; true

   b) balance = float temp;

   c) float temp *balance;

   d) &temp = balance;



11) Câu lệnh nào sau đây là đúng khi sử dụng để gán ký tự ‘W’ cho biến ký tự được trỏ bởi biến con
    trỏ ký tự letter?

   a) 'W' = *letter;

   b) letter = quot;Wquot;;

   c) letter = *W;

   d) *letter = 'W'; true



12) Cho biết kết quả trên màn hình sau khi chạy đoạn chương trình sau?

       int count = 10, *temp; sum = 0;

       temp = &count;
*temp = 20;

       temp = ∑

       *temp = count;

       printf(quot;count = %d, *temp = %d, sum = %dnquot;, count, *temp, sum );



   a) count = 2, *temp = 10, sum = 10

   b) count = 20, *temp = 20, sum = 20              true

   c) count = 10, *temp = 2, sum = 10

   d) count = 200, *temp = 0.2, sum = 1



13) Chỉ thị nào sau đây là đúng khi khai báo một con trỏ trỏ vào xâu “Hello” có tên message?

   a) char message = quot;Helloquot;;

   b) *message = quot;Helloquot;;

   c) char *message = quot;Helloquot;;             //true

   d) char message = 'Hello';

Contenu connexe

En vedette

En vedette (8)

Session 09 Final
Session 09 FinalSession 09 Final
Session 09 Final
 
Session 06
Session 06Session 06
Session 06
 
Session 04 Sua
Session 04 SuaSession 04 Sua
Session 04 Sua
 
Session 13
Session 13Session 13
Session 13
 
Session 07 Final
Session 07 FinalSession 07 Final
Session 07 Final
 
Session 04 Final Sua
Session 04 Final SuaSession 04 Final Sua
Session 04 Final Sua
 
Session 10 Final
Session 10 FinalSession 10 Final
Session 10 Final
 
Session 03 Final
Session 03 FinalSession 03 Final
Session 03 Final
 

Similaire à Test2

Ly Thuyet Va Bai Tap Excel
Ly Thuyet Va Bai Tap ExcelLy Thuyet Va Bai Tap Excel
Ly Thuyet Va Bai Tap Excel
trungtinh
 
Bai Giang 11
Bai Giang 11Bai Giang 11
Bai Giang 11
nbb3i
 
Os Fetterupdated
Os FetterupdatedOs Fetterupdated
Os Fetterupdated
oscon2007
 

Similaire à Test2 (20)

Ly Thuyet Va Bai Tap Excel
Ly Thuyet Va Bai Tap ExcelLy Thuyet Va Bai Tap Excel
Ly Thuyet Va Bai Tap Excel
 
Τα Πολύ Βασικά για την Python
Τα Πολύ Βασικά για την PythonΤα Πολύ Βασικά για την Python
Τα Πολύ Βασικά για την Python
 
Bai Giang 11
Bai Giang 11Bai Giang 11
Bai Giang 11
 
Vim your Python, Python your Vim
Vim your Python, Python your VimVim your Python, Python your Vim
Vim your Python, Python your Vim
 
Os Fetterupdated
Os FetterupdatedOs Fetterupdated
Os Fetterupdated
 
Software engineering
Software engineeringSoftware engineering
Software engineering
 
Introduction to Ecological Farming: Farmer to Farmer Participatory Training C...
Introduction to Ecological Farming: Farmer to Farmer Participatory Training C...Introduction to Ecological Farming: Farmer to Farmer Participatory Training C...
Introduction to Ecological Farming: Farmer to Farmer Participatory Training C...
 
Resource Efficient Agicultural Production
Resource Efficient Agicultural ProductionResource Efficient Agicultural Production
Resource Efficient Agicultural Production
 
Resource Efficient Agicultural Production
Resource Efficient Agicultural Production  Resource Efficient Agicultural Production
Resource Efficient Agicultural Production
 
Resource Efficient Agicultural Production
Resource Efficient Agicultural ProductionResource Efficient Agicultural Production
Resource Efficient Agicultural Production
 
Introduction to Ecological Farming: Farmer to Farmer Participatory Training C...
Introduction to Ecological Farming: Farmer to Farmer Participatory Training C...Introduction to Ecological Farming: Farmer to Farmer Participatory Training C...
Introduction to Ecological Farming: Farmer to Farmer Participatory Training C...
 
Teknik konfigurasi dan_fasilitas_jaringan
Teknik konfigurasi dan_fasilitas_jaringanTeknik konfigurasi dan_fasilitas_jaringan
Teknik konfigurasi dan_fasilitas_jaringan
 
Helvetia
HelvetiaHelvetia
Helvetia
 
Python Fundamentals - Basic
Python Fundamentals - BasicPython Fundamentals - Basic
Python Fundamentals - Basic
 
DOS
DOSDOS
DOS
 
C++20 新功能:Concepts & Ranges
C++20 新功能:Concepts & RangesC++20 新功能:Concepts & Ranges
C++20 新功能:Concepts & Ranges
 
Boo Programming Language
Boo Programming LanguageBoo Programming Language
Boo Programming Language
 
LAMP_TRAINING_SESSION_6
LAMP_TRAINING_SESSION_6LAMP_TRAINING_SESSION_6
LAMP_TRAINING_SESSION_6
 
Who was william shakespeare ?
Who was william shakespeare ?Who was william shakespeare ?
Who was william shakespeare ?
 
Demystifying Unicode - Longhorn PHP 2021
Demystifying Unicode - Longhorn PHP 2021Demystifying Unicode - Longhorn PHP 2021
Demystifying Unicode - Longhorn PHP 2021
 

Plus de SamQuiDaiBo (20)

Test
TestTest
Test
 
T3
T3T3
T3
 
T2
T2T2
T2
 
Bai Tap Thuc Hanh Javascript
Bai Tap Thuc Hanh JavascriptBai Tap Thuc Hanh Javascript
Bai Tap Thuc Hanh Javascript
 
Hangman Game
Hangman GameHangman Game
Hangman Game
 
Session 08 Final
Session 08 FinalSession 08 Final
Session 08 Final
 
Session 05 Final
Session 05 FinalSession 05 Final
Session 05 Final
 
Session 06 Final
Session 06 FinalSession 06 Final
Session 06 Final
 
Session 02 Final
Session 02 FinalSession 02 Final
Session 02 Final
 
Session 01 Final
Session 01 FinalSession 01 Final
Session 01 Final
 
Html overview
Html overviewHtml overview
Html overview
 
Ittlgc2
Ittlgc2Ittlgc2
Ittlgc2
 
Ittlgc3
Ittlgc3Ittlgc3
Ittlgc3
 
Ittlgc1
Ittlgc1Ittlgc1
Ittlgc1
 
Ittlgc
IttlgcIttlgc
Ittlgc
 
Baitap C
Baitap CBaitap C
Baitap C
 
Epc Assigment2
Epc Assigment2Epc Assigment2
Epc Assigment2
 
Epc Assignment1
Epc Assignment1Epc Assignment1
Epc Assignment1
 
Epc Assignment1 Vn
Epc Assignment1 VnEpc Assignment1 Vn
Epc Assignment1 Vn
 
Epc Assignment2 Vn
Epc Assignment2 VnEpc Assignment2 Vn
Epc Assignment2 Vn
 

Dernier

Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
kauryashika82
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
heathfieldcps1
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
QucHHunhnh
 

Dernier (20)

Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural ResourcesEnergy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Asian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptxAsian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptx
 

Test2

  • 1. BÀI TRẮC NGHIỆM SỐ 2 Ngôn ngữ lập trình C Thời gian: 15’ Họ tên:……………………………………… Lớp…………………………………………. 1) Chỉ thị nào sau đây là đúng khi sử dụng để khai báo một mảng 10 ký tự có tên letters? a) letters: char[10]; b) char[10] letters; c) char letters[10]; d) char array letters[10]; 2) Câu lệnh nào sau đây là đúng khi gán ký tự ‘Z’ cho phần tử thứ tư của mảng letters? a) letters[4]:= “Z”; b) letters[3] = 'Z'; c) letters[4] = quot;Zquot;; d) letters[3] = 'z'; 3) Chỉ thị nào sau đây là đúng khi khai báo mảng hai chiều balances có 3 hàng và 5 cột? a) float balances[3][5]; b) balances[3][5] of float; c) float balances[5][3]; d) array of float balances[0..2][0..5]; 4) Câu lệnh nào sau đây là đúng để gán xâu “Hello” cho mảng ký tự words tại thời điểm khai báo? a) char words[10] = 'Hello'; b) static char words[] = quot;Helloquot;;
  • 2. c) static char words[quot;helloquot;]; d) static char words[] = { Hello }; 5) Câu lệnh nào sau đây là đúng để gán xâu “Welcome” cho xâu ký tự stuff? a) strcpy( stuff, 'Welcome' ); b) stuff = quot;Welcomequot;; c) stuff[0] = quot;Welcomequot;; d) strcpy(stuff, quot;Welcomequot; ); true 6) Câu lệnh nào sau đây là đúng để in ra màn hình giá trị của phần tử thứ 3 của mảng số nguyên có tên totals? a) printf(quot;%dnquot;, &totals[3] ); b) printf(quot;%dnquot;, totals[3] ); c) printf(quot;%cnquot;, totals[2] ); d) printf(quot;%dnquot;, totals[2] ); 7) Câu lệnh nào sau đây là đúng để in ra màn hình xâu ký tự có tên words? a) printf(quot;%snquot;, words); true b) printf(quot;%cnquot;, words); c) printf(quot;%dnquot;, words); d) printf(quot;%snquot;, words[2]); 8) Câu lệnh nào sau đây là đúng để nhập vào giá trị cho xâu ký có tên words từ bàn phím? a) scanf(quot;%snquot;, words); b) scanf(quot; %cquot;, words);
  • 3. c) scanf(quot;%cquot;, words); d) scanf(quot;%squot;, words); 9) Chỉ thị nào sao đây là đúng để khai báo một biến con trỏ nguyên có tên address? a) int address; b) address *int; c) int *address; d) *int address; 10) Câu lệnh nào sau đây là đúng khi gán địa chỉ của biến thực balance cho con trỏ thực temp? a) temp = &balance; true b) balance = float temp; c) float temp *balance; d) &temp = balance; 11) Câu lệnh nào sau đây là đúng khi sử dụng để gán ký tự ‘W’ cho biến ký tự được trỏ bởi biến con trỏ ký tự letter? a) 'W' = *letter; b) letter = quot;Wquot;; c) letter = *W; d) *letter = 'W'; true 12) Cho biết kết quả trên màn hình sau khi chạy đoạn chương trình sau? int count = 10, *temp; sum = 0; temp = &count;
  • 4. *temp = 20; temp = ∑ *temp = count; printf(quot;count = %d, *temp = %d, sum = %dnquot;, count, *temp, sum ); a) count = 2, *temp = 10, sum = 10 b) count = 20, *temp = 20, sum = 20 true c) count = 10, *temp = 2, sum = 10 d) count = 200, *temp = 0.2, sum = 1 13) Chỉ thị nào sau đây là đúng khi khai báo một con trỏ trỏ vào xâu “Hello” có tên message? a) char message = quot;Helloquot;; b) *message = quot;Helloquot;; c) char *message = quot;Helloquot;; //true d) char message = 'Hello';