What will be the output of the following C function?
#include <stdio.h>
enum birds {SPARROW, PEACOCK, PARROT};
enum animals {TIGER = 8, LION, RABBIT, ZEBRA};
int main()
{
enum birds m = TIGER;
int k;
k = m;
printf("%d\n", k);
return 0;
}
5CSE1_T&P questions
Quiz
•
Other
•
University
•
Hard
Gouthami Velakanti
Used 1+ times
FREE Resource
15 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 2 pts
What will be the output of the following C function?
#include <stdio.h>
enum birds {SPARROW, PEACOCK, PARROT};
enum animals {TIGER = 8, LION, RABBIT, ZEBRA};
int main()
{
enum birds m = TIGER;
int k;
k = m;
printf("%d\n", k);
return 0;
}
0
Compile time error
1
8
2.
MULTIPLE CHOICE QUESTION
30 sec • 2 pts
What will be the final value of x in the following C code?
#include <stdio.h>
void main()
{
int x = 5 * 9 / 3 + 9;
}
3.75
Depends on compiler
24
3
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will be the output of the following C code considering the size of a short int is 2, char is 1 and int is 4 bytes?
#include <stdio.h>
int main()
{
short int i = 20;
char c = 97;
printf("%d, %d, %d\n", sizeof(i), sizeof(c), sizeof(c + i));
return 0;
}
a) 2, 1, 2
b) 2, 1, 1
c) 2, 1, 4
d) 2, 2, 8
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will be the value of the following assignment expression?
(x = foo())!= 1 considering foo() returns 2
2
True
1
0
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Comment on the following C statement.
n = 1; printf("%d, %dn", 3*n, n++);
Output will be 3, 2
Output will be 3, 1
Output will be 6, 1
Output is compiler dependent
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will be the data type returned for the following C function?
#include <stdio.h>
int func()
{
return (double)(char)5.0;
}
char
int
double
multiple type-casting in return is illegal
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the output of this C code?
#include <stdio.h>
int main()
{
float f = 0.1;
if (f == 0.1)
printf("True");
else
printf("False");
}
True
False
15 questions
C Basics_1
Quiz
•
University
12 questions
JAVA FUNDAMENTALS
Quiz
•
University
20 questions
Quiz on Array
Quiz
•
University
20 questions
First Meet Sains Data 2022
Quiz
•
University
10 questions
C Language Basic Quiz
Quiz
•
7th Grade - Professio...
20 questions
Orientation Quiz
Quiz
•
University
20 questions
QUIZERIA
Quiz
•
University
15 questions
C Quiz
Quiz
•
University
15 questions
Character Analysis
Quiz
•
4th Grade
17 questions
Chapter 12 - Doing the Right Thing
Quiz
•
9th - 12th Grade
10 questions
American Flag
Quiz
•
1st - 2nd Grade
20 questions
Reading Comprehension
Quiz
•
5th Grade
30 questions
Linear Inequalities
Quiz
•
9th - 12th Grade
20 questions
Types of Credit
Quiz
•
9th - 12th Grade
18 questions
Full S.T.E.A.M. Ahead Summer Academy Pre-Test 24-25
Quiz
•
5th Grade
14 questions
Misplaced and Dangling Modifiers
Quiz
•
6th - 8th Grade