Quiz - 8 on conditional/ternary operator

Quiz - 8 on conditional/ternary operator

15 Qs

quiz-placeholder

Similar activities

Unit 8: Political Revolutions 1750-1914

Unit 8: Political Revolutions 1750-1914

KG - University

20 Qs

Can you guess which adult chose each book?

Can you guess which adult chose each book?

1st - 5th Grade

19 Qs

Baseline for Beginners

Baseline for Beginners

KG - University

19 Qs

Pr1 U3 rozcvička What do they need?

Pr1 U3 rozcvička What do they need?

KG - University

13 Qs

Penilaian Harian Kelas 7 Materi Aksara Jawa

Penilaian Harian Kelas 7 Materi Aksara Jawa

KG - University

20 Qs

Arts hahahaha

Arts hahahaha

8th Grade

12 Qs

Soal IPS

Soal IPS

KG - University

11 Qs

PH 1

PH 1

9th Grade

20 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

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

By signing up, you agree to our Terms of Service & Privacy Policy

Already have an account?