What is the output of the following program segment?
int num=10;
if (num >5)
{ cout<< "Number is greater than 5"; }
Topic2: If method
Quiz
•
Computers
•
University
•
Easy
AZLINA MYDIN
Used 6+ times
FREE Resource
10 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the output of the following program segment?
int num=10;
if (num >5)
{ cout<< "Number is greater than 5"; }
Number is greater than 5
Number is not greater than 5
10
5
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the output of the following program segment?
int num=10;
if (num >20)
cout<< "Number is greater than 20";
else
cout<< "Number is less than 20";
Number is greater than 20
Number is less than 20
10
5
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the output of the following program segment?
int num=10;
if (num >0)
cout<< "Number is greater than 0";
else
cout<< "Number is less than 0";
cout<<"\ntq";
Number is greater than 0
tq
Number is less than 0
tq
Number is greater than 0
tq
4.
FILL IN THE BLANK QUESTION
1 min • 1 pt
Fill in the blanks in the program segment below to complete the if statement that checks if a variable a is equal to 5.
int a=5;
if (a ______ 5)
{ cout<< "a is equal to 5"; }
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following control structure is implemented using if statement ?
Sequential
Selection
Looping
Function
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
If statement condition always written in ____ parenthesis.
{ }
( )
[ ]
//
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following expression can be used as condition with if statement?
Logical
Relational
Arithmetic
Logical & Relational
10 questions
C++ Array
Quiz
•
University
10 questions
Quiz 1
Quiz
•
University
9 questions
C++ Puntatori
Quiz
•
University
10 questions
Nested Statement
Quiz
•
University
12 questions
Quiz 9: Pointer
Quiz
•
University
10 questions
Quiz 3
Quiz
•
University
10 questions
FOP - CHAPTER 6
Quiz
•
University
13 questions
C programming-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