ExamVeda
Login
Home
51
Which of the following is the correct order of evaluation for the given expression?
a = w % x / y * z;
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
52
What will be the output of the following C code?
#include  <stdio.h>
int main()
{
    char c;
    int i = 0;
    FILE *file;
    file = fopen("test.txt", "w+");
    fprintf(file, "%c", 'a');
    fprintf(file, "%c", -1);
    fprintf(file, "%c", 'b');
    fclose(file);
    file = fopen("test.txt", "r");
    while ((c = fgetc(file)) !=  -1)
        printf("%c", c);
    return 0;
}
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
53
What will be the output of the following C code?
#include <stdio.h>
int main()
{
    printf("Ram\rShyam\n");
    return 0;
}
Discuss
Answer & Solution
Answer: Option B
Solution:
The correct answer is Option B: Ram Shyam.

Here's why:

* `printf("Ram\rShyam\n");` is the core of the problem. Let's break it down:
* `Ram`: This part is initially printed to the console buffer.
* `\r`: This is the carriage return character. It moves the cursor to the beginning of the current line.
* `Shyam`: Because of `\r`, this overwrites the beginning of the existing line. So "Ram" is replaced by "Shyam". If "Shyam" has fewer characters than "Ram", some parts of "Ram" may remain.
* `\n`: This is the newline character. It moves the cursor to the beginning of the next line.
Because `\r` brings the cursor to the start of the line *before* "Shyam" is printed, "Shyam" will overwrite "Ram", and then `\n` will put the cursor on a newline for subsequent outputs (if any).
54
What will be the output of the following C code?
#include <stdio.h>
void main()
{
    double b = 3 % 0 * 1 - 4 / 2;
    printf("%lf", b);
}
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
55
What will be the output of the following C code?
#include <stdio.h>
void main()
{
    int x = 1, y = 0, z = 5;
    int a = x && y && z++;
    printf("%d", z);
}
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
56
What will be the value of the following C expression?
(x = foo()) != 1 considering foo() returns 2
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
57
In expression i = g() + f(), first function called depends on . . . . . . . .
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
58
What will be the output of the following C code?
#include <stdio.h>
void main()
{
    int h = 8;
    int b = (h++, h++);
    printf("%d%d\n", b, h);
}
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
59
When double is converted to float, then the value is?
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
60
Which of the following keywords is used to define an alternate name for an already existing data type?
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board