80 Questions
What does the term 'operator' refer to in programming?
A symbol used to perform operations
In the expression int value = 10+20*20;, why is the value 210?
Multiplicative operator has higher precedence than the additive operator
Which type of operation does the minus (-) operator perform?
Subtraction
What does the modulo (%) operator do in arithmetic operations?
Calculates the remainder of division
Which operator is used to increment a variable by 1 in C programming?
++
What is the primary purpose of a logical operator in programming?
Control flow based on conditions
What is the purpose of the printf() function in C?
To print values on the console screen
Which function is used to read values from the keyboard in C?
scanf()
In C programming, what does the '&' symbol represent in scanf() function?
It is the address-of operator for memory location
What is the purpose of the sprintf() function in C?
To store string data in memory locations
Which function reads data from a string or character array instead of the console screen in C?
sscanf()
What is the purpose of the scanf() function in C?
To read values from the keyboard
What is the purpose of the getchar() function?
To read a single character from the keyboard and store it
What is the main difference between the getchar() and putchar() functions?
getchar() reads characters while putchar() writes characters
Which function is used to read a single string from the keyboard in C?
Gets(String)
In C programming, what does scanf() do?
Reads input from the standard input stream and scans it according to the provided format
What does the 'int printf(const char *format,...)' function do?
Writes output to the standard output stream based on the provided format
What does a '%f' format specifier represent in C?
Decimal floating-point value
Which function is used to display a string on the screen or console in C?
Puts(str)
'%ld' format specifier in C is used for which data type?
Long int
Which function is used to read a single character from the keyboard and store it?
Getchar()
What does the 'int i;' variable hold in this line of code: scanf("%s %d", str, &i);
?
An integer value stored by reference
In C language, how are the corresponding bits of two operands treated in the bitwise AND operation?
If both bits are 1, the output is 1; otherwise, it is 0
What is the purpose of the sizeof operator in C?
To determine the memory space allocated for C data types
Which operator in C is used for bitwise exclusive OR operations?
^
What does the comma operator do in C programming?
Links related expressions together
Which type of expression contains only arithmetic operators and operands?
Arithmetic expression
What does the unary minus (-) operator do in C?
Acts as a prefix operator for negation
How are binary expressions evaluated in C?
From left to right
What is the output when a bitwise OR operation is performed on two operands with bit values 1 and 0?
1
'A' + 2 evaluates to which value in C?
67
What is the first step to convert a valid C expression to its mathematical form and evaluate it?
Apply precedence and associativity rules
Which operator in the given expression has the highest precedence?
What is the associativity of multiplicative operators in the expression?
Left-to-right
How are sub-expressions treated after an operator is bound to their operands?
Treated as a single operand
Which step is crucial in converting a complex C expression to a mathematical equation?
Determining operator binding sequence
What is the main concern with the expression -a-+ -b++ * -c?
Invalid due to excessive use of operators
Which type of associativity do additive operators have?
Left-to-right
What are the first set of operators scanned in the given expression?
-, ++, --
In which order are multiplicative operators scanned in the expression?
From left-to-right
Why are sub-expressions considered as single operands after an operator is bound?
To simplify further evaluations
Which operator precedence determines the order of evaluation of expressions in C programming?
Arithmetic Operators
In C, for the expression 20/4*2, what is the result due to the precedence of operators?
10
Which associativity describes the direction of evaluation for the unary operators in C?
Right to Left
What is the result of the expression 5 + 5 * 3 - 2 / 2 due to the precedence of operators in C?
17
In C language, what is the purpose of the Turnery or Conditional Operator?
To assign values based on a condition
Which category of operators includes ++ and -- that are evaluated from left to right in C?
Misc. Operator
What will be the outcome of the expression 3 - 2 + 5 * 6 / 2 according to the precedence of operators in C?
-1
In C programming, what is the output of a bitwise XOR operation if one of the operands is 1 and the other is 0?
1
When evaluating an arithmetic expression in C, how does the unary minus operator (-) operate on a single operand?
Negates the operand
For the expression 'A' + 2 in C, what does the value 67 represent?
Character code of 'A'
Which bitwise operator in C is used to check if corresponding bits of two operands are both 1?
&
What is the main purpose of the comma operator in linking expressions together?
Evaluation order
When evaluating valid arithmetic expressions in C, which type of operands can be involved?
Integer and floating-point
For bitwise OR operations in C, what is the output if none of the operands have a bit value of 1?
0
'sizeof' operator in C is used to determine what aspect of operands?
Size allocated in memory
In the expression -a+ b * c - d I e + f, which operators have the next highest precedence after the unary operators?
Additive operators
For the expression -a-+ -b++ * -c, what is the primary reason it is considered invalid?
Excessive use of unary operators
If the expression -a+ b * c - d I e + f is evaluated starting from left-to-right, what will be the first set of operands for the binary operators?
-a+ b * c
Considering the expression -a-+ -b++ * -c, what is the associativity of the additive operators used in this context?
Left-to-right
What is the order of evaluation specified for sub-expressions at the same level in C expressions?
No specified order
When evaluating expressions, which type of operator has the highest precedence?
Multiplicative operators
In C, how are sub-expressions treated after an operator is bound to their operands?
They are considered as single operands for adjacent operators
Assuming a=1.5, b=2.5, and c=3.5, what would be the result of evaluating the expression a+b*c?
$8.75$
What is the purpose of the sprintf() function in C?
Prints a string into a character array
Which function is used to store the variable value on the memory location of that variable in C?
scanf()
What does the '%d' format specifier represent in C?
Integer data type
Which function reads data from the string or character array instead of the console screen in C?
sscanf()
'&' symbol in scanf() function is used for what purpose in C?
To store the variable value on memory location
What is the primary difference between sprintf() and printf() functions in C?
sprintf() stores the output in a character array, while printf() prints directly to the screen.
'scanf()' and 'sscanf()' functions in C differ mainly in their:
'&' symbol usage
'sscanf()' function in C reads data from where compared to 'scanf()' function?
String or character array
What is the purpose of the 'sscanf()' function in C?
To read input from a string according to the format provided
What is the primary difference between 'printf()' and 'sprintf()' functions in C?
printf() writes output to the standard output stream whereas sprintf() formats and stores the output in a string
What does the '%n' format specifier do in C?
Prints nothing
In C, what does the 'puts()' function do compared to 'gets()' function?
'puts()' displays a string on the screen while 'gets()' reads a single string from keyboard
What does the '%lf' format specifier represent in C?
Double value for fractional or floating data
How does the 'scanf("%s %d", str, &i);' line in C function?
Scans a string followed by an integer
'getchar()' and 'putchar()' functions are primarily used to perform which operations in C?
'getchar()' reads and 'putchar()' writes character values to the screen or console
'scanf("%s %d", str, &i);' function is primarily used for what purpose in C programming?
Reading one string and one integer from standard input stream
Test your knowledge on different types of operators in the C programming language including arithmetic, relational, assignment, and more. Learn about the precedence of operators and how they affect the evaluation of expressions.
Make Your Own Quizzes and Flashcards
Convert your notes into interactive study material.
Get started for free