quiz image

Operators in C Programming

SprightlyVision avatar
SprightlyVision
·
·
Download

Start Quiz

Study Flashcards

40 Questions

What is the purpose of an operator in programming?

To perform operations

Which type of operator is used to add two operands?

Arithmetic operator

What does the term 'precedence of operators' refer to?

Order of evaluation of operators

In 'int value = 10+20*20;', why is the value 210?

Multiplicative operator is evaluated before Additive operator

Which type of operator checks the relationship between two operands?

Relational operator

What does the Unary + operator do?

Finds the absolute value of a number

Which type of operator is used to assign a value to a variable?

= operator

What is the purpose of Turnery or Conditional Operators?

Make decisions based on conditions

What is the purpose of the sizeof operator in C?

To find the memory space allocated for data types

In C, how is the bitwise AND operator denoted?

&

Which operand is greater in the expression 'A' + 2?

A

What output would be generated by the bitwise OR operator if one operand is 0?

1

Which operator is used to perform left shift in C?

<<

What is true about the modulo-arithmetic operator in C?

It operates on integer operands as required

How are invalid arithmetic expressions often represented?

With missing operators connecting operands

What role does the comma operator play in C?

It links related expressions together

What is the purpose of the getchar() function in C programming?

To read a single character from the keyboard

Which function in C is used to display a character value on the screen or console?

putchar()

What will be the output of the code snippet provided?

Enter a value : this is test You entered: t

What is the main purpose of the gets() function in C programming?

To read a single string from the keyboard

Which format specifier is used for signed integer values in formatted input and output operations?

%d

What does the printf() function do in C programming?

Display any value on the console screen

Which function can be used to write output to the standard output stream in C?

printf()

'%lf' is used in C programming for which type of data?

Double (floating data)

What is the first step to convert a given valid C expression to its mathematical form?

Determine the order in which the operators are bound to their operands

Which operators have the next highest precedence after unary operators?

Multiplicative operators

In the given expression -a+ b * c - d I e + f, what is the associativity of additive operators + and -?

Left-to-right

Why does the expression -a-+ -b++ * -c appear invalid?

The excessive use of operators

Which operator in C has the highest precedence?

If a simple expression can be directly converted to its mathematical form, what does it imply?

The expression is complex

What does it mean when two operators are said to have 'right-to-left associativity'?

Operators are bound to their operands from right to left

Why do we need operator precedence and associativity rules in C expressions?

To determine the order in which operations are performed

What is the purpose of the printf() function in C programming?

Printing values on the console screen

Which header file contains the pre-defined function printf() in C programming?

stdio.h

What is the purpose of using the & symbol in scanf() function in C?

To store variable values in memory

Which function prints a string into a character array instead of displaying it on the console screen?

sprintf()

In the C programming language, what does sscanf() function do?

Reads data from strings or arrays

What happens if a wrong format specifier is used with printf() function?

It displays garbage values on screen

Which operator is used to store variable values at their respective memory locations in scanf() function?

&

What output would be expected from the given code snippet? C program to implement scanf() function #include int main() { char str; int a = 2, b = 8; sprintf(str, "%d and %d are even number", a, b); printf("%s", str); return 0; }

"2 and 8 are even numbers"

Test your knowledge on different types of operators used in C programming, including arithmetic, relational, shift, logical, bitwise, ternary, assignment, and miscellaneous operators. Learn about the precedence of operators in C language.

Make Your Own Quizzes and Flashcards

Convert your notes into interactive study material.

Get started for free

More Quizzes Like This

C Language Operators Quiz
80 questions
C Language Operators Quiz
10 questions
C Language Operators Quiz
10 questions
Use Quizgecko on...
Browser
Browser