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
10 questions
Java Set 2
Quiz
•
University
12 questions
C++ Programming Language
Quiz
•
University
10 questions
C Language Basic Quiz
Quiz
•
7th Grade - Professio...
20 questions
Round 2
Quiz
•
University
20 questions
Round 3-Tech Titans
Quiz
•
University
20 questions
TECHTRIX2025 BUGHUNT SET5
Quiz
•
University
20 questions
Round 1
Quiz
•
University
17 questions
C Program Day 2
Quiz
•
University
15 questions
Multiplication Facts
Quiz
•
4th Grade
20 questions
Math Review - Grade 6
Quiz
•
6th Grade
20 questions
math review
Quiz
•
4th Grade
5 questions
capitalization in sentences
Quiz
•
5th - 8th Grade
10 questions
Juneteenth History and Significance
Interactive video
•
5th - 8th Grade
15 questions
Adding and Subtracting Fractions
Quiz
•
5th Grade
10 questions
R2H Day One Internship Expectation Review Guidelines
Quiz
•
Professional Development
12 questions
Dividing Fractions
Quiz
•
6th Grade