
Basic C Programming - Control Flow
Authored by Hafizul Hasmie
Education
12th Grade
Used 3+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
10 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the syntax for an if statement in C?
if (condition) then // code block
if (condition) { // code block
if (condition) { // code block }
if (condition) then { // code block }
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How do you write an if else statement in C?
if (condition) { // code to be executed if the condition is true } else { // code to be executed if the condition is false }
if (condition) { // code to be executed if the condition is true } else { // code to be executed if the condition is false }
if (condition) { // code to be executed if the condition is true }
if (condition) { // code to be executed if the condition is false } else { // code to be executed if the condition is true }
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Explain the concept of nested if else in C with an example.
In nested if else, the else block must always come before the if block
Example:
#include
Nested if else can only be used with integers in C
Nested if else is not supported in C
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
When would you use a switch statement in C?
When you have multiple conditions to evaluate and different actions to take based on each condition.
When you want to execute a single action based on a condition
When you need to loop through a collection of elements
When you want to handle exceptions in your code
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the purpose of the default case in a switch statement?
To handle situations where none of the specified cases match the input value.
To provide an alternative case for the input value
To terminate the switch statement immediately
To skip the switch statement and move to the next block of code
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Write a C program to check if a number is positive, negative, or zero using if else.
Here is a sample C program:
#include
printf("%d is non-negative.", num);
if(num >= 0)
int num = 0;
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How can you use nested if else to determine the largest of three numbers in C?
if (num1 >= num2) { if (num1 >= num3) { largest = num1; } else { largest = num3; } } else { if (num2 >= num3) { largest = num2; } else { largest = num3; } }
if (num1 >= num2) { largest = num1; } else { largest = num2; }
if (num1 >= num2 && num1 >= num3) { largest = num1; }
if (num1 >= num2) { largest = num1; } else if (num2 >= num3) { largest = num2; } else { largest = num3; }
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?
Similar Resources on Wayground
15 questions
Non-Verbal Communication
Quiz
•
12th Grade - University
15 questions
The USA Trivia quiz 1
Quiz
•
10th - 12th Grade
13 questions
The Writing Process 5 steps
Quiz
•
9th - 12th Grade
10 questions
Finance Literacy Quiz
Quiz
•
6th - 12th Grade
15 questions
GRAD Requirements
Quiz
•
9th - 12th Grade
15 questions
Chapter 5: Sale of goods (jun2019)
Quiz
•
12th Grade
10 questions
Q1M2
Quiz
•
11th - 12th Grade
10 questions
Identifying Rejection Region and Test Statistic
Quiz
•
11th - 12th Grade
Popular Resources on Wayground
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
22 questions
fractions
Quiz
•
3rd Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade
15 questions
Equivalent Fractions
Quiz
•
4th Grade
20 questions
Figurative Language Review
Quiz
•
6th Grade
Discover more resources for Education
20 questions
-AR -ER -IR present tense
Quiz
•
10th - 12th Grade
12 questions
Add and Subtract Polynomials
Quiz
•
9th - 12th Grade
13 questions
Model Exponential Growth and Decay Scenarios
Quiz
•
9th - 12th Grade
27 questions
7.2.3 Quadrilateral Properties
Quiz
•
9th - 12th Grade
7 questions
Amoeba Sisters Dihybrid Cross Punnett Square
Interactive video
•
9th - 12th Grade
10 questions
The Holocaust: Historical Overview
Interactive video
•
9th - 12th Grade
10 questions
Key Features of Quadratic Functions
Interactive video
•
8th - 12th Grade
11 questions
Exponent Quotient Rules A1 U7
Quiz
•
9th - 12th Grade