wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

C programming_Shivank

Total questions: 20

Worksheet time: 25mins

Name
Class
Date
1.

What is the minimum number of functions to be present in a C Program.?

a)

1

b)

2

c)

3

d)

4

2.

What is the Priority among (*, /, %), (+, -) and (=) C Operators.?

a)

(*, /, %) >  (+, -) < (=)

b)

(*, /, %) <  (+, -) < (=)

c)

(*, /, %) >  (+, -) > (=)

d)

(*, /, %) <  (+, -)

3.

What is the output of the C statement.?

int main()

{

int a=0;

a = 4 + 4/2*5 + 20;

printf("%d", a);

return 0;

}

a)

40

b)

4

c)

34

d)

54

4.

Choose correct C while loop syntax.

a)

while(condition) { //statements }

b)

{ //statements }while(condition)

c)

while(condition); { //statements }

d)

while() { if(condition) { //statements } }

5.

What is the output of C Program.?

int main()

{

while(true)

{

printf("RABBIT");

break;

}

return 0;

}

a)

RABBIT

b)

RABBIT is printed unlimited number of times.

c)

No output

d)

Compiler error.

6.

What is the output of C Program.?

int main()

{

int a[];

a[4] = {1,2,3,4};

printf("%d", a[0]);

}

a)

1

b)

2

c)

4

d)

Compiler error

7.

What is the output of C program.?

int main()

{

int a[3] = {10,12,14};

int i=0;

while(i<3)

{

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

i++;

}

}

a)

14 12 10

b)

10 10 10

c)

10 12 14

d)

None of the above

8.

Which character is used to indicate the end of the string?

a)

(A) Any alphabet

b)

(B) A

c)

(C) Null

d)

(D) None of these

View Answer

9.

Which one is not a reserve keyword in C Language?

a)

auto

b)

main

c)

case

d)

register

10.

A pointer that is pointing to NOTHING is called ____

a)

VOID Pointer

b)

DANGLING Pointer

c)

NULL Pointer

d)

WILD Pointer

11.

In C language, FILE is of which data type?

a)

a) int

b)

b) char *

c)

c) struct

d)

d) None of the mentioned

12.

What is meant by ‘a’ in the following C operation?

fp = fopen("Random.txt", "a");

a)

a) Attach

b)

b) Append

c)

c) Apprehend

d)

d) Add

13.

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)

a) Compile time error

b)

b) Hello World! 34

c)

c) Hello World! 1000

d)

d) Hello World! followed by a junk value

14.

What will this program print?

main()  

{  

  int i = 2;  

  {  

    int i = 4, j = 5;  

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

  }    

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

a)

4525

b)

2525

c)

4545

d)

None of the these

15.

Study the following program:

main()  

{  

   char x [10], *ptr = x;  

  scanf ("%s", x);  

  change(&x[4]);  

}  

 change(char a[])  

 {  

   puts(a);  

 } 

If abcdefg is the input, the output will be

a)

abcd

b)

abc

c)

efg

d)

Garbage

16.

What is the difference between call by value and call by reference in c programming?

4 lines
17.

What are the differences between structures and union?

4 lines
18.

What is storage class.What are the different storage classes in C?

4 lines
19.

What is dynamic memory allocation?

4 lines
20.

Why is it necessary to give the size of an array in an array declaration ?

4 lines