What will be the output of this code?
int x = 5;
printf("%d %d %d", x++, ++x, x);
Sessional 2 A3
Quiz
•
Computers
•
University
•
Hard
Gunjan Verma
Used 3+ times
FREE Resource
20 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
20 sec • 1 pt
What will be the output of this code?
int x = 5;
printf("%d %d %d", x++, ++x, x);
2.
MULTIPLE CHOICE QUESTION
20 sec • 1 pt
What will happen if you write the following declaration in C?
const int x = 10;
int *ptr = &x;
*ptr = 20;
printf("%d", x);
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following is true about variable scope in C?
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How does C interpret the expression int x = (int *) malloc(sizeof(int));?
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following switch cases is invalid?
switch (x) {
case 1.5: printf("Float\n"); break;
case 'a': printf("Char\n"); break;
case 3: printf("Int\n"); break;
}
6.
MULTIPLE CHOICE QUESTION
20 sec • 1 pt
Consider this code:
for (int i = 0; i < 5; i++)
{
if (i == 3) break;
}
printf("%d", i);
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will the output of the following recursive function be?
int func(int n)
{
if (n == 0) return 0; return n + func(n - 1);
}
printf("%d", func(4));
16 questions
C-Extended
Quiz
•
University
15 questions
Milking Minds 2 17-01-24
Quiz
•
University
20 questions
Pointers
Quiz
•
University
15 questions
Coding club Summit Online Quiz
Quiz
•
University
20 questions
C - Structures
Quiz
•
University
15 questions
C programming
Quiz
•
University
15 questions
BASIC C PROGRAMMING QUIZ
Quiz
•
University
15 questions
ARRAYS AND FUNCTIONS
Quiz
•
University
25 questions
Equations of Circles
Quiz
•
10th - 11th Grade
30 questions
Week 5 Memory Builder 1 (Multiplication and Division Facts)
Quiz
•
9th Grade
33 questions
Unit 3 Summative - Summer School: Immune System
Quiz
•
10th Grade
10 questions
Writing and Identifying Ratios Practice
Quiz
•
5th - 6th Grade
36 questions
Prime and Composite Numbers
Quiz
•
5th Grade
14 questions
Exterior and Interior angles of Polygons
Quiz
•
8th Grade
37 questions
Camp Re-cap Week 1 (no regression)
Quiz
•
9th - 12th Grade
46 questions
Biology Semester 1 Review
Quiz
•
10th Grade