Control Flow

Control Flow

Professional Development

10 Qs

quiz-placeholder

Similar activities

Arrays & Strings using C

Arrays & Strings using C

Professional Development

15 Qs

UML

UML

Professional Development

15 Qs

C String Array MCQs

C String Array MCQs

Professional Development

10 Qs

Driver Installations

Driver Installations

Professional Development

10 Qs

Bases de Word

Bases de Word

Professional Development

15 Qs

Ai BG-Q#

Ai BG-Q#

Professional Development

10 Qs

Clase_5

Clase_5

Professional Development

14 Qs

Data Analytics Basics

Data Analytics Basics

Professional Development

10 Qs

Control Flow

Control Flow

Assessment

Quiz

Computers

Professional Development

Medium

Created by

Unknown Unknown

Used 2+ times

FREE Resource

AI

Enhance your content in a minute

Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...

10 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

let num = 5

if num > 0 {

print("Positive")

}

Positive

Negative

0

Error

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which syntax is correct for an if statement in Swift?

if x > 5 then { print(x) }

if (x > 5) { print(x) }

if x > 5: print(x)

if x > 5 do { print(x) }

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will happen if the if condition is false and there is no else block?

The if block still runs

Nothing happens

The program crashes

It prints false

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

let fruit = "Mango"

switch fruit {

case "Apple", "Mango":

print("Sweet fruit")

default:

print("Other fruit")

}

Sweet fruit

Other fruit

Apple

Mango

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which is the correct way to use ranges in switch?

1 to 5

1...5

1->5

range(1,5)

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

let x = 5

let y = 10

if x > 3 && y < 10 {

print("Case 1")

} else if x == 5 || y == 5 {

print("Case 2")

} else {

print("Case 3")

}

Case 1

Case 2

Case 3

Error

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

let number = 15

switch number {

case 1...10:

print("Small")

case 11...20:

if number % 2 == 0 {

print("Medium Even")

} else {

print("Medium Odd")

}

default:

print("Large")

}

Small

Medium Even

Medium Odd

Large

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?