void checkNumber(int x) {
if (x > 0) {
printf("Positive");
} else if (x == 0) {
printf("Zero");
} else {
printf("Negative");
}
}
int main() {
checkNumber(0);
return 0;
}
Unit 13 Function and decision
Quiz
•
Computers
•
University
•
Easy
Abhishek Pandey
Used 1+ times
FREE Resource
6 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
void checkNumber(int x) {
if (x > 0) {
printf("Positive");
} else if (x == 0) {
printf("Zero");
} else {
printf("Negative");
}
}
int main() {
checkNumber(0);
return 0;
}
Zero
One
Negative
positive
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following decision structures is best suited for checking multiple conditions in a compact way?
if-else
switch
while
for
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
void checkValue(int x) {
if (x > 50) {
printf("Greater than 50");
} else if (x == 50) {
printf("Equal to 50");
} else {
printf("Less than 50");
}
}
int main() {
checkValue(100);
return 0;
}
Greater than 50
Equal to 50
Less than 50
x==50
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which loop is guaranteed to execute at least once, even if the condition is false?
for loop
while loop
do-while loop
if loop
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the correct way to define a function in C?
function(int a, int b) { return a + b; }
int function(a, b) { return a + b;
int function(int a, int b) { return a + b; }
int function(int, int) { return a + b; }
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the correct way to pass an array to a function in C?
function(array[]);
function(array[10]);
function(array);
function(int array[]);
11 questions
C Language
Quiz
•
10th Grade - University
10 questions
DS UNIT-2 TEST-1
Quiz
•
University
10 questions
Quiz 8: Arrays&Vector
Quiz
•
University
10 questions
C Programming Lab Quiz
Quiz
•
University
10 questions
Basics of C
Quiz
•
University
10 questions
Structure in C
Quiz
•
University
6 questions
PPS MCQ on 22.11.2024
Quiz
•
10th Grade - University
8 questions
Quiz - 1
Quiz
•
University
15 questions
Character Analysis
Quiz
•
4th Grade
17 questions
Chapter 12 - Doing the Right Thing
Quiz
•
9th - 12th Grade
10 questions
American Flag
Quiz
•
1st - 2nd Grade
20 questions
Reading Comprehension
Quiz
•
5th Grade
30 questions
Linear Inequalities
Quiz
•
9th - 12th Grade
20 questions
Types of Credit
Quiz
•
9th - 12th Grade
18 questions
Full S.T.E.A.M. Ahead Summer Academy Pre-Test 24-25
Quiz
•
5th Grade
14 questions
Misplaced and Dangling Modifiers
Quiz
•
6th - 8th Grade