Quiz - 8 on conditional/ternary operator

Quiz - 8 on conditional/ternary operator

15 Qs

quiz-placeholder

Similar activities

Python

Python

KG - University

15 Qs

1.3 Rescue Mission

1.3 Rescue Mission

KG - University

13 Qs

Problem Solving using C - EBT(2025-2026 odd)

Problem Solving using C - EBT(2025-2026 odd)

University

11 Qs

Core 4 Mesopotamian Empires Quiz

Core 4 Mesopotamian Empires Quiz

6th Grade

15 Qs

French Revolution

French Revolution

9th Grade

14 Qs

Practice Quiz 8-2

Practice Quiz 8-2

KG - University

10 Qs

Does ChatGPT Make Education More Equitable?

Does ChatGPT Make Education More Equitable?

KG - University

10 Qs

Y9 Autumn 1 EOU Assessment

Y9 Autumn 1 EOU Assessment

KG - University

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