wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

C Questions for BCA & BSc

Total questions: 30

Worksheet time: 10mins

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("BCA");

main();

}

a)

Wrong statement

b)

It will keep on printing BCA

c)

It will print BCA 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.

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

11.

The switch statement takes a given integer value then seeks a matching value among a number of _______ statements.

a)

break

b)

case

c)

switch

d)

goto

12.

How many loops are there in C

a)

1

b)

3

c)

2

d)

4

13.

Which of the following is an exit control statement

a)

for

b)

while

c)

do while

d)

continue

14.

The value of i after the execution of the following segment is

i = 2;

for( i=0; i>10; i=i+1);

a)

1

b)

2

c)

0

d)

11

15.

C language developed at _____?

a)

AT & T's Bell Laboratories of USA in 1972

b)

AT & T's Bell Laboratories of USA in 1970

c)

Sun Microsystems in 1973

d)

Cambridge University in 1972

16.

Which of the following is not a correct variable type?

a)

float

b)

real

c)

int

d)

double

17.

int x = 10;


int main()

{

int x = 0;

printf("%d",x);

return 0;

}

a)

10

b)

0

c)

compile error

d)

undefined

18.

To print out 'a' as an integer and 'b' as a floating, 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)

19.

When does the code block following while(x<100) execute?

a)

When x is less than one hundred

b)

When x is greater than one hundred

c)

When x is equal to one hundred

d)

while it wishes

20.
In which order do the following gets evaluated
1.Relational
2.Arithmetic
3.Logical
4.Assignment
a)
2134
b)
1234
c)
4321
d)
3214
21.
The keyword used to transfer control from a function back to the calling function is
a)
switch
b)
goto
c)
go back
d)
return
22.

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.

23.

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

24.

A name having a few letters, numbers and special character _(underscore) is called

a)

keywords

b)

reserved keywords

c)

tokens

d)

identifiers

25.

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

a)

int a3;

b)

int 3a;

c)

int _A3;

d)

int a_3

26.

What will be the output of the following C code?

#include <stdio.h>

int main()

{

int a,b,c;

a=5;

b=a++;

c=++a;

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

printf("%d\n", c);

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

}

a)

5 6 7

b)

5 7 7

c)

6 6 7

d)

6 7 7

27.

Identify the output of the program

a)

3, 3, 3

b)

2, 2, 3

c)

4, 2, 3

d)

2, 3, 3

28.

Which of the following is more appropriate for reading in a multi-word string?

a)

scanf()

b)

printf()

c)

puts()

d)

gets()

29.

A single line comment line in a C Language source code can begin with

a)

;

b)

:

c)

//

d)

/*

30.

Collection of Heterogeneous Data is called

a)

Array

b)

Pointer

c)

Structures and Union

d)

Data Type