wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

AQ Quiz 5

Total questions: 100

Worksheet time: 58mins

Name
Class
Date
1.

/* C program to check palindrome and check the input and output*/

#include <stdio.h>

int main()

{ int n, reverse = 0, temp;

printf("Enter a number you want to check\n");

scanf("%d",&n);

temp = n;

while( temp != 0 )

{ reverse = reverse * 10;

reverse = reverse + temp%10;

temp = temp/10;

} if ( n == reverse )

printf("%d is a palindrome number.\n", n);

else

printf("%d is not a palindrome number.\n", n);

return 0;

}

(a)  

2.
a)

SYNTAX ERROR

b)

LOGICAL ERROR

c)

RUNTIME ERROR

d)

ALL OF THE ABOVE

3.

a)

ERROR EXCEPTED COLON IN LINE11

b)

ERROR EXCEPTED SEMICOLON IN LINE11

c)

ERROR EXCEPTED COLON IN LINE12

d)

ERROR EXCEPTED SEMICOLON IN LINE12

4.

In which of the following cases the minimum no of insertions to form palindrome is maximum?

a)

string with all same characters

b)

string of length 1

c)

palindromic string

d)

non palindromic string

5.

In the worst case, the minimum no of insertions to be made to convert the string into a palindrome is equal to the length of the string

a)

TRUE

b)

FALSE

c)

NEITHER TRUE NOR FALSE

6.

What does the following function print for n = 25?

void fun(int n)

{

if (n == 0)

return;

printf("%d", n%2);

fun(n/2);

}

a)

11001

b)

10011

c)

11111

d)

00000

7.

What’s happen if base condition is not defined in recursion ?

a)

Stack underflow

b)

Stack Overflow

c)

None of these

d)

Both a and b

8.

Iteration requires more system memory than recursion.

a)

TRUE

b)

FALSE

c)

NONE OF THE ABOVE

d)

BOTH A AND B

9.

C program scenario based question to calculate electricity bill.

Write the algorithmic logic

(a)  

10.

WHICH OF THE FOLLOWING IS CORRECT

a)

Any number is said to be a palindrome if the original number and the reverse of the original number are the same.

b)

Any number is said to be a palindrome if the original number and the reverse of the original number are the not same.

c)

Any number is said to be a palindrome if the original number and the non reverse of the original number are the different.

d)

both a and c

11.

find the output of this program

a)

Logic Error

b)

Run time Error

c)

16

d)

14

12.

find the concept of the program

a)

sum of the different n number and logic error

b)

sum of the number and syntax error

c)

multiplication of n number logic error

d)

sum of the digit but logic error

13.

PREDICT THE OUTPUT OF THIS PROGRAM

a)

10

b)

20

c)

40

d)

30

14.

main() { int i = 2;

{ int i = 4, j = 5;

printf("%d %d", i, j);

}

printf("%d %d", i, j);

}

a)

2545

b)

4525

c)

2554

d)

4552

15.

How many times will the following loop execute?


for(j = 1; j <= 10; j = j-1)

a)

for ever

b)

10

c)

9

d)

error

16.

The format identifier ‘%i’ is also used for which data type?

a)

char

b)

int

c)

float

d)

double

17.

What is the size of an int data type?

a)

4 Bytes

b)

8 Bytes

c)

Depends on the system/compiler

d)

Cannot determine.

18.

Which is correct with respect to the size of the data types?

a)

char > int > float

b)

int > char > float

c)

char < int < double

d)

double > char > int

19.

What is the precedence of arithmetic operators (from highest to lowest)?

a)

%, *, /, +, –

b)

%, +, /, *, –

c)

+, -, %, *, /

d)

%, +, -, *, /

20.

Which of the following is a correct format for declaration of function?

a)

return-type (argument type)function-name;

b)

return-type function-name(argument type);

c)

return-type function-name(argument type) {}

d)

No idea!

21.

What is the default return type if it is not specified in function definition?

a)

void

b)

int

c)

double

d)

short int

22.

What are the different ways to initialize an array with all elements as zero?

a)

int array[5] = {};

b)

int array[5] = {0};

c)

int a=0, b=0, c=0; int array[5] = {a, b, c};

d)

All of the mentioned.

23.

How many times i value is checked in the following C code?

#include <stdio.h>

int main()

{ int i = 0;

  do {

   i++;

   printf("in while loop\n");

   } while (i < 3);  }

a)

2

b)

3

c)

4

d)

1

24.

Who is the father of C language?

a)

Steve Jobs

b)

James Gosling

c)

Dennis Ritchie

d)

Rasmus Lerdorf

25.

Which of the following is not a valid C variable name?

a)

int number;

b)

float rate;

c)

int variable_count;

d)

int $main;

26.

All keywords in C are in ____________

a)

LowerCase letters

b)

UpperCase letters

c)

CamelCase letters

d)

None of the mentioned

27.

Which is valid C expression?a) int my_num = 100,000;b) int my_num = 100000;c) int my num = 1000;d) int $my_num = 10000;

a)

int my_num = 100,000;

b)

int my_num = 100000;

c)

int my num = 1000;

d)

int $my_num = 10000;

28.

Which keyword is used to prevent any changes in the variable within a C program?

a)

immutable

b)

mutable

c)

const

d)

volatile

29.

What is an example of iteration in C?

a)

for

b)

while

c)

do-while

d)

all of the mentioned

30.

What is #include <stdio.h>?

a)

Preprocessor directive

b)

Inclusion directive

c)

File inclusion directive

d)

None of the above

31.

The C-preprocessors are specified with _________ symbol.

a)

#

b)

$

c)

%

d)

None of the above.

32.

The standard header _______ is used for variable list arguments (…) in C.

a)

<stdio.h >

b)

<stdlib.h>

c)

<math.h>

d)

<stdarg.h>

33.

What is the sizeof(char) in a 32-bit C compiler?

a)

1 bit

b)

2 bits

c)

1 Byte

d)

2 Bytes

34.

What will be the output of the following C code?

#include <stdio.h>

int main()

{

int y = 10000;

int y = 34;

printf("Hello World! %d\n", y);

return 0;

}

a)

Compile time error

b)

Hello World! 34

c)

Hello World! 1000

d)

Hello World! followed by a junk value

35.

What will be the final value of x in the following C code?

#include <stdio.h>

void main()

{

int x = 5 * 9 / 3 + 9;

}

a)

3.75

b)

Depends upon compiler

c)

24

d)

3

36.

What are the elements present in the array of the following C code?

int array[5] = {5};

a)

5, 5, 5, 5, 5

b)

5, 0, 0, 0, 0

c)

5, (garbage), (garbage), (garbage), (garbage)

d)

(garbage), (garbage), (garbage), (garbage), 5

37.

What are true about Array in C language.?

a)

A group of elements of same data type.

b)

An array contains more than one element

c)

Array elements are stored in memory in continuous or contiguous locations

d)

All the above.

38.

An array Index starts with.?

a)

-1

b)

0

c)

1

d)

2

39.

What is the output of the following code snippet?

int main()

{ int sum = 2 + 4 / 2 + 6 * 2;

printf("%d", sum);

return 0;

}

a)

2

b)

15

c)

16

d)

18

40.

What is the output of the following code?

#include <stdio.h>

int main()

{

    int i = 3;

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

    return 0;

}

a)

3

b)

4

c)

5

d)

Compile time error

41.

What is the output of this statement "printf("%d", (a++))"?

a)

The value of (a + 1)

b)

The current value of a

c)

Error message

d)

Garbage Value

42.

What does this declaration mean?

int x: 4;

a)

X is a four-digit integer.

b)

X cannot be greater than a four-digit integer.

c)

X is a four-bit integer.

d)

None of the these

43.

How many times will the following loop execute?

for(j = 1; j <= 10; j = j-1)  

a)

forever

b)

never

c)

0

d)

1

44.

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

a)

for

b)

while

c)

switch

d)

do-while

45.

How many characters can a string hold when declared as follows?

char name[20]:  

a)

19

b)

20

c)

Can't determine

d)

18

46.

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

47.

Let p1 be an integer pointer with a current value of 2000. What is the content of p1 after the expression p1++ has been evaluated?

a)

2001

b)

2002

c)

2004

d)

2008

48.

What will be the output of this program?

int main()      

{      

int a=10, b=20;        

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

a=a+b;      

b=a-b;      

a=a-b;      

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

return 0;    

}     

a)

a = 20, b = 20

b)

a = 10, b = 20

c)

a = 20, b = 10

d)

a = 10, b = 10

49.

What does this statement mean?

x - = y + 1;  

a)

x = x - y + 1

b)

x = -x - y - 1

c)

x = x + y - 1

d)

x = x - y - 1

50.

Array is a _________ data structure.

a)

Non-linear

b)

Primary

c)

Linear

d)

Non-primary

51.

Study the following statement

printf ("%d", 9/5);  

What will be the output of this statement?

a)

1.8

b)

1.2

c)

1.5

d)

None of the aove

52.

A global variable is declared __________.

a)

Outside of the function

b)

Inside of the function

c)

With the function

d)

Anywhere in the program

53.

Who defines the user-defined function?

a)

Computer

b)

compiler

c)

Users

d)

None

54.

The enum keyword is used to assign names to the ________ constants.

a)

Integer

b)

String

c)

Character

d)

All of the above

55.

Which of the following is not an arithmetic operation?

a)

x * = 65;

b)

x / = 42;

c)

x % = 2;

d)

x ! = 56;

56.

Which of the following operator is represented a relational operation?

a)

==

b)

++

c)

||

d)

&&

57.

Which of the following keyword is used for union in c language?

a)

un

b)

uni

c)

ion

d)

union

58.

Study the following program:

main ()  

{  

 char x;  

 x = 'A' + 5;  

 printf("%c", x);  

}  

a)

A+5

b)

A

c)

F

d)

E

59.

Which one of the following operators is a unary operator in c language?

a)

&

b)

&&

c)

<<

d)

sizeof()

60.

How many types of variables are there in the C language?

a)

2

b)

4

c)

5

d)

3

61.

Which level of a programming language is Machine Code?

a)

Low

b)

High

62.

Which level would create the fastest code to execute?

a)

Low

b)

Assembly

c)

High

63.

Which level would create the easiest code for humans to understand?

a)

Low

b)

Assembly

c)

High

64.
Machine Code uses mnemonics to represent instructions
a)
True
b)
False
65.
A disadvantage of programming in Low Level is
a)
No technical skill is required
b)
Needs to be translated before it can be executed
c)
Difficult for humans to debug
66.
An advantage of programming in High Level is
a)
Easier for us to understand
b)
Useful for device drivers
c)
Programs execute faster than other generations
67.
A disadvantage of programming in High Level is
a)
A lot of code must be translated before it can be executed
b)
Difficult to debug
c)
High level of technical skill is required
68.

Which generation?

a)

Machine Code - Low

b)

Assembly Code - Low

c)

High Level

69.

Computers must translate everything into binary

a)

True

b)

False

70.

High Level Code is easier for humans to understand as it is written in English

a)

True

b)

False

71.
A person who writes code and communicates instructions to a computer.
a)
Code
b)
Programmer
c)
Command
d)
Program
72.
Which generation of a programming language is Assembly Code?
a)
1st Generation (Low)
b)
2nd Generation (Low)
c)
3rd Generation (High)
73.

__________ is a series of instructions that directs a computer to perform tasks

a)

Programming language

b)

Programmer

c)

Program

d)

Programmed

74.
Example of First Generation Programming Language
a)
COBOL
b)
Machine Language
c)
C++
75.
When writing a computer program most program use...
a)
A High Level Language
b)
A Low Level Language
c)
A Machine Code
d)
An Algorithm 
76.
A language that requires no knowledge of the hardware or the instruction set of the computer is called...
a)
A High Level Language
b)
A Low Level Language
c)
Machine Code
d)
An Algorithm
77.
A language that is close to human language and which is easy to write, debug and maintain is known as...
a)
A High Level Language
b)
A Low Level Language
c)
An Algorithm
d)
Machine Code
78.
Resolving errors in a program is known as...
a)
Debugging
b)
Refixing
c)
Error Checking
d)
Problem Solving
79.
Which of the following is not a high level programming language?
a)
Assembly
b)
C++
c)
Java
d)
Python
80.
Languages that relate to the architecture and hardware of a specific computer are known as...
a)
High Level Languages
b)
Low Level Languages
c)
Simplex Languages
d)
Complex Languages
81.
What is the name for the software used to convert an assembly language program into machine code?
a)
Assembler
b)
Interpreter
c)
Compiler
d)
Translator
82.
The 3 main types of translators are...
a)
Assemblers, Compilers & Interpreters 
b)
Assemblers, Compilers & Converters 
c)
Assemblers, Scripters  & Interpreters 
d)
Converters, Scripters & Interpreters 
83.
Which type of translator creates an executable file of machine code from a program written in a high level language? 
a)
Compiler
b)
Assembler
c)
Interpreter
d)
Executor
84.
Software that translates and executes a high level language program one line at a time is known as a?
a)
Compiler
b)
Interpreter
c)
Assembler
d)
Executor
85.
Which type of translator is used to to create a machine code version of a HLL program prior to distribution to the public? 
a)
Compiler
b)
Interpreter
c)
Converter
d)
Assembler
86.
What is Assembly code?
a)
Another name for Pseudocode
b)
A programming language that uses mnemonic codes
c)
A program that joins pieces of code together
d)
Another name for machine code
87.
Which of these is NOT an example of a High Level Language?
a)
Python
b)
Java
c)
C++
d)
Avalon
88.
What is an interpreter?
a)
Converts source code one instruction at a time
b)
Converts source code between 2 HLLs
c)
Converts source code between HLL and Assembly
d)
Converts keyboard presses to an ASCII code
89.
What would you use to convert high-level source code to machine code?
a)
Linker
b)
Assembler
c)
Compiler
d)
IDE
90.

It is a computer program that links and merges various object files together in order to make an executable file.

a)

Assembler

b)

Compiler

c)

Linker

d)

Loader

91.

Loops in C Language are implemented using?

a)

While Block

b)

For Block

c)

Do While Block

d)

All the above

92.

Which loop is faster in C Language, for, while or Do While?

a)

for

b)

while

c)

do while

d)

All work at same speed

93.

If block always need to be associated with a else block?

a)

True

b)

False

94.

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

95.

The conditional operator are also known as

a)

Relational operator

b)

Binary operator

c)

Ternary operator

d)

Chary operator

96.

If you have to make decision based on multiple choices, which of the following is best suited?

a)

if

b)

if-else

c)

if-else-if

d)

All the above

97.

Can we use string inside switch statement?

a)

Yes

b)

No

98.

In situations where we need to execute body of the loop before testing the condition, we should use __________.

a)

for

b)

while

c)

do while

d)

nested for loop

99.

Choose a correct C Statement.

a)

a++ is (a=a+1) POST INCREMENT Operator

b)

a-- is (a=a-1) POST DECREMENT Opeartor

--a is (a=a-1) PRE DECREMENT Opeator

c)

++a is (a=a+1) PRE INCREMENT Operator

d)

All the above.

100.

What is the way to suddenly come out of or Quit any Loop in C Language.?

a)

continue; statement

b)

leave; statement

c)

break; statement

d)

quit; statement