wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

C Basic Data Types & Operators

Total questions: 110

Worksheet time: 6hrs 8mins

Name
Class
Date
1.
Examples of hardware include web browsers, games, and word processors.
a)
True
b)
False
2.

Who is know as founder of C language

a)

Dennis Ritchie

b)

Bjarne Stroustroup

c)

Tim Berner Lee

d)

Rasmus Ledorf

3.

Which of these is not a correct variable data type?

a)

int

b)

float

c)

real

d)

char

4.

C is a

a)

Low level language

b)

Assembly language

c)

Medium level language

d)

High level language

5.

Which punctuation ends most of the lines of C code?

a)

.

b)

;

c)

,

d)

" "

6.

The starting point of C execution at

a)

==

b)

main()

c)

function()

d)

!=

7.

Type four arithmetic operators sorting by their operation name *without space(like addition a first, so '+')

(a)  

8.

What do you think is the best way to enhance your skill in programming

a)

Study Hard

b)

Practice

c)

Practice and learn new

d)

Study one day and leave it

9.

Prewritten packages are imported to program by using which symbol

Hint: Header Files

a)

%

b)

-

c)

#

d)

//

10.

Find if the condition is True or False where int x=10; y=12;

x == y

a)

1 (True)

b)

0 (False)

11.

Find if the condition is True or False where int x=10; y=12;

x < y

a)

1 (True)

b)

0 (False)

12.

What do you think is the output for the below code snippet?

int main(){

int a=10,b=20;

printf("%d", b/a);

}

a)

Error

b)

0.2

c)

2

d)

30

13.

What do you need to import stdio.h a header file?

a)

Just a waste of time

b)

To run the code

c)

It helps in compilation to binary coded file

d)

To perform input and output operations

14.

Which of the following operator(s) is/are used for assigning a value?

a)

==

b)

=

c)

+=

d)

!=

15.

#include <stdio.h>

int main() {

int i = 0;

int j = i++ + i;

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

}

a)

0

b)

1

c)

2

d)

Compile time error

16.

printf is a

a)

function

b)

variable

c)

datatype

d)

operator

17.

#include <stdio.h>

int main()

{

int i = 2;

int j = ++i + i;

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

}

What is the output of the above program?

a)

4

b)

5

c)

6

d)

7

18.

#include <stdio.h>

int main()

{

int a = 2;

int b= a >> 1;

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

}

a)

0

b)

1

c)

2

d)

Compile time Error

19.

#include <stdio.h>

int main()

{

int a = 2;

int b= a << 1;

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

}

a)

1

b)

2

c)

3

d)

4

20.

#include <stdio.h>

int main()

{

int a = 2;

int b=11 ;

printf("%d\n", a+b*a);

}

a)

26

b)

24

c)

20

d)

None

21.

#include <stdio.h>

int main()

{

int a = 10, b = 5, c = 5;

int d;

d = b + a % c;

printf("%d", d);

}

a)

7

b)

5

c)

0

d)

Compile time error

22.

#include <stdio.h>

int main()

{

int a = 10, b = 5, c = 5;

int d;

printf("%d", a==(b+c)? 100 :-100);

}

a)

100

b)

-100

c)

Compile time error

d)

1

23.

Which of the following is false statement about C program?

a)

All valid C programs must contain the main() function.

b)

The code execution begins from the start of the main() function.

c)

To use printf() in our program, we need to include stdio.h header file using #inclue <stdio.h> statement.

d)

The printf() is a library function to read formatted input to the screen

24.

format specifier of a float number is

a)

%c

b)

%d

c)

%f

d)

%x

25.

int main ()


{


int x = 24, y = 39, z = 45;


z = x + y;


y = z - y;


x = z - y;


printf ("n%d %d %d", x, y, z);


}

a)

24 39 63

b)

39 24 63

c)

24 39 45

d)

39 24 45

26.

C Language is 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

27.

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.

28.

Which one of the following is not a valid identifier?

a)

_examveda

b)

1examveda

c)

exam_veda

d)

examveda1

29.

Which is the only function all C programs must contain?

a)

start()

b)

system()

c)

printf()

d)

main()

30.
What punctuation is used to indicate the beginning and end of code blocks?
a)
{ }
b)
-> <-
c)
BEGIN and END
d)
( and )
31.
How will you print \n on the screen?
a)
printf("\n");
b)
echo "\\n";
c)
printf('\n');
d)
printf("\\n");
32.
Which of the following is the correct operator to compare two variables?
a)
:=
b)
=
c)
equal
d)
==
33.
How to comment in C language?
a)
//Comment
b)
A & B
c)
* Comment *
d)
<---Comment---->
34.

Program is a list of_______________, written in a _______________________ to determines the behaviour of a machine.

a)

word, english

b)

instructions , programming language

c)

instructions, word

35.

A flowchart is a graphical representation that helps programmer to develop algorithms in programming.

a)

True

b)

False

36.

#include<stdio.h> is important line in c. The stdio.h contains information on input output routines.

a)

True

b)

False

37.

The operator "&" is used for

a)

Bitwise AND

b)

Bitwise OR

c)

Logical AND

d)

Logical OR

38.

The size of a character variable in C is

a)

8 bytes

b)

4 bytes

c)

2 bytes

d)

1 byte

39.

___ is used to translate source code instructions into the appropriate machine language instructions

a)

Module

b)

Library routine

c)

Compiler

d)

Preprocessor directives

40.

A ____ is a set of instructions that the computer follows to solve a problem.

a)

Comipler

b)

Linker

c)

Program

d)

Operator

41.

The program written by the programmer with high level language is called:

a)

Object Code

b)

Syntax

c)

Source Code

d)

Runtime Library

42.

What is the extension of C program source code?

a)

.cpp

b)

.py

c)

.c

d)

.java

43.

What is machine language?

a)

A language used by car

b)

Machine language is made of 1's and 0's

c)

Machine language is made of 7's and 8's

d)

A language that only understands plain English

44.

Which of the following is not a high level programming language?

a)

Assembly

b)

C++

c)

Java

d)

Python

45.

The words if, else, auto, float etc. have predefined meaning and users cannot use them as variables.


These words are called

a)

keywords

b)

identifier

c)

data types

d)

constant

46.

C language is a

a)

structured program

b)

object oriented program

c)

oriented program

d)

basic program

47.

What function is use to display a message?

a)

printf

b)

print

c)

output

48.

Symbolic constants are defined in (a)   section.

49.

All variables used in the program are declared in (a)   part of main function.

50.

user defined functions are contained in (a)   section.

51.

int x;

int y;

int z;

x=3;

y=4;

z = ++x * y++;

printf("%d",z);

a)

12

b)

16

c)

20

d)

0

52.

int main()

{

int a = 25%10;

printf("%d", a);


return 0;

}

a)

5

b)

2

c)

2.5

d)

5.5

53.

The modulus operator (%) can be used only with integers.

a)

True

b)

False

54.

!= is the example of ____________________ operator.

a)

Relational

b)

Logical

c)

Assignment

d)

Conditional

55.

++ and -- are unary operators.

a)

True

b)

False

56.

The _____________ operator checks if the value of left operand is greater than the value of right operand.

a)

= =

b)

<

c)

>

d)

=

57.

#include <stdio.h>


int main()

{


int i = 95;


char c = 97;


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


return 0;

}

a)

2,1

b)

4,2

c)

2,4

d)

2,8

58.

#include <stdio.h>


void main()

{


int x = 5 * 9 / 3 + 9;


}

a)

24

b)

3

c)

23

d)

4

59.

Select the data types that can be used with the % operator.

a)

int

b)

float

c)

double

d)

all of the above

60.

What is the output of the given code?

a)

Error

b)

10 20 30

c)

10 20 1

d)

10 200 1

61.

What is the output of the given code?

a)

Error

b)

10 20 30

c)

10 20 1

d)

10 200 1

62.

What is the value of 'a' in the following statement?

int a = 10 + 10.55;

a)

Error

b)

20.55

c)

20

d)

Can't be defined

63.

What is the output of the given code?

a)

10 10

b)

10 100

c)

100 100

d)

10 20

e)

None of the above

64.

int x;

int y;

int z;

x=3;

y=4;

z = ++x * y++;

printf("%d",z);

a)

12

b)

16

c)

20

d)

0

65.

Which of the following is not a Bitwise operator?

a)

&

b)

|

c)

<<

d)

&&

66.

What is the output of the following printf


printf("%d",34+24/12%3*5/2-4);

a)

35

b)

-2

c)

34

d)

38

67.

What is the output of the following code:

#include<stdio.h>

void main()

{

int a=10,b=80,c=45;

printf("%d",a<b>c);

}

a)

0

b)

1

c)

10

d)

Error

68.

What is the output of the following code:

#include<stdio.h>

void main()

{

int a=10,b=-5;

printf("%d",a&&b);

}

a)

1

b)

0

c)

Error

d)

10

e)

-5

69.

What is the output of the following printf


int a=-11;

printf("%d",!a);

a)

0

b)

1

c)

12

d)

10

70.

What is the output of the following printf:


printf("%d",14%-4);

a)

2

b)

-2

c)

3

d)

0

71.

What is the output of the following printf:


int a=10;

b=++a;

printf("%d,%d",a,b);

a)

11,11

b)

10,11

c)

11,10

d)

10,10

72.

What is the output of the following printf:


int a=1,2,3,4;

printf("%d",a);

a)

1

b)

2

c)

3

d)

4

e)

Compile time error

73.

What is the value of printf:


printf("%d",sizeof(double));

a)

8

b)

10

c)

4

d)

6

74.

What is the output of the following printf:


int a=10,b=3;

printf("%d",a<<b);

a)

80

b)

0

c)

20

d)

40

75.

What is the output of the following printf:


int a=20,b=15;

printf("%d",a|b);

a)

31

b)

20

c)

1

d)

35

76.

What is the output of the following code snippet:


int a=12;

a?printf("GEC"):printf("IT");

a)

GEC

b)

IT

c)

GECIT

d)

Error

77.

What is the output of the following printf:


printf("%d",10<400>300>40);

a)

0

b)

1

c)

Error

d)

400

78.

What is the value of X in the sample code given below?

X = ( 2 + 3) * 2 + 3;

a)

10

b)

13

c)

25

d)

28

79.

What value will be stored in z if the following code is executed?

x = 5 , y = -10, a = 4, b = 2;

z = x+++++y * b/a;

a)

-2

b)

0

c)

1

d)

2

80.

Which operators are used to compare the values of operands to produce logical value in c language?

a)

Logical operator

b)

Relational operator

c)

Assignment operator

d)

None of the above

81.

Which operators perform operations on data in Binary level?

a)

Bit wise operator

b)

Logical operators

c)

Arithmetic operator

d)

All of the Above

82.

What is/are the number of operand/operands needed to unary operator logical not(!)?

a)

4

b)

3

c)

2

d)

1

83.

When applied to a variable, what does the unary "&" operator yield?

a)

The variable's address

b)

The variables right value

c)

The variable's binary form

d)

The variable's value

84.

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

a)

Keywords

b)

reserved words

c)

Identifier

d)

None of the above

85.

The operator "&" is used for

a)

Bitwise AND

b)

Bitwise OR

c)

Logical AND

d)

Logical OR

86.

The size of a character variable in C is

a)

8 bytes

b)

4 bytes

c)

2 bytes

d)

1 byte

87.

Operators means

a)

symbols

b)

signals

c)

codes

d)

things

88.

C support a rich set of _____ operators.

a)

user-defined

b)

other-defined

c)

built-in

d)

system-defined

89.

Operators tells the computer to perform certain _______ or_______ manipulations.

a)

Mathematical

b)

logical

c)

relational

d)

assignment

90.

What are the types of operators?

a)

arithmetic and logical

b)

relational and assignment

c)

bitwise and special

d)

conditional and increment/decrement

91.

___________ operator is used to construct mathematical expression.

a)

relational

b)

bitwise

c)

arithmetic

d)

logical

92.

___________ operator is used to compare two quantities.

a)

relational

b)

logical

c)

assignment

d)

bitwise

93.

___________ operator is used to form compound conditions by combining two or more relations

a)

relational

b)

logical

c)

assignment

d)

bitwise

94.

Symbols of relational operators

a)

+ - * / %

b)

< > <= >= == !=

c)

&& || !

d)

All

95.

11/4

a)

2

b)

3

c)

2.0

d)

3.0

96.

11.0/4

a)

2

b)

2.75

c)

3

d)

3.0

97.

If x=5,

Then x+=10 is evaluated.

What is the value of x?

a)

25

b)

10

c)

15

d)

5

98.

5<=5 evaluates to

a)

true

b)

false

99.

99%9

a)

0

b)

1

c)

10

d)

15

100.

Select the assignment operator

a)

==

b)

===

c)

=

d)

!=

101.

ASCII value of the character 'd'

a)

99

b)

100

c)

101

d)

97

102.

10/3%2

a)

2

b)

1.56

c)

10

d)

1

103.

15/(3+4)*8

a)

37

b)

16

c)

0

d)

72

104.

5-10+3

which operation will be performed first?

a)

addition

b)

subtraction

105.

Operator % in C Language is called.?

a)

Percentage Operator

b)

Quotient Operator

c)

Modulus

d)

Division

106.

Output of an arithmetic expression with integers and real numbers is ___ by default.?

a)

Integer

b)

Real number

c)

Depends on the numbers used in the expression.

d)

None of the above

107.

int a = 3.5 + 4.5;

a)

0

b)

7

c)

8

d)

8.0

108.

What is the other name for C Language ?: Question Mark Colon Operator.?

a)

Comparison Operator

b)

If-Else Operator

c)

Binary Operator

d)

Ternary Operator

109.

In C, the result of the conditional operator is ____________.

a)

true

b)

false

c)

1

d)

0

110.

The output of an arithmetic expression with integer and float is __________.

a)

int

b)

float

c)

can't be defined

d)

operation not possible