Quiz - 8 on conditional/ternary operator
Quiz
•
others
•
•
Medium
Michael Kona
Used 3+ times
FREE Resource
15 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the value of x after the following code is executed?
int x = (5 > 3) ? 10 : 20;
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the value of y after the following code is executed?
int y = (5 < 3) ? 10 : 20;
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What does the following code print?
int a = 1, b = 2;
printf("%d", (a > b) ? a : b);
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the value of result after the following code is executed?
int x = 4;
int result = (x % 2 == 0) ? x * 2 : x * 3;
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What does the following code print?
int a = 3, b = 5;
printf("%d", (a == b) ? 100 : 200);
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the value of z after the following code is executed?
int x = 10, y = 20;
int z = (x > y) ? x : y;
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What does the following code print?
int a = 7;
printf("%s", (a % 2 == 0) ? "even" : "odd");
Create a free account and access millions of resources
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
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?
Similar Resources on Wayground
11 questions
Quiz on Functions in C
Quiz
•
KG - University
20 questions
Molecular Biology Review
Quiz
•
10th Grade
15 questions
Python Assessment
Quiz
•
KG - University
10 questions
Evaluare- Bazele Programării C++
Quiz
•
KG - University
10 questions
Циклдық алгоритм
Quiz
•
KG - University
19 questions
U6 W1 WTS: The Unbreakable Code
Quiz
•
KG - University
10 questions
CL 8- 5. Decision making and loops in Python
Quiz
•
KG - University
16 questions
Pre-test CTCC0323
Quiz
•
KG - University
Popular Resources on Wayground
20 questions
Brand Labels
Quiz
•
5th - 12th Grade
10 questions
Ice Breaker Trivia: Food from Around the World
Quiz
•
3rd - 12th Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
20 questions
ELA Advisory Review
Quiz
•
7th Grade
15 questions
Subtracting Integers
Quiz
•
7th Grade
22 questions
Adding Integers
Quiz
•
6th Grade
10 questions
Multiplication and Division Unknowns
Quiz
•
3rd Grade
10 questions
Exploring Digital Citizenship Essentials
Interactive video
•
6th - 10th Grade
Discover more resources for others
20 questions
Brand Labels
Quiz
•
5th - 12th Grade
10 questions
Ice Breaker Trivia: Food from Around the World
Quiz
•
3rd - 12th Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
20 questions
ELA Advisory Review
Quiz
•
7th Grade
15 questions
Subtracting Integers
Quiz
•
7th Grade
22 questions
Adding Integers
Quiz
•
6th Grade
10 questions
Multiplication and Division Unknowns
Quiz
•
3rd Grade
10 questions
Exploring Digital Citizenship Essentials
Interactive video
•
6th - 10th Grade