Quiz - 8 on conditional/ternary operator

Quiz - 8 on conditional/ternary operator

15 Qs

quiz-placeholder

Similar activities

Unit 7 Review

Unit 7 Review

KG - University

15 Qs

Quiz on Functions in C

Quiz on Functions in C

KG - University

11 Qs

ACC  The Byzantine Empire and Early Russia Test

ACC The Byzantine Empire and Early Russia Test

KG - University

12 Qs

STUDY- The Byzantine Empire and Early Russia Test

STUDY- The Byzantine Empire and Early Russia Test

KG - University

12 Qs

PLASTICS 2 (3ESOA)

PLASTICS 2 (3ESOA)

KG - University

19 Qs

French Revolution Review

French Revolution Review

8th Grade

10 Qs

Global - Mesopotamia

Global - Mesopotamia

KG - University

20 Qs

CSB Checkpoint 1

CSB Checkpoint 1

12th Grade

10 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?