Quiz - 8 on conditional/ternary operator

Quiz - 8 on conditional/ternary operator

15 Qs

quiz-placeholder

Similar activities

Parcial 1-Laboratorio II-5to BACO-I Unidad Forma A

Parcial 1-Laboratorio II-5to BACO-I Unidad Forma A

KG - University

13 Qs

Parcial 1-Laboratorio II-5to BACO-I Unidad Forma B

Parcial 1-Laboratorio II-5to BACO-I Unidad Forma B

KG - University

13 Qs

Byzantine Empire Review 2025

Byzantine Empire Review 2025

6th - 8th Grade

11 Qs

Tech Ed Assessment 3.0/4.0

Tech Ed Assessment 3.0/4.0

1st - 5th Grade

20 Qs

Quiz - 5 on Increment and Decrement Operators

Quiz - 5 on Increment and Decrement Operators

KG - University

15 Qs

Lesson six - Sensing

Lesson six - Sensing

KG - University

17 Qs

Lesson 1 Summative Assessment

Lesson 1 Summative Assessment

KG - University

16 Qs

Quiz - 8 on conditional/ternary operator

Quiz - 8 on conditional/ternary operator

Assessment

Quiz

others

Medium

Created by

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;

10
20
5
3

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;

10
20
5
3

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);

1
2
0
-1

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;

8
12
4
6

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);

100
200
3
5

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;

10
20
30
0

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What does the following code print?

int a = 7;

printf("%s", (a % 2 == 0) ? "even" : "odd");

even
odd
7
0

Create a free account and access millions of resources

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?