Languages-C & C Plus Plus [3i Infotech Placement]: Sample Questions 177 - 179 of 354
Glide to success with Doorsteptutor material for competitive exams : get questions, notes, tests, video lectures and more- for all subjects of your exam.
Question 177
Explanation
- Advantages is in terms of the memory.
- If a union & structure have one int and one float, then the size of the structure is sum of its members-10 (2 ⚹ 3 + 4) , the size of the union is only 4- that is the size of its largest member (the size of the float, the largest one in this union) .
Question 178
Explanation
- In a program = new line
- ⧵b = backspace
- = linefeed or carriage return⧵
printf ( “ab” ) ; | First print to ab |
printf ( “⧵bsi” ) ; | Now the handle backspace (NOTE: that even through it is “non-erase” , the next character to be output would overwrite what was backspaced over) Now print asi |
printf ( “ha” ) ; | Now, a carriage return means to go back to the beginning of the line So, the “ha” overwrites the “as” in “asi” |
- So, the answer is “hai”
Question 179
Write in Short Short Answer▾
What is the output of the following program?
main ()
{
int i =0;
int j =0;
if (i && j ++ )
printf ( “%d..%d”, i ++, j);
printf(” %d..%d”, i, j);
}
Explanation
In the program
int i = 0; int j = 0; |
|
printf ( “% d. . % d” , i, j) ; | The values of i and j remain unchanged and get printed. |