
C Operators and Expressions 01
Authored by Sumit Mittu
Computers
University
Used 4+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
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
10 questions
Server Administration- Quiz 1
Quiz
•
12th Grade - University
11 questions
Computer Science (1-9) - Identifying & Preventing Threats
Quiz
•
University
14 questions
IOTA : Web Development Bootcamp Quiz 2
Quiz
•
University
10 questions
BOOLEAN CLUB QUIZ 1
Quiz
•
University
10 questions
Concept of Computer Network
Quiz
•
University
10 questions
Seatwork HASH (Data Structure)
Quiz
•
University
10 questions
Tech Tool
Quiz
•
KG - University
14 questions
Pop Quiz
Quiz
•
University
Popular Resources on Wayground
7 questions
History of Valentine's Day
Interactive video
•
4th Grade
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
22 questions
fractions
Quiz
•
3rd Grade
15 questions
Valentine's Day Trivia
Quiz
•
3rd Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade
Discover more resources for Computers
18 questions
Valentines Day Trivia
Quiz
•
3rd Grade - University
12 questions
IREAD Week 4 - Review
Quiz
•
3rd Grade - University
23 questions
Subject Verb Agreement
Quiz
•
9th Grade - University
5 questions
What is Presidents' Day?
Interactive video
•
10th Grade - University
7 questions
Renewable and Nonrenewable Resources
Interactive video
•
4th Grade - University
20 questions
Mardi Gras History
Quiz
•
6th Grade - University
10 questions
The Roaring 20's Crash Course US History
Interactive video
•
11th Grade - University
17 questions
Review9_TEACHER
Quiz
•
University