Find Output of Program
Practice and master this topic with our carefully crafted questions.
What is the output of the program in Turbo C (in DOS 16-bit OS)? |
Any pointer size is 2 bytes. (only 16-bit offset)
So, char *s1 = 2 bytes.
So, char far *s2; = 4 bytes.
So, char huge *s3; = 4 bytes.
A far, huge pointer has two parts: a 16-bit segment value and a 16-bit offset value.
Since C is a compiler dependent language, it may give different output in other platforms. The above program works fine in Windows (TurboC), but error in Linux (GCC Compiler).
What is the output of the program |
When an automatic structure is partially initialized remaining elements are initialized to 0(zero).
What is the output of the program? |
extern int a; indicates that the variable a is defined elsewhere, usually in a separate source code module.
printf("%d\n", a); it prints the value of local variable int a = 20. Because, whenever there is a conflict between local variable and global variable, local variable gets the highest priority. So it prints 20.
What is the output of the program |
1. Type mismatch in redeclaration of fun
2. Type mismatch in parameter aa
What is the output of the program? |
printf("%d, %d, %d\n", u.ch[0], u.ch[1], u.i); It prints the value of u.ch[0] = 3, u.ch[1] = 2 and it prints the value of u.i means the value of entire union size.

So the output is 3, 2, 515.
What is the output of the program |
When an automatic array is partially initialized, the remaining elements are initialized to 0.
What will be the output of the program? |
Whenever there is conflict between a local variable and global variable, the local variable gets priority.
What is the output of the program |
In the following program how long will the for loop get executed? |
During the for loop execution scanf() ask input and then printf() prints that given input. This process will be continued repeatedly because, scanf() returns the number of input given, the condition is always true(user gives a input means it reurns '1').
Hence this for loop would get executed infinite times.
What will be the output of the program? |
In case of a conflict between a local variable and global variable, the local variable gets priority.