C Operators and Expressions 01
Quiz
•
Computers
•
University
•
Hard
Sumit Mittu
Used 4+ times
FREE Resource
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
Create a free account and access millions of resources
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
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?
Similar Resources on Wayground
10 questions
Algorithm analysis: divide & conquer theory
Quiz
•
University
10 questions
Information systems concepts
Quiz
•
University
15 questions
4.6.4 Logic Gates
Quiz
•
10th Grade - Professi...
11 questions
Workshop_1
Quiz
•
University
10 questions
Web-II-Loop and Function
Quiz
•
University
10 questions
Abhyudaya coding class - Grade 7
Quiz
•
6th Grade - University
10 questions
WN-CELLULAR CONCEPT
Quiz
•
University
15 questions
C++ Switch and If Else Statements
Quiz
•
University
Popular Resources on Wayground
20 questions
Brand Labels
Quiz
•
5th - 12th Grade
11 questions
NEASC Extended Advisory
Lesson
•
9th - 12th Grade
10 questions
Ice Breaker Trivia: Food from Around the World
Quiz
•
3rd - 12th Grade
10 questions
Boomer ⚡ Zoomer - Holiday Movies
Quiz
•
KG - University
25 questions
Multiplication Facts
Quiz
•
5th Grade
22 questions
Adding Integers
Quiz
•
6th Grade
10 questions
Multiplication and Division Unknowns
Quiz
•
3rd Grade
20 questions
Multiplying and Dividing Integers
Quiz
•
7th Grade
Discover more resources for Computers
10 questions
Boomer ⚡ Zoomer - Holiday Movies
Quiz
•
KG - University
22 questions
FYS 2024 Midterm Review
Quiz
•
University
20 questions
Physical or Chemical Change/Phases
Quiz
•
8th Grade - University
20 questions
Definite and Indefinite Articles in Spanish (Avancemos)
Quiz
•
8th Grade - University
7 questions
Force and Motion
Interactive video
•
4th Grade - University
12 questions
1 Times Tables
Quiz
•
KG - University
20 questions
Disney Trivia
Quiz
•
University
38 questions
Unit 6 Key Terms
Quiz
•
11th Grade - University