
Kiểm Tra Kiến Thức Lập Trình
Authored by Cu Sac
Mathematics
University

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
72 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
Đáp án nào sau đây là đúng để gán y=1 khi char ch='A' ?
switch(ch) { case "A": y=1; break; case "B": y=2; break; }
switch(ch == 'A') { case true: y=2; break; case false: y=1; break; }
switch(ch) { case 'A': y=1; break; case 'B': y=2; break; }
switch(ch % 2 == 0) { case true: y=1; break; case false: y=2; }
2.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
Đáp án nào sau đây là đúng để kiểm tra một số nguyên n có phải là số chính phương bằng cách sử dụng switch-case?
switch(sqrt(n)) { case 1: cout<<"n la so chinh phuong"; break; }
switch(n % 2) { case 0: cout<<"n la so chinh phuong"; break; }
switch((int)sqrt(n)==sqrt(n)){ case 1: cout<<"n la so chinh phuong"; break; }
switch(n) { case (int)sqrt(n): cout<<"n la so chinh phuong"; break; }
3.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
Đáp án nào sau đây là đúng để kiểm tra một số có chia hết cho 4 và 6 bằng cách sử dụng if-else lồng nhau?
if (n % 4 == 0 || n % 6 == 0) { cout<<"n chia hết cho 4 và 6"; }
if (n % 6 == 0) { if (n % 4 != 0) { cout<<"n chia hết cho 4 và 6"; } }
if (n % 4 == false) { if (n % 6 == false) { cout<<"n chia hết cho 4 và 6"; } }
if (n % 4 == true) { if (n % 6 == true) { cout<<"n chia hết cho 4 và 6"; } }
4.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
Đáp án nào sau đây là đúng để kiểm tra một số có chia hết cho 5, 7 và 9 ?
if (n % 5 == 0 || n % 7 == 0 || n % 9 == 0) { cout<<"n chia hết cho 5, 7 và 9"; }
if (n % 5 == 0 && n % 7 == 0 && n % 9 == 0) { cout<<"n chia hết cho 5, 7 và 9"; }
if (n % 5 == true) { if (n % 7 == true) { if (n % 9 == true) { cout<<"n chia hết cho 5, 7 và 9"; } } }
if (n % 9 != 0) { if (n % 5 == 0 && n % 7 == 0) { cout<<"n chia hết cho 5, 7 và 9"; } }
5.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
Đáp án nào sau đây là đúng để kiểm tra nếu ký tự đó là a/e/o/u/i thì thông báo là nguyên âm, trái lại thông báo là phụ âm.
switch (ky_tu) : { case 'a': case 'e': case 'i': case 'o': case 'u': cout<<"Nguyen am"; break; default: cout<<"Phu am"; }
switch (ky_tu) { case 'a': case 'e': case 'i': case 'o': case 'u': cout<<"Nguyen am"; default: cout<<"Phu am"; }
switch (ky_tu) { case 'a': case 'e': case 'i': case 'o': case 'u': cout<<"Nguyen am"; break; default: cout<<"Phu am"; }
switch (ky_tu) { case 'a', 'e', 'i', 'o', 'u': cout<<"Nguyen am"; break; default: cout<<"Phu am"; }
6.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
Đáp án nào sau đây là đúng để kiểm tra một số nguyên n có chia hết cho 3 và 7 không?
if (n % 3 == 0 || n % 7 == 0) { cout<<"n chia hết cho 3 và 7"; }
if (n % 3 == 0) { if (n % 7 != 0) { cout<<"n chia hết cho 3 và 7"; } }
if (n % 7 == false && n % 3 == false) { cout<<"n chia hết cho 3 và 7"; }
if (n % 7 != 0 && n % 3 == 0) cout<<"n chia hết cho 3 và 7";
7.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
Câu 107: Đáp án nào sau đây là đúng để kiểm tra nếu một số có phải là số nguyên tố thì trả về true ?
bool SNT(int n) {if (n <= 1) return false;for (int i = 2; i <= sqrt(n); i++) {if (n % i == 0)return false;}return true;}
bool SNT(int n) {if (n <= 1) return false;for (int i = 2; i <= sqrt(n); i++) {if (n % i == 1)return false;}return true;}
bool SNT(int n) {if (n <= 1) return false;for (int i = 2; i <= sqrt(n); i++) {if (n % i == 2)return false;}return true;}
bool SNT(int n) {if (n <= 1) return false;for (int i = 2; i <= sqrt(n); i++) {if (n % i != 0)return false;}return true;}
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?
Similar Resources on Wayground
71 questions
Инж мех
Quiz
•
University
69 questions
Statistics Final Exam
Quiz
•
9th Grade - University
70 questions
GEC MATH REVIEWER PART 3
Quiz
•
University
72 questions
Ôn Thi Tofas Level 2
Quiz
•
4th Grade - University
76 questions
Kkkk
Quiz
•
University
73 questions
6th grade review m1 t3
Quiz
•
6th Grade - University
70 questions
Evaluasi Pendidikan UTS
Quiz
•
University
70 questions
Final Quiz
Quiz
•
University
Popular Resources on Wayground
8 questions
Spartan Way - Classroom Responsible
Quiz
•
9th - 12th Grade
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
14 questions
Boundaries & Healthy Relationships
Lesson
•
6th - 8th Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
3 questions
Integrity and Your Health
Lesson
•
6th - 8th Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
9 questions
FOREST Perception
Lesson
•
KG
20 questions
Main Idea and Details
Quiz
•
5th Grade
Discover more resources for Mathematics
7 questions
Introduction to Fractions
Interactive video
•
1st Grade - University
50 questions
Independent and Dependent Variables
Quiz
•
6th Grade - University
25 questions
Types of numbers
Quiz
•
KG - University
20 questions
Factoring Practice
Quiz
•
8th Grade - University
15 questions
Simple Probability
Quiz
•
KG - University
10 questions
Translations and Reflections Practice Quiz
Quiz
•
KG - University
9 questions
Multiplying and Dividing Integers
Quiz
•
KG - University