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

Câu 1: Trong C, hàm nào sau đây được dùng để giải phóng bộ nhớ đã được cấp phát?
  a. free
  b. delete
  c. clear
  d. remove

Câu 2: Trong C, khai báo nào dưới đây là khai báo đúng của struct?
  a. struct{int a;}
  b. stuct a_struct{int;}
  c. struct a_struct int a;
  d. struct a_struct{int a;};

Câu 3: Trong C, đối số argc (argument count) lưu trữ giá trị gì?
  a. Số đối số truyền vào trong hàm main
  b. Số lượng đối số truyền vào trong hàm main + 1
  c. Số lượng đối số truyền vào trong hàm main -1
  d. Tổng kích thước tính bằng byte của mảng đối số

Câu 4: Cho đoạn chương trình C sau đây: int a[10], i, *p; a[0] = 1; a[1] = 2; p = a; (*p)++;
a[1]=?
    a. a[1] = 2
    b. a[1] = 3
    c. a[1] = 4
    d. Không đưa ra kết quả.

Câu 5: Thực hiện: Kiểm tra nếu a, b, c đều lớn hơn 1 thì in số 1, chọn câu nào?
  a. if (a>1) or (b>1) or (c>1) then write(1);
  b. if a>1 and b>1 and c>1 then write(1);
  c. if (a>1) and (b>1) and (c>1) then write(1);
  d. if a, b, c > 1 then write(1);

Câu 6: Đáp án nào dưới đây là khai báo hoàn chỉnh của một hàm trong C?
  a. int funct();
  b. int funct(int x) {return x=x+1;}
  c. void funct(int) {printf(quot;Helloquot;)}
  d. void funct(x) { printf(quot;Helloquot;)}

Câu 7: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];

Câu 8: 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';
Câu 9: 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];

Câu 10: 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 };

Câu 11: 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; );

Câu 12 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] );

Câu 13: 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);         b) printf(quot;%cnquot;, words);

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

Câu 14: 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);

Câu 15: 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;

Câu 16: 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;               b) balance = float temp;

   c) float temp *balance;           d) &temp = balance;
Câu 17: 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';

Câu 18: 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

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

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

Câu 19: 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;;             d) char message = 'Hello';

Câu 20: Trong ngôn ngữ C, câu lệnh nào sau đây trả về địa chỉ ô nhớ của con trỏ p?

   a.   p;
   b.   *p;
   c.   &p;
   d.   address(p);

Weitere ähnliche Inhalte

Andere mochten auch

Andere mochten auch (10)

Ittlgc2
Ittlgc2Ittlgc2
Ittlgc2
 
Session 7 En
Session 7 EnSession 7 En
Session 7 En
 
Accessibilité commerces
Accessibilité commercesAccessibilité commerces
Accessibilité commerces
 
Ittlgc3
Ittlgc3Ittlgc3
Ittlgc3
 
Charte qualité des terrasses restaurant bar UPCRM Menton
Charte qualité des terrasses restaurant bar UPCRM MentonCharte qualité des terrasses restaurant bar UPCRM Menton
Charte qualité des terrasses restaurant bar UPCRM Menton
 
Test1
Test1Test1
Test1
 
Session 09
Session 09Session 09
Session 09
 
Session 05 Final
Session 05 FinalSession 05 Final
Session 05 Final
 
Session 15
Session 15Session 15
Session 15
 
Internet
InternetInternet
Internet
 

Ähnlich wie Test5

2014 06-23 velocity sc beyond page metrics
2014 06-23 velocity sc beyond page metrics2014 06-23 velocity sc beyond page metrics
2014 06-23 velocity sc beyond page metricsBuddy Brewer
 
Bai Giang 11
Bai Giang 11Bai Giang 11
Bai Giang 11nbb3i
 
Introduction to Programming @ NTHUEEECamp 2015
Introduction to Programming @ NTHUEEECamp 2015Introduction to Programming @ NTHUEEECamp 2015
Introduction to Programming @ NTHUEEECamp 2015淳佑 楊
 
PyLadies Talk: Learn to love the command line!
PyLadies Talk: Learn to love the command line!PyLadies Talk: Learn to love the command line!
PyLadies Talk: Learn to love the command line!Blanca Mancilla
 
Ly Thuyet Va Bai Tap Excel
Ly Thuyet Va Bai Tap ExcelLy Thuyet Va Bai Tap Excel
Ly Thuyet Va Bai Tap Exceltrungtinh
 
深入淺出C語言
深入淺出C語言深入淺出C語言
深入淺出C語言Simen Li
 
C++20 新功能:Concepts & Ranges
C++20 新功能:Concepts & RangesC++20 新功能:Concepts & Ranges
C++20 新功能:Concepts & RangesYongwei Wu
 
Vim your Python, Python your Vim
Vim your Python, Python your VimVim your Python, Python your Vim
Vim your Python, Python your VimMiroslav Šedivý
 
Boo Programming Language
Boo Programming LanguageBoo Programming Language
Boo Programming LanguageVitaly Baum
 
090608-TogoWS REST
090608-TogoWS REST090608-TogoWS REST
090608-TogoWS RESTocha_kaneko
 
Demystifying Unicode - Longhorn PHP 2021
Demystifying Unicode - Longhorn PHP 2021Demystifying Unicode - Longhorn PHP 2021
Demystifying Unicode - Longhorn PHP 2021Colin O'Dell
 
Scanned by CamScannero u h a v e a tte m p te d th is .docx
Scanned by CamScannero u  h a v e  a tte m p te d  th is  .docxScanned by CamScannero u  h a v e  a tte m p te d  th is  .docx
Scanned by CamScannero u h a v e a tte m p te d th is .docxkenjordan97598
 
Cbse ugc-net-computer-science-paper-2-december-2014
Cbse ugc-net-computer-science-paper-2-december-2014Cbse ugc-net-computer-science-paper-2-december-2014
Cbse ugc-net-computer-science-paper-2-december-2014Ashish Rai
 
Piotr Szotkowski about "Bits of ruby"
Piotr Szotkowski about "Bits of ruby"Piotr Szotkowski about "Bits of ruby"
Piotr Szotkowski about "Bits of ruby"Pivorak MeetUp
 
Τα Πολύ Βασικά για την Python
Τα Πολύ Βασικά για την PythonΤα Πολύ Βασικά για την Python
Τα Πολύ Βασικά για την PythonMoses Boudourides
 

Ähnlich wie Test5 (20)

Pre-Cal 40S May 4, 2009
Pre-Cal 40S May 4, 2009Pre-Cal 40S May 4, 2009
Pre-Cal 40S May 4, 2009
 
2014 06-23 velocity sc beyond page metrics
2014 06-23 velocity sc beyond page metrics2014 06-23 velocity sc beyond page metrics
2014 06-23 velocity sc beyond page metrics
 
aaaaaaaaaa
aaaaaaaaaaaaaaaaaaaa
aaaaaaaaaa
 
Bai Giang 11
Bai Giang 11Bai Giang 11
Bai Giang 11
 
Introduction to Programming @ NTHUEEECamp 2015
Introduction to Programming @ NTHUEEECamp 2015Introduction to Programming @ NTHUEEECamp 2015
Introduction to Programming @ NTHUEEECamp 2015
 
PyLadies Talk: Learn to love the command line!
PyLadies Talk: Learn to love the command line!PyLadies Talk: Learn to love the command line!
PyLadies Talk: Learn to love the command line!
 
Ly Thuyet Va Bai Tap Excel
Ly Thuyet Va Bai Tap ExcelLy Thuyet Va Bai Tap Excel
Ly Thuyet Va Bai Tap Excel
 
Control flow in c
Control flow in cControl flow in c
Control flow in c
 
Bai tap dai_so_tuyen_tinh
Bai tap dai_so_tuyen_tinhBai tap dai_so_tuyen_tinh
Bai tap dai_so_tuyen_tinh
 
Practica 3ro trips
Practica 3ro tripsPractica 3ro trips
Practica 3ro trips
 
深入淺出C語言
深入淺出C語言深入淺出C語言
深入淺出C語言
 
C++20 新功能:Concepts & Ranges
C++20 新功能:Concepts & RangesC++20 新功能:Concepts & Ranges
C++20 新功能:Concepts & Ranges
 
Vim your Python, Python your Vim
Vim your Python, Python your VimVim your Python, Python your Vim
Vim your Python, Python your Vim
 
Boo Programming Language
Boo Programming LanguageBoo Programming Language
Boo Programming Language
 
090608-TogoWS REST
090608-TogoWS REST090608-TogoWS REST
090608-TogoWS REST
 
Demystifying Unicode - Longhorn PHP 2021
Demystifying Unicode - Longhorn PHP 2021Demystifying Unicode - Longhorn PHP 2021
Demystifying Unicode - Longhorn PHP 2021
 
Scanned by CamScannero u h a v e a tte m p te d th is .docx
Scanned by CamScannero u  h a v e  a tte m p te d  th is  .docxScanned by CamScannero u  h a v e  a tte m p te d  th is  .docx
Scanned by CamScannero u h a v e a tte m p te d th is .docx
 
Cbse ugc-net-computer-science-paper-2-december-2014
Cbse ugc-net-computer-science-paper-2-december-2014Cbse ugc-net-computer-science-paper-2-december-2014
Cbse ugc-net-computer-science-paper-2-december-2014
 
Piotr Szotkowski about "Bits of ruby"
Piotr Szotkowski about "Bits of ruby"Piotr Szotkowski about "Bits of ruby"
Piotr Szotkowski about "Bits of ruby"
 
Τα Πολύ Βασικά για την Python
Τα Πολύ Βασικά για την PythonΤα Πολύ Βασικά για την Python
Τα Πολύ Βασικά για την Python
 

Mehr von 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 10 Final
Session 10 FinalSession 10 Final
Session 10 Final
 
Session 09 Final
Session 09 FinalSession 09 Final
Session 09 Final
 
Session 08 Final
Session 08 FinalSession 08 Final
Session 08 Final
 
Session 07 Final
Session 07 FinalSession 07 Final
Session 07 Final
 
Session 06 Final
Session 06 FinalSession 06 Final
Session 06 Final
 
Session 04 Final Sua
Session 04 Final SuaSession 04 Final Sua
Session 04 Final Sua
 
Session 03 Final
Session 03 FinalSession 03 Final
Session 03 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
 
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
 

Kürzlich hochgeladen

Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfMr Bounab Samir
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPCeline George
 
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4MiaBumagat1
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management systemChristalin Nelson
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management SystemChristalin Nelson
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxAshokKarra1
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Jisc
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxHumphrey A Beña
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptxSherlyMaeNeri
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designMIPLM
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxAnupkumar Sharma
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parentsnavabharathschool99
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPCeline George
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
FILIPINO PSYCHology sikolohiyang pilipino
FILIPINO PSYCHology sikolohiyang pilipinoFILIPINO PSYCHology sikolohiyang pilipino
FILIPINO PSYCHology sikolohiyang pilipinojohnmickonozaleda
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...Postal Advocate Inc.
 

Kürzlich hochgeladen (20)

LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptxLEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERP
 
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptxFINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
 
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management system
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management System
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptx
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptx
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-design
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parents
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERP
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
FILIPINO PSYCHology sikolohiyang pilipino
FILIPINO PSYCHology sikolohiyang pilipinoFILIPINO PSYCHology sikolohiyang pilipino
FILIPINO PSYCHology sikolohiyang pilipino
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
 

Test5

  • 1. BÀI TRẮC NGHIỆM SỐ 4 Ngôn ngữ lập trình C Thời gian: 15’ Họ tên:……………………………………… Lớp………………………………………….. Câu 1: Trong C, hàm nào sau đây được dùng để giải phóng bộ nhớ đã được cấp phát? a. free b. delete c. clear d. remove Câu 2: Trong C, khai báo nào dưới đây là khai báo đúng của struct? a. struct{int a;} b. stuct a_struct{int;} c. struct a_struct int a; d. struct a_struct{int a;}; Câu 3: Trong C, đối số argc (argument count) lưu trữ giá trị gì? a. Số đối số truyền vào trong hàm main b. Số lượng đối số truyền vào trong hàm main + 1 c. Số lượng đối số truyền vào trong hàm main -1 d. Tổng kích thước tính bằng byte của mảng đối số Câu 4: Cho đoạn chương trình C sau đây: int a[10], i, *p; a[0] = 1; a[1] = 2; p = a; (*p)++; a[1]=? a. a[1] = 2 b. a[1] = 3 c. a[1] = 4 d. Không đưa ra kết quả. Câu 5: Thực hiện: Kiểm tra nếu a, b, c đều lớn hơn 1 thì in số 1, chọn câu nào? a. if (a>1) or (b>1) or (c>1) then write(1); b. if a>1 and b>1 and c>1 then write(1); c. if (a>1) and (b>1) and (c>1) then write(1); d. if a, b, c > 1 then write(1); Câu 6: Đáp án nào dưới đây là khai báo hoàn chỉnh của một hàm trong C? a. int funct(); b. int funct(int x) {return x=x+1;} c. void funct(int) {printf(quot;Helloquot;)} d. void funct(x) { printf(quot;Helloquot;)} Câu 7: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]; Câu 8: 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';
  • 2. Câu 9: 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]; Câu 10: 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 }; Câu 11: 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; ); Câu 12 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] ); Câu 13: 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); b) printf(quot;%cnquot;, words); c) printf(quot;%dnquot;, words); d) printf(quot;%snquot;, words[2]); Câu 14: 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); Câu 15: 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; Câu 16: 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; b) balance = float temp; c) float temp *balance; d) &temp = balance;
  • 3. Câu 17: 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'; Câu 18: 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 c) count = 10, *temp = 2, sum = 10 d) count = 200, *temp = 0.2, sum = 1 Câu 19: 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;; d) char message = 'Hello'; Câu 20: Trong ngôn ngữ C, câu lệnh nào sau đây trả về địa chỉ ô nhớ của con trỏ p? a. p; b. *p; c. &p; d. address(p);