Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

CSE C Section

Total questions: 20

Worksheet time: 3mins

Name
Class
Date
1.

Who is the father of C language?

a)

Steve Jobs

b)

James Gosling

c)

Dennis Ritchie

d)

Rasmus Lerdorf

2.

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

a)

int number;

b)

float rate;

c)

int variable_count;

d)

int $main;

3.

All keywords in C are in

a)

LowerCase letters

b)

UpperCase letters

c)

CamelCase letters

d)

None of the mentioned

4.

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;

5.

What is short int in C programming?

a)

The basic data type of C

b)

Qualifier

c)

Short is the qualifier and int is the basic data type

d)

All of the mentioned

6.

What is the result of logical or relational expression in C?

a)

True or False

b)

0 or 1

c)

0 if an expression is false and any positive number if an expression is true

d)

None of the mentioned

7.

What is an example of iteration in C?

a)

for

b)

while

c)

do-while

d)

all of the mentioned

8.

Functions can return enumeration constants in C?

a)

true

b)

false

c)

depends on the compiler

d)

depends on the standard

9.

Functions in C Language are always

a)

Internal

b)

External

c)

Both Internal and External

d)

External and Internal are not valid terms for functions

10.

scanf() is a predefined function in______header file.

a)

stdlib. h

b)

ctype. h

c)

stdio. h

d)

stdarg. h

11.

Which program outputs "Hello World.." .?

a)

main() { scanf("Hello World.."); }

b)

main() { printf("Hello World.."); }

c)

main() { print("Hello World.."); }

d)

main() { scan("Hello World.."); }

12.

What will be the output of the following C function?

  1. #include <stdio.h>

  2. enum birds {SPARROW, PEACOCK, PARROT};

  3. enum animals {TIGER = 8, LION, RABBIT, ZEBRA};

  4. int main()

  5. {

  6. enum birds m = TIGER;

  7. int k;

  8. k = m;

  9. printf("%d\n", k);

  10. return 0;

  11. }

a)

0

b)

Compile time error

c)

1

d)

8

13.

What will be the output of the following C code?

  1. #include <stdio.h>

  2. int const print()

  3. {

  4. printf("Sanfoundry.com");

  5. return 0;

  6. }

  7. void main()

  8. {

  9. print();

  10. }

a)

Error because function name cannot be preceded by const

c)

Sanfoundry.com is printed infinite times

d)

Blank screen, no output

14.

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

  1. #include <stdio.h>

  2. void main()

  3. {

  4. int x = 5 * 9 / 3 + 9;

  5. }

a)

3.75

b)

Depends on compiler

c)

24

d)

3

15.

What will be the output of the following C code? (Initial values: x= 7, y = 8)

  1. #include <stdio.h>

  2. void main()

  3. {

  4. float x;

  5. int y;

  6. printf("enter two numbers \n");

  7. scanf("%f %f", &x, &y);

  8. printf("%f, %d", x, y);

  9. }

a)

7.000000, 7

b)

Run time error

c)

7.000000, junk

d)

Varies

16.

Comment on the following C statement.

n = 1;

printf("%d, %dn", 3*n, n++);

a)

Output will be 3, 2

b)

Output will be 3, 1

c)

Output will be 6, 1

d)

Output is compiler dependent

17.

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

  1. #include <stdio.h>

  2. int main()

  3. {

  4. int i = 0;

  5. while (i < 3)

  6. i++;

  7. printf("In while loop\n");

  8. }

a)

2

b)

3

c)

4

d)

1

18.

Which of the following sequences are unaccepted in C language?

a)

#if

#else

#endif

b)

#if

#elif

#endif

c)

#if

#if

#endif

d)

#if

#undef

#endif

19.

What will this program print?

  1. main()  

  2. {  

  3.   int i = 2;  

  4.   {  

  5.     int i = 4, j = 5;  

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

  7.   }    

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

  9. }  

a)
  1. 4525

b)
  1. 2525

c)

4545

d)
  1. None of the these

20.

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

  1. If ((a > b) && (a <= c))  

  2.         a = a + 1;  

  3. else  

  4.         c = c+1;  

a)
  1. a = 10, c = 10

b)
  1. a = 11, c = 10

c)
  1. a = 10, c = 11

d)
  1. a = 11, c = 11