Week 6  #1 CS172 - Conditionals Related Questions

Week 6 #1 CS172 - Conditionals Related Questions

Assessment

Quiz

Computer Science

12th Grade

Practice Problem

Medium

Created by

Mr. Martin

Used 12+ times

FREE Resource

Student preview

quiz-placeholder

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; }

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

Already have an account?