C Operators and Expressions 01
Quiz
•
Computers
•
University
•
Hard
Sumit Mittu
Used 4+ times
FREE Resource
Enhance your content in a minute
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

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?
Similar Resources on Wayground
15 questions
After Effect Intoduction
Quiz
•
10th Grade - University
10 questions
Pengantar Coding
Quiz
•
University
14 questions
Linux: Users and Groups
Quiz
•
9th Grade - University
15 questions
Graphs
Quiz
•
University
12 questions
Spreadsheet Starter
Quiz
•
7th Grade - University
15 questions
Brewing JavaFX Quiz
Quiz
•
University
10 questions
Adobe Photoshop
Quiz
•
University
10 questions
Choose the level of Bloom’s Taxonomy
Quiz
•
University
Popular Resources on Wayground
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
54 questions
Analyzing Line Graphs & Tables
Quiz
•
4th Grade
22 questions
fractions
Quiz
•
3rd Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade
15 questions
Equivalent Fractions
Quiz
•
4th Grade
