wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

C Programming

Total questions: 10

Worksheet time: 30mins

Name
Class
Date
1.

What is the 16-bit compiler allowable range for integer constants?

a)

-3.4e38 to 3.4e38

b)

-32767 to 32768

c)

-32668 to 32667

d)

-32768 to 32767

2.

What will happen when the following code is executed?

void main()

{

printf("MIET");

main();

}

a)

Wrong statement

b)

It will keep on printing MIET

c)

It will print MIET once

d)

None of these

3.

What is the result after execution of the following code if a is 10, b is 5, and c is 10?

if ((a > b) && (a <= c))

a = a + 1;

else

c = c+1;

a)

a = 10, c = 10

b)

a = 11, c = 10

c)

a = 10, c = 11

d)

a = 11, c = 11

4.

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

a)

for

b)

while

c)

switch

d)

do while

5.

Directives are translated by the

a)

Pre-processor

b)

Compiler

c)

Linker

d)

Editor

6.

Which of the following will copy the null-terminated string that is in array src into array dest?

a)

dest = src;

b)

dest == src;

c)

strcpy(dest, src);

d)

strcpy(src, dest);

7.

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

8.

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

9.

What will be the output of the following code?

#include <stdio.h>

int main()

{

int *ptr, a = 10;

ptr = &a;

*ptr += 1;

printf("%d,%d/n", *ptr, a);

}

a)

10, 10

b)

10, 11

c)

11, 10

d)

11, 11

10.

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]