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
Similar Resources on Wayground
10 questions
Ch. 1 Lesson 2: The Byzantine Empire Quiz

Quiz
•
7th Grade
14 questions
H3 Hammurabi's Code Reading Review

Quiz
•
6th Grade
11 questions
C++ Quiz 1

Quiz
•
KG - University
14 questions
TinkerCAD Codeblocks Quiz makeup

Quiz
•
7th Grade
11 questions
Evaluación Python G-10 4P NOV

Quiz
•
KG - University
19 questions
French Revolution Vocabulary Quiz

Quiz
•
9th Grade
20 questions
Intro to Python Assessment

Quiz
•
KG - University
15 questions
Unit 2 Test B

Quiz
•
9th Grade - University
Popular Resources on Wayground
10 questions
Video Games

Quiz
•
6th - 12th Grade
10 questions
Lab Safety Procedures and Guidelines

Interactive video
•
6th - 10th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
10 questions
UPDATED FOREST Kindness 9-22

Lesson
•
9th - 12th Grade
22 questions
Adding Integers

Quiz
•
6th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
20 questions
US Constitution Quiz

Quiz
•
11th Grade
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade
Discover more resources for others
10 questions
Video Games

Quiz
•
6th - 12th Grade
10 questions
Lab Safety Procedures and Guidelines

Interactive video
•
6th - 10th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
10 questions
UPDATED FOREST Kindness 9-22

Lesson
•
9th - 12th Grade
22 questions
Adding Integers

Quiz
•
6th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
20 questions
US Constitution Quiz

Quiz
•
11th Grade
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade