Question
QUESTION 21 What is the output of the following code snippet? union my_union { int x; char ch; }var; var.ch = 'A'; printf(%d, var.x); A.
QUESTION 21
-
What is the output of the following code snippet?
union my_union
{
int x;
char ch;
}var;
var.ch = 'A';
printf("%d", var.x);
A. A
B. Garbage Value
C. 65
D. 120
-
QUESTION 23
-
What is the output of following code snippet?
float a = 5, b = 2;
int c;
c = a%b ;
printf ( "%d", c );
A. 2.5
B. Compile-time Error
C. 2
D. Garbage Value
-
3 points
QUESTION 24
-
Which of the following statements is true for the following program?
void main( )
{
int x = 10;
int y = 100%90;
for ( int i = 1; i <= 10; i++ );
if ( x != y );
printf ( "x = %d y = %d", x, y );
}
A. The printf( ) function is called 10 times.
B. The program will produce the output x = 10 y = 10.
C. The printf( ) function is called infinite times.
D. The program will not produce any output.
-
4 points
QUESTION 25
-
Which of the following statement is true about a for loop used in a C program? This question has multiple choices (more than one answer).
A. for loop works faster than a while loop.
B. All things that can be done using a for loop can also be done using a while loop.
C. for ( ; ; ) implements an infinite loop.
D. for loop can be used if we want statements in a loop to get executed at least once.
E. for loop works faster than a do-while loop.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started