wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Test 5 - 21SE2001 General Aptitude Training-Batch 6

Total questions: 60

Worksheet time: 36mins

Name
Class
Date
1.

Directives are translated by the

a)

Pre-processor

b)

Compiler

c)

Linker

d)

Editor

2.

What will the result of 'num' variable after execution of the following statements?

int num = 58;

num % = 11;

a)

3

b)

5

c)

8

d)

11

3.

What will the result of num1 variable after execution of the following statements?

int j = 1, num1 = 4;

while (++j <= 10)

{

num1++;

}

a)

11

b)

12

c)

13

d)

14

4.

Give the following declarations and an assignment statement. Which one is equivalent to the expression str [4]?

char str[80];

char * p;

p = str;

a)

p + 4

b)

*p + 4

c)

*(p + 4)

d)

p[3]

5.

What output is produced by the following segment of code:


for(int i = 0; i < 10; i++)

cout << i << " ";

a)

0 1 2 3 4 5 6 7 8 9 10

b)

0 1 2 3 4 5 6 7 8 9

c)

1 2 3 4 5 6 7 8 9 10

d)

1 2 3 4 5 6 7 8 9

e)

Infinite Loop

6.

True/False: For Loops can never be an infinite loop.

a)

True

b)

False

7.

How many times will the shown for loop execute?

a)

0

b)

9

c)

10

d)

11

8.

What does <= mean?

a)

less than

b)

greater than

c)

less than or equal to

d)

greater than or equal to

9.

What is the only function all C++ programs must contain?

a)

cout()

b)

system()

c)

main()

d)

program()

10.

What punctuation is used to signal the beginning and end of code blocks?

a)

{ }

b)

//

c)

BEGIN and END

d)

/* */

11.

Which of the following is a correct comment?

a)

*/ Comments */

b)

** Comment **

c)

/* Comment */

d)

{ Comment }

12.

Which command moves the shown text to the next line?

a)

\t

b)

\n

c)

\r

d)

/n

13.

After running the following code, what will be the value of x?

y = 3;

x = 5 * (++y);

a)

15

b)

5

c)

15

d)

20

14.

Do while loops

a)

Runs a statement once

b)

Runs a statement twice

c)

Runs a statement multiple times or not within a boolean condition

d)

Doesn't run at all

15.

Switch Statement

a)

Is a statement with a set of conditions called cases

b)

Is a case

c)

Is a condition with no cases

d)

Is a boolean statement

16.

Voids

a)

A statement that returns a value

b)

A statement that doesn't return a value

c)

A function that return a value

d)

A function that doesn't return a value

17.

iostream

a)

Displays output from the screen and input from the keyboard

b)

Has all the math equations

c)

Counts the time

d)

Checks if the code has a function

18.

Cpp Compiler converts source code in

a)

.cpp file

b)

.obj file

c)

.exe file

d)

.lnk file

19.

In a class the access specifiers are _______ by default:

a)

Private

b)

Protected

c)

Public

20.

What is the difference when allocating the following memory?

int array1[15];

int array2[3][5];

a)

array1 is larger

b)

array2 is larger

c)

The size allocated is the same

21.

Which one is NOT the keywords for data type?

a)

bool

b)

loop

c)

double

d)

char

22.

Who is the first computer programmer?

a)

Ada locvelance

b)

Martin

c)

Niklaus Wirth

d)

James Gasing

23.

What is the function of endl ?

a)

print statement

b)

erase line

c)

create new line

d)

store value

24.

Which one is the example of the data types int?

a)

A

b)

28.02

c)

19

d)

aliya@yahoo.com

25.

What is the function of % operator?

a)

add

b)

devide

c)

substract

d)

remainder

26.

What is the output for this program?

a)

5

b)

0

c)

20

d)

3

27.

What is the output for this program?

a)

1

b)

2

c)

3

d)

5

28.

Which relational operator use to check the value of two variables equal or not?

a)

<=

b)

==

c)

>=

d)

>

29.

What is the output of this program?

a)

Welcome Ali.

Enjoy your Day.

b)

Welcome Ali.

c)

Enjoy your day.

d)

Welcome Ali.Enjoy your day.

30.

What is the output of this program?

a)

You get A.

b)

You get B.

c)

You get C.

d)

You get A.

You get B.

You get C.

31.

Ali buy 4 books. How many vouchers he will get?

a)

0

b)

1

c)

2

d)

3

32.

"0" is a ___?

a)

double

b)

int

c)

string

d)

None of the above

33.

0.0 is a ___?

a)

double

b)

int

c)

int

d)

None of the above

34.

How do we print the number 75 to our screen?

a)

cout << 75

b)

cout 75;

c)

cout(75);

d)

cout << 75;

35.

What is the correct way to comment in C++ programming?

a)

//

b)

#

c)

<!--->

d)

All of the above

36.

Which part of the following code is ignored by the computer?

a)

cout << "Comments";

b)

// print the output

c)

Both

d)

None

37.

What is the output of the following code?

a)

Good Morning

b)

Good Morning5

c)

5

d)

Error

38.

Which of the following is the correct value for the test variable?

a)

19

b)

19.5

c)

"nineteen"

d)

"19"

39.

What's the output of this code?

a)

power_level over power_level

b)

power_level over 9000

c)

9000 over 9000

d)

9000 over power_level

40.

What's the output of this code?

a)

25.5

b)

25.5

66.6

535.259

c)

66.6

d)

535.259

41.

What's the output of this code?

a)

Number is number

b)

Number is 18

c)

Number is

18

d)

Error

42.

What's the output of this code?

a)

London\nis beautiful

b)

London is beautiful

c)

London

is beautiful

d)

Londonis beautiful

43.

Which of the following statements is correct?

a)

char letter = "a";

b)

char letter = 'a';

c)

char letter = 'ab';

d)

char letter = 5.6;

44.

What output is produced by the following segment of code:


for(int i = 0; i < 10; i++)

cout << i << " ";

a)

0 1 2 3 4 5 6 7 8 9 10

b)

0 1 2 3 4 5 6 7 8 9

c)

1 2 3 4 5 6 7 8 9 10

d)

1 2 3 4 5 6 7 8 9

e)

Infinite Loop

45.

What output is produced by the following segment of code:


for(int i = 0; i <= 10; i++)

cout << i << " ";

a)

0 1 2 3 4 5 6 7 8 9 10

b)

0 1 2 3 4 5 6 7 8 9

c)

1 2 3 4 5 6 7 8 9 10

d)

1 2 3 4 5 6 7 8 9

e)

Infinite Loop

46.

What output is produced by the following segment of code:


for(int i = 1; i <= 10; i++)

cout << i << " ";

a)

0 1 2 3 4 5 6 7 8 9 10

b)

0 1 2 3 4 5 6 7 8 9

c)

1 2 3 4 5 6 7 8 9 10

d)

1 2 3 4 5 6 7 8 9

e)

Infinite Loop

47.

What output is produced by the following segment of code:


for(int fun = 20; fun > 1; fun -=3)

cout << fun << " ";

a)

20 17 14 11 8 5 2 -1

b)

20 17 14 11 8 5 2

c)

17 14 11 8 5 2 -1

d)

20 17 14 11 8 5

e)

Infinite Loop

48.

What output is produced by the following segment of code:


int start = 5;

int end = 20;

for(; start <= end; start +=2)

cout << start << " ";

a)

5 7 9 11 13 15 17 19 21

b)

7 9 11 13 15 17 19 20

c)

7 9 11 13 15 17 19 21

d)

5 7 9 11 13 15 17 19

e)

Infinite Loop

49.

True/False: For Loops can never be an infinite loop.

a)

True

b)

False

c)

Waluigi is my Spirit Animal

d)

Mr. G didn't feel like deleting the two extra options

50.

How many times will the shown for loop execute?

a)

0

b)

9

c)

10

d)

11

51.
The process of creating a new variable without value
a)
declaration
b)
naming
c)
instantiation
d)
assigning
52.

What does <= mean?

a)

less than

b)

greater than

c)

less than or equal to

d)

greater than or equal to

53.

What is the only function all C++ programs must contain?

a)

start()

b)

system()

c)

main()

d)

program()

54.

What punctuation is used to signal the beginning and end of code blocks?

a)

{ }

b)

-> and <-

c)

BEGIN and END

d)

( and )

55.

Which of the following is a correct comment?

a)

*/ Comments */

b)

** Comment **

c)

/* Comment */

d)

{ Comment }

56.
The process of creating a new variable without value
a)
declaration
b)
naming
c)
instantiation
d)
assigning
57.

What does <= mean?

a)

less than

b)

greater than

c)

less than or equal to

d)

greater than or equal to

58.
A list of instructions that enable a computer to perform a specific task is a...
a)
Computer Program
b)
Algorithm
c)
Machine Code
d)
Binary Code
59.
Which command moves the shown text to the next line?
a)
\t
b)
\n
c)
\r
d)
\s
60.
After running the following code, what will be the value of x?
y = 3;
x = 5 * y;
a)
3
b)
5
c)
15
d)
0