
Decision making in C

Quiz
•
Computers
•
University
•
Medium
Dr. Singh
Used 4+ times
FREE Resource
10 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
What is the correct syntax for an if statement in C?
2.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
Which of the following statements is true about the else if construct?
3.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
What will the following code print if x = 10?
if (x < 5) {
printf("Less than 5");
} else if (x < 15) {
printf("Less than 15");
} else {
printf("15 or more");
}
4.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
In C, which of the following statements correctly implements a switch-case?
switch(expression) { case value1: // code block; default: // code block; }
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will the following code output if num is 3?
switch (num) {
case 1:
printf("One");
break;
case 2:
printf("Two");
break;
default:
printf("Default");
break;
}
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following expressions is evaluated in an if statement in C?
Integer values only
Boolean values only
Any expression that evaluates to zero (false) or non-zero (true)
String literals only
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the output of the following code segment?
int a = 5, b = 10;
if (a > b)
printf("A is greater");
else if (a < b)
printf("B is greater");
else
printf("A and B are equal");
Create a free account and access millions of resources
Similar Resources on Wayground
8 questions
FST Class 2023- Quiz 3

Quiz
•
University
15 questions
Milking Minds 2 17-01-24

Quiz
•
University
6 questions
Unit 5 : Decision Control in C

Quiz
•
University
15 questions
C++ Switch and If Else Statements

Quiz
•
University
15 questions
C programming

Quiz
•
University
11 questions
Control Structures - Selection in Python

Quiz
•
8th Grade - University
15 questions
Python Basics Quiz 1

Quiz
•
8th Grade - University
8 questions
FST Class 2023- Quiz 4

Quiz
•
University
Popular Resources on Wayground
55 questions
CHS Student Handbook 25-26

Quiz
•
9th Grade
18 questions
Writing Launch Day 1

Lesson
•
3rd Grade
10 questions
Chaffey

Quiz
•
9th - 12th Grade
15 questions
PRIDE

Quiz
•
6th - 8th Grade
40 questions
Algebra Review Topics

Quiz
•
9th - 12th Grade
22 questions
6-8 Digital Citizenship Review

Quiz
•
6th - 8th Grade
10 questions
Nouns, nouns, nouns

Quiz
•
3rd Grade
10 questions
Lab Safety Procedures and Guidelines

Interactive video
•
6th - 10th Grade