C Programming Control Flow Statements

C Programming Control Flow Statements

Assessment

Flashcard

Computers

University

Practice Problem

Hard

Created by

Kayal Prag

FREE Resource

Student preview

quiz-placeholder

8 questions

Show all answers

1.

FLASHCARD QUESTION

Front

What is the purpose of 'if statements' in C?

Back

'If statements' control the program flow based on a condition; they execute a code block when the expression evaluates to true.

2.

FLASHCARD QUESTION

Front

What is the syntax of an 'if statement' in C?

Back

if(condition) { // Statements to execute if condition is true }

3.

FLASHCARD QUESTION

Front

What will be the output of the following code? int i = 10; if (i > 15) { printf("10 is greater than 15"); } printf("I am Not");

Back

I am Not

4.

FLASHCARD QUESTION

Front

What is the difference between 'if statements' and 'if...else statements'?

Back

'If...else statements' execute a code block if the expression is true; otherwise, they execute the else statement code block.

5.

FLASHCARD QUESTION

Front

What is the syntax of 'if...else' in C?

Back

if (condition) { // Executes this block if condition is true } else { // Executes this block if condition is false }

6.

FLASHCARD QUESTION

Front

What will be the output of the following code? int i = 20; if (i < 20) { printf("i is smaller than 20"); } else printf("The number may be equal to 20");

Back

The number may be equal to 20

7.

FLASHCARD QUESTION

Front

What are 'if-else-if statements' used for?

Back

'If-else-if statements' are used when the user has to decide among multiple options.

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?