C Operators and Expressions 01

C Operators and Expressions 01

University

10 Qs

quiz-placeholder

Similar activities

Visual Basic 2010

Visual Basic 2010

8th Grade - University

10 Qs

CS100||MsWord

CS100||MsWord

University

10 Qs

Types of Mass Media

Types of Mass Media

10th Grade - Professional Development

11 Qs

Website Usability and UX

Website Usability and UX

University

10 Qs

Python Week 1 & 2

Python Week 1 & 2

University

10 Qs

OM_SBENT3C_Q2

OM_SBENT3C_Q2

University - Professional Development

15 Qs

Quiz 1: The background and history of IoT

Quiz 1: The background and history of IoT

University

10 Qs

Hands-on Modul 3

Hands-on Modul 3

University

10 Qs

C Operators and Expressions 01

C Operators and Expressions 01

Assessment

Quiz

Computers

University

Hard

Created by

Sumit Mittu

Used 4+ times

FREE Resource

AI

Enhance your content in a minute

Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...

10 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 4 pts

What the output of the following code?

float x = 5*2+15/2+25%3 ;

printf("%g", x);

18

18.0

18.5

Garbage value due to %g

Answer explanation

Expression 5*2+15/2+25%3 evaluates as:

5*2+15/2+25%3

* 10 + 15/2 + 25%3

/ 10 + 7 + 25%3

% 10 + 7 + 1

  • + 17 + 1

  • + 18

Store 18.0 into x (a float variable)

The %g format specifier removes trailing 0s after decimal point and prints 18 for x

2.

MULTIPLE CHOICE QUESTION

10 sec • 1 pt

In C programming language, which of the following type of operators have the highest precedence

Relational operators

Shift operators

Logical operators

Arithmetic operators

Answer explanation

Among the given options: Arithmetic Operators have highest priority followed by Shift Operators then Relational Operators and then Logical Operators.

3.

MULTIPLE CHOICE QUESTION

30 sec • 4 pts

What is the output of the following code:

int x=3, y=4;

int z = ++x * y++;

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

4 3 12

4 4 16

4 5 16

4 5 20

Answer explanation

int x=3, y=4;

int z = ++x * y++;

Solves as

z = (increment x and use x) + (use y and then increment y)

z = 4 * 4 (alongside incrementing x to 4 and y to 5)

z = 16

Hence x y z values are printed as 4 5 16 respectively

4.

MULTIPLE CHOICE QUESTION

10 sec • 1 pt

The modulus operator (%) can be used with floating point values.

True

False

Answer explanation

The modulus operator can be used only with integer operands

5.

MULTIPLE CHOICE QUESTION

10 sec • 1 pt

!= is one of the ______ operators.

Relational

Logical

Assignment

Conditional

6.

MULTIPLE CHOICE QUESTION

10 sec • 1 pt

Which of the following is not a Bitwise operator?

&

|

<<

&&

Answer explanation

&& (Logical AND) is a Logical operator

7.

MULTIPLE CHOICE QUESTION

20 sec • 2 pts

What is the output of the following code segment assuming GCC compiler:

char c = 65;

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

1

2

4

Undefined.

Size varies from on compiler to compiler

Answer explanation

c is a char type variable.

char variables occupy 1 byte of memory. hence sizeof(c) will return sizeof(char) i.e. 1

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?