NEW
Font size
WorksheetsTest 5 - 21SE2001 General Aptitude Training-Batch 6
Total questions: 60
Worksheet time: 36mins
Directives are translated by the
Pre-processor
Compiler
Linker
Editor
What will the result of 'num' variable after execution of the following statements?
int num = 58;
num % = 11;
3
5
8
11
What will the result of num1 variable after execution of the following statements?
int j = 1, num1 = 4;
while (++j <= 10)
{
num1++;
}
11
12
13
14
Give the following declarations and an assignment statement. Which one is equivalent to the expression str [4]?
char str[80];
char * p;
p = str;
p + 4
*p + 4
*(p + 4)
p[3]
What output is produced by the following segment of code:
for(int i = 0; i < 10; i++)
cout << i << " ";
0 1 2 3 4 5 6 7 8 9 10
0 1 2 3 4 5 6 7 8 9
1 2 3 4 5 6 7 8 9 10
1 2 3 4 5 6 7 8 9
Infinite Loop
True/False: For Loops can never be an infinite loop.
True
False
How many times will the shown for loop execute?
0
9
10
11
What does <= mean?
less than
greater than
less than or equal to
greater than or equal to
What is the only function all C++ programs must contain?
cout()
system()
main()
program()
What punctuation is used to signal the beginning and end of code blocks?
{ }
//
BEGIN and END
/* */
Which of the following is a correct comment?
*/ Comments */
** Comment **
/* Comment */
{ Comment }
Which command moves the shown text to the next line?
\t
\n
\r
/n
After running the following code, what will be the value of x?
y = 3;
x = 5 * (++y);
15
5
15
20
Do while loops
Runs a statement once
Runs a statement twice
Runs a statement multiple times or not within a boolean condition
Doesn't run at all
Switch Statement
Is a statement with a set of conditions called cases
Is a case
Is a condition with no cases
Is a boolean statement
Voids
A statement that returns a value
A statement that doesn't return a value
A function that return a value
A function that doesn't return a value
iostream
Displays output from the screen and input from the keyboard
Has all the math equations
Counts the time
Checks if the code has a function
Cpp Compiler converts source code in
.cpp file
.obj file
.exe file
.lnk file
In a class the access specifiers are _______ by default:
Private
Protected
Public
What is the difference when allocating the following memory?
int array1[15];
int array2[3][5];
array1 is larger
array2 is larger
The size allocated is the same
Which one is NOT the keywords for data type?
bool
loop
double
char
Who is the first computer programmer?
Ada locvelance
Martin
Niklaus Wirth
James Gasing
What is the function of endl ?
print statement
erase line
create new line
store value
Which one is the example of the data types int?
A
28.02
19
aliya@yahoo.com
What is the function of % operator?
add
devide
substract
remainder
What is the output for this program?
5
0
20
3
What is the output for this program?
1
2
3
5
Which relational operator use to check the value of two variables equal or not?
<=
==
>=
>
What is the output of this program?
Welcome Ali.
Enjoy your Day.
Welcome Ali.
Enjoy your day.
Welcome Ali.Enjoy your day.
What is the output of this program?
You get A.
You get B.
You get C.
You get A.
You get B.
You get C.
Ali buy 4 books. How many vouchers he will get?
0
1
2
3
"0" is a ___?
double
int
string
None of the above
0.0 is a ___?
double
int
int
None of the above
How do we print the number 75 to our screen?
cout << 75
cout 75;
cout(75);
cout << 75;
What is the correct way to comment in C++ programming?
//
#
<!--->
All of the above
Which part of the following code is ignored by the computer?
cout << "Comments";
// print the output
Both
None
What is the output of the following code?
Good Morning
Good Morning5
5
Error
Which of the following is the correct value for the test variable?
19
19.5
"nineteen"
"19"
What's the output of this code?
power_level over power_level
power_level over 9000
9000 over 9000
9000 over power_level
What's the output of this code?
25.5
25.5
66.6
535.259
66.6
535.259
What's the output of this code?
Number is number
Number is 18
Number is
18
Error
What's the output of this code?
London\nis beautiful
London is beautiful
London
is beautiful
Londonis beautiful
Which of the following statements is correct?
char letter = "a";
char letter = 'a';
char letter = 'ab';
char letter = 5.6;
What output is produced by the following segment of code:
for(int i = 0; i < 10; i++)
cout << i << " ";
0 1 2 3 4 5 6 7 8 9 10
0 1 2 3 4 5 6 7 8 9
1 2 3 4 5 6 7 8 9 10
1 2 3 4 5 6 7 8 9
Infinite Loop
What output is produced by the following segment of code:
for(int i = 0; i <= 10; i++)
cout << i << " ";
0 1 2 3 4 5 6 7 8 9 10
0 1 2 3 4 5 6 7 8 9
1 2 3 4 5 6 7 8 9 10
1 2 3 4 5 6 7 8 9
Infinite Loop
What output is produced by the following segment of code:
for(int i = 1; i <= 10; i++)
cout << i << " ";
0 1 2 3 4 5 6 7 8 9 10
0 1 2 3 4 5 6 7 8 9
1 2 3 4 5 6 7 8 9 10
1 2 3 4 5 6 7 8 9
Infinite Loop
What output is produced by the following segment of code:
for(int fun = 20; fun > 1; fun -=3)
cout << fun << " ";
20 17 14 11 8 5 2 -1
20 17 14 11 8 5 2
17 14 11 8 5 2 -1
20 17 14 11 8 5
Infinite Loop
What output is produced by the following segment of code:
int start = 5;
int end = 20;
for(; start <= end; start +=2)
cout << start << " ";
5 7 9 11 13 15 17 19 21
7 9 11 13 15 17 19 20
7 9 11 13 15 17 19 21
5 7 9 11 13 15 17 19
Infinite Loop
True/False: For Loops can never be an infinite loop.
True
False
Waluigi is my Spirit Animal
Mr. G didn't feel like deleting the two extra options
How many times will the shown for loop execute?
0
9
10
11
What does <= mean?
less than
greater than
less than or equal to
greater than or equal to
What is the only function all C++ programs must contain?
start()
system()
main()
program()
What punctuation is used to signal the beginning and end of code blocks?
{ }
-> and <-
BEGIN and END
( and )
Which of the following is a correct comment?
*/ Comments */
** Comment **
/* Comment */
{ Comment }
What does <= mean?
less than
greater than
less than or equal to
greater than or equal to
y = 3;
x = 5 * y;
