What is the value of x after the following code is executed?
int x = (5 > 3) ? 10 : 20;
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");
20 questions
2.3 Testing
Quiz
•
KG - University
15 questions
Python
Quiz
•
KG - University
13 questions
1.3 Rescue Mission
Quiz
•
KG - University
13 questions
Parcial 1-Laboratorio II-5to BACO-I Unidad Forma B
Quiz
•
KG - University
11 questions
Java Refresher
Quiz
•
KG - University
15 questions
Unit 2 Test B
Quiz
•
9th Grade - University
15 questions
Parcial I - I Serie- Programación I - 4to BACO - I Unidad
Quiz
•
KG - University
20 questions
Tech Ed Assessment 3.0/4.0
Quiz
•
1st - 5th Grade
15 questions
Multiplication Facts
Quiz
•
4th Grade
20 questions
Math Review - Grade 6
Quiz
•
6th Grade
20 questions
math review
Quiz
•
4th Grade
5 questions
capitalization in sentences
Quiz
•
5th - 8th Grade
10 questions
Juneteenth History and Significance
Interactive video
•
5th - 8th Grade
15 questions
Adding and Subtracting Fractions
Quiz
•
5th Grade
10 questions
R2H Day One Internship Expectation Review Guidelines
Quiz
•
Professional Development
12 questions
Dividing Fractions
Quiz
•
6th Grade
15 questions
Multiplication Facts
Quiz
•
4th Grade
20 questions
Math Review - Grade 6
Quiz
•
6th Grade
20 questions
math review
Quiz
•
4th Grade
5 questions
capitalization in sentences
Quiz
•
5th - 8th Grade
10 questions
Juneteenth History and Significance
Interactive video
•
5th - 8th Grade
15 questions
Adding and Subtracting Fractions
Quiz
•
5th Grade
10 questions
R2H Day One Internship Expectation Review Guidelines
Quiz
•
Professional Development
12 questions
Dividing Fractions
Quiz
•
6th Grade