Search Header Logo

Week 6 #1 CS172 - Conditionals Related Questions

Authored by Mr. Martin

Computer Science

12th Grade

Used 12+ times

Week 6  #1 CS172 - Conditionals Related Questions
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

14 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the purpose of a conditional statement?

To specify whether another statement or block of statements should be executed

To assign a value to a variable

To declare a variable

To perform arithmetic operations

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which operator is used for comparison in conditional statements?

=

==

<>

!>

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the syntax for an if statement?

if (condition) { statements }

if { condition } then { statements }

if [condition] then { statements }

if (condition) then { statements }

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the purpose of alternative execution in conditional statements?

To execute multiple sets of statements based on different conditions

To execute a single set of statements based on a condition

To execute a set of statements only if a condition is false

To execute a set of statements only if a condition is true

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the purpose of chained conditionals?

To check for a number of related conditions and choose one of several actions

To execute a set of statements only if a condition is true

To execute a set of statements only if a condition is false

To execute multiple sets of statements based on different conditions

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the purpose of nested conditionals?

To nest one conditional within another

To execute a set of statements only if a condition is true

To execute a set of statements only if a condition is false

To check for a number of related conditions and choose one of several actions

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the syntax for a switch statement?

switch(expression) { case constant-expression: statements; break; default: statements; }

switch(expression) { case constant-expression: statements; break; case constant-expression: statements; break; default: statements; }

switch(expression) { case constant-expression: statements; case constant-expression: statements; default: statements; }

switch(expression) { case constant-expression: statements; case constant-expression: statements; }

Access all questions and much more by creating a free account

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

Already have an account?