wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Bridge course with C

Total questions: 20

Worksheet time: 15mins

Name
Class
Date
1.

 Which of the following is true for variable names in C?

a)

. Variable names cannot start with a digit

b)

Variable can be of any length

c)

They can contain alphanumeric characters as well as special

characters

d)

Reserved Word can be used as variable name

2.

Which of the following cannot be a variable name in C?

a)

true

b)

friend

c)

export

d)

volatile

3.

Variable name resolving (number of significant characters for uniqueness of variable)  depends on?

a)

Compiler and linker implementations

b)

Assemblers and loaders implementations

c)

C Language

d)

None

4.

Which of the following is not a derived data type in c?

a)

Function

b)

Pointer

c)

Enumeration

d)

Array

5.

Integral data type is ____?

a)

Void

b)

Char

c)

Float

d)

Double

6.

Which among the following is the odd one out?

a)

printf

b)

fprintf

c)

putchar

d)

scanf

7.

For a typical program, the input is taken using _________

a)

scanf

b)

Files

c)

Command-line

d)

All of the mentioned

8.

Which of the following is not a compound assignment operator?

a)

/=

b)

+=

c)

%=

d)

==

9.

 p++ executes faster than p + 1 since

a)

P uses registers

b)

Single machine instruction required for p++

c)

Option a and b

d)

None

10.
a)

Syntax error in declaration of a

b)

No errors, program will show the output 5

c)

Redeclaration of a in same scope throws error

d)

a is out of scope when printf is called

11.

What is the output of the following program?

#include <stdio.h>

int main()

{

static int a = 3;

printf(“%d”, a --);

return 0;

}

a)

0

b)

1

c)

2

d)

3

12.

What is the output of this C code?   

  int main()

    {

        int i = 5;

        int l = i / -4;   

      int k = i % -4;     

    printf("%d %d\n", l, k);   

      return 0;

    }

a)

Compile time error

b)

-1  1

c)

1 -1

d)

Run time error

13.

What will be the output of the program ?

#include<stdio.h>

int main()

{

    float a=3.15529;

    printf("%2.1f\n", a);

    return 0;

}

a)

3.00

b)

3.15

c)

3.2

d)

3

14.

What will be the output of the program if value 25 given to scanf()?

#include<stdio.h>

int main()

{

    int i;

    printf("%d\n", scanf("%d", &i));

    return 0;

}

a)

25

b)

2

c)

1

d)

5

15.

Which statement will you add in the following program to work it correctly?

#include<stdio.h>

int main()

{

    printf("%f\n", log(36.0));

    return 0;

}

a)

#include<conio.h>

b)

#include<math.h>

c)

#include<stdlib.h>

d)

#include<dos.h>

16.

What will be the output of the program?

#include<stdio.h>

int main()

{

    float a=0.7;

    if(a < 0.7)

        printf("C\n");

    else

        printf("C++\n");

    return 0;

}

a)

C

b)

C++

c)

Compiler error

d)

none of the above

17.

18.  What will be the output of the program?

#include<stdio.h>

#include<math.h>

int main()

{

    printf("%f\n", sqrt(36.0));

    return 0;

}

a)

6.0

b)

6

c)

6.000000

d)

Error: Prototype sqrt() not found.

18.

Point out the error in the program?

#include<stdio.h>

int main()

{

    char ch;

    int i;

    scanf("%c", &i);

    scanf("%d", &ch);

    printf("%c %d", ch, i);

    return 0;

}

a)

Error: suspicious char to in conversion in scanf()

b)

Error: we may not get input for second scanf() statement

c)

No error

d)

None of above

19.

What will be the output of the program ?

#include<stdio.h>

int main()

{

    int a=250;

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

    return 0;

}

a)

1250

b)

2

c)

50

d)

250

20.

A programA program is made up of individual syntactic elements, called is made up of individual syntactic elements, called

a)

Classes

b)

Functions

c)

Tokens

d)

None of them