Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

PPS Quiz 2

Total questions: 48

Worksheet time: 25mins

Name
Class
Date
1.

Computer Language ...

a)

is a form of symbolic language that must be translated to machine language

b)

are used to code or program a system or software in the computer.

c)

is a primary language that understood by the computer.

2.

Compilation also can be known as a translation process that convert other languages to

a)

Computer Language

b)

Assembly Language

c)

Machine Language

d)

High-Level Language

3.

__________ is a group of instructions that perform a specific task

a)

Function

b)

Standard instruction

c)

Identifiers

d)

Reserved word

4.

What is the output of C Program.?

int main()

{

int a=25;

while(a <= 27)

{

printf("%d ", a);

a++;

}

return 0;

}

a)

25 25 25

b)

25 26 27

c)

27 27 27

d)

Compiler error

5.

Choose a correct C for loop syntax.

a)

for(initalization; condition; incrementoperation) { //statements }

b)

for(declaration; condition; incrementoperation) { //statements }

c)

for(declaration; incrementoperation; condition) { //statements }

d)

for(initalization; condition; incrementoperation;) { //statements }

6.

Who is Father of C Language

a)

Bjarne Stroustrup

b)

James A. Gosling

c)

Dennis Ritchie

d)

Dr. E.F. Codd

7.
If the two strings are identical, then strcmp() function returns
a)
-1
b)
1
c)
0
d)
yes
8.
How will you print \n on the screen?
a)
printf("\n");
b)
echo "\\n";
c)
printf('\n');
d)
printf("\\n");
9.

Which of the following is the boolean operator for logical-AND?

a)

&

b)

&&

c)

|

d)

||

10.

Diamond shaped symbol is used in flowcharts to show the-

a)

decision box

b)

statement box

c)

error box

d)

if-statement box

11.

What is the output of C Program.?

int main()

{

int a=32;

do

{

printf("%d ", a);

a++;

}

while(a <= 30);

return 0;

}

a)

32

b)

33

c)

30

d)

No Output

12.

Choose correct Syntax for C Arithmetic Compound Assignment Operators.

a)

a+=b is (a= a+ b)

a-=b is (a= a-b)

b)

a*=b is (a=a*b)

a/=b is (a = a/b)

c)

a%=b is (a=a%b)

d)

All the above.

13.

int main()


{


int a = 10, b = 25;


a = b++ + a++;


b = ++b + ++a;


printf("%d %d n", a, b);


}

a)

36 64

b)

35 62

c)

36 63

d)

30 28

14.

#include<stdio.h>

int main()

{

char arr[11]="The African Queen";

printf("%s",arr);

}

a)

The African Queen

b)

The

c)

The African

d)

Compilation error

15.

Predict output of following program

int main(){

int i;

int arr[5] = {1};

for (i = 0; i < 5; i++)

printf("%d ", arr[i]);

return 0;

}

a)

1 1 1 1 1

b)

1 followed by 4 junk values

c)

1 0 0 0 0

d)

Compiler error

16.

a=2;b=6; (a<b):10:15

a)

10

b)

15

c)

2

d)

6

17.

Equivalent of switch statement

a)

If

b)

if-else

c)

elseif ladder

d)

while

18.

What is output of below program?


int main()

{

int i,j,count;

count=0;

for(i=0; i<5; i++);

{

for(j=0;j<5;j++);

{

count++;

}

}

printf("%d",count);

}

a)

55

b)

54

c)

1

d)

0

19.

Which one of the following is a loop construct that will always be executed once?

a)

for

b)

while

c)

switch

d)

do while

20.

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

21.

Choose a right C Statement.

a)

Loops or Repetition block executes a group of statements repeatedly.

b)

Loop is usually executed as long as a condition is met.

c)

Loops usually take advantage of Loop Counter

d)

All the above.

22.

What is the output of C Program.?

int main()

{

int a=5;

while(a >= 3);

{

printf("RABBIT\n");

break;

}

printf("GREEN");

return 0;

}

a)

GREEN

b)

RABBIT GREEN

c)

RABBIT is printed infinite times

d)

None of the above

23.

What is the output of C Program.?

int main()

{

int a=32;

do

{

printf("%d ", a);

a++;

if(a > 35)

break;

}

while(1);

return 0;

}

a)

No Output

b)

32 33 34

c)

32 33 34 35

d)

Compiler error

24.

What is the output of C Program.?

int main()

{

int k;

for(printf("FLOWER "); printf("YELLOW "); printf("FRUITS "))

{

break;

} return 0;

}

a)

Compiler error

b)

FLOWER FRUITS

c)

FLOWER YELLOW

d)

FLOWER YELLOW FRUITS

25.

To print out 'a' as an integer and 'b' as a decimal, which of the following printf() statement will you use?

a)

printf("%f %lf", a, b)

b)

printf("%f %f", a, b)

c)

printf("%d %f", a, b)

d)

printf("%f %d", a, b)

26.

Which of the following is not logical operator?

a)

&

b)

&&

c)

||

d)

!

27.

Which of the following is not a correct variable type?

a)

int

b)

real

c)

float

d)

char

28.

Which of the following is the correct operator to compare two variables?

a)

equal

b)

=

c)

:=

d)

==

29.

What is the only function all C programs must contain?

a)

start()

b)

system()

c)

main()

d)

Program()

30.

The "\n" character does which of the following operations?

a)

Double line spacing

b)

Character deletion

c)

Character backspace

d)

Places cursor on the next line

31.

C programs are converted into machine language with the help of

a)

An Editor

b)

A compiler

c)

An operating system

d)

None of these.

32.

What will be the output of the following C code?

#include <stdio.h>

void main()

{

int x = 5;

if (x < 1)

printf("hello");

if (x == 5)

printf("hi");

else

printf("no");

}

a)

hi

b)

hello

c)

no

d)

error

33.

How many loops are there in C

a)

1

b)

3

c)

2

d)

4

34.

Which of the following is an exit control statement

a)

for

b)

while

c)

do while

d)

continue

35.

Every C Program Statement must be terminated with a

a)

.

b)

#

c)

;

d)

!

36.

What is output of below program?

void main()

{

const int a = 10;

printf("%d",++a);

}

a)

11

b)

10

c)

Compilation Error

d)

0

37.

What is the only thing that computers understand?

a)

Machine Code

b)

Low Level Language

c)

High Level Language

d)

Algorithm

38.

Java, Python, PHP, and C++ are examples of

a)

low level languages

b)

Graphic arts languages

c)

medium level languages

d)

high level languages

39.

What is machine code?

a)

A programming language that a computer understands

b)

The make and model of a computer

c)

The serial number of a computer

40.
What is the correct definition of an algorithm?
a)
An algorithm is a step by step instructions to solve a problem.
b)
An algorithm is a process of baking bread.
c)
An algorithm is a software used to compute numbers.
d)
An algorithm is the process of breaking problems.
41.
What is a flowchart?
a)
A textual representation of algorithms.
b)
A graphical representation of algorithms.
c)
A cluster of different shapes.
d)
A program code written in Logo.
42.

Which of these is the set of rules that must be followed when typing code using a programming language?

a)

Syntax

b)

Value

c)

Expression

d)

Statement

43.

The Unary operator is -----------------------------

a)

>>

b)

++

c)

<<

d)

==

44.

Case label in switch() should not be -----------------------

a)

floating point

b)

integer

c)

long integer

d)

all above

45.

Every switch() statement should have one ------------- label

a)

default

b)

while

c)

for

d)

all above

46.

---------------- statement should be the last statement in each case in switch() statement

a)

break()

b)

case

c)

goto

d)

until

47.

1 GB is equal to ------------

a)

1024KB

b)

1024 Byte

c)

1024MB

d)

1024 nano

48.

%f specifies ---------------- data type

a)

float

b)

int

c)

char

d)

string