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

Java Refresher

Java Refresher

KG - University

11 Qs

แบบทดสอบเรื่องโครงสร้างภาษาซี ม.6/2

แบบทดสอบเรื่องโครงสร้างภาษาซี ม.6/2

KG - University

10 Qs

Python Quizizz

Python Quizizz

KG - University

18 Qs

Parcial I - I Serie- Programación I - 4to BACO - I Unidad

Parcial I - I Serie- Programación I - 4to BACO - I Unidad

KG - University

15 Qs

Test linguaggio C crediti

Test linguaggio C crediti

9th - 12th Grade

20 Qs

Gov - Chapter 19 - Laws and Our Society

Gov - Chapter 19 - Laws and Our Society

12th Grade - 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?