wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Quiz on Type Conversion and Operators Precedence

Total questions: 10

Worksheet time: 5mins

Name
Class
Date
1.

What is operator precedence and why is it important?

a)

Operator precedence only applies to arithmetic operations.

b)

Operator precedence is the set of rules that defines the order in which operators are evaluated in expressions first.

c)

Operator precedence is the same as operator overloading.

d)

Operator precedence is irrelevant in programming languages.

2.

List the order of operations for arithmetic operators.

a)

Parentheses, Exponents, Multiplication/Division, Addition/Subtraction

b)

Exponents, Parentheses, Addition, Subtraction

c)

Addition, Subtraction, Multiplication, Division

d)

Multiplication, Addition, Parentheses, Division

3.

How does associativity affect the evaluation of expressions?

a)

Associativity affects the order of evaluation for operators of the same precedence.

b)

Associativity has no impact on the evaluation of expressions.

c)

Associativity determines the precedence of all operators.

d)

Associativity only applies to binary operators.

4.

Evaluate the expression: 3 + 4 * 2 - 1. What is the result?

a)

8

b)

12

c)

10

d)

6

5.

What is the result of the expression 10 / 2 * 3 + 1 - 5?

a)

15

b)

11

c)

8

d)

6

6.

What is the result of the expression 5 + 3 * 2?

a)

8

b)

6

c)

10

d)

11

7.

What is implicit type conversion in C?

a)

Implicit type conversion only occurs in floating-point operations.

b)

Explicit type conversion in C requires manual intervention by the programmer.

c)

Implicit type conversion in C is the automatic conversion of data types by the compiler during operations.

d)

Implicit type conversion is a feature that prevents data loss during type changes.

8.

What is explicit type conversion in C?

a)

Changing the size of a data type without any operator.

b)

Explicit type conversion in C is the process of converting one data type to another using a cast operator.

c)

Implicit type conversion using a cast operator.

d)

Converting data types automatically without a cast operator.

9.

Find the output of the program:

#include<stdio.h>

void main()

{

int a=4, b=12, c=-3, res;

res = a > b && a < c;

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

res = a==c || a < b;

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

res=b+a*(a*2)-c/a;

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

}

a)

0

1

44

b)

1

0

12

c)

0

1

45

d)

1

0

44

10.

#include<stdio.h>

int main()

{

int x = 10;

char y = 'a';

float z;

x = x + y;

z = x + 1.0;

printf(""x = %d, z = %.2f"", x, z);

return 0;

}

a)

x = 107, z = 108.00

b)

x = 107, z = 108.0000

c)

x = 107, z = 108.000000

d)

x = 108, z = 108.000000