ExamVeda
Login
Home
51
"My salary was increased by 15%" Select the statement, which will EXACTLY reproduce the line of text above.
Discuss
Answer & Solution
Answer: Option D
No explanation is given for this question. Let's Discuss on Board
52
short testarray[4][3] = { {1}, {2,3}, {4,5,6}};
printf("%d", sizeof(testarray));

Assuming a short is two bytes long, what will be printed by the above code?
Discuss
Answer & Solution
Answer: Option D
Solution:

The following table provides the details of standard integer types with their storage sizes and value ranges −

Type Storage size Value range
char 1 byte -128 to 127 or 0 to 255
unsigned char 1 byte 0 to 255
signed char 1 byte -128 to 127
int 2 or 4 bytes -32,768 to 32,767 or -2,147,483,648 to 2,147,483,647
unsigned int 2 or 4 bytes 0 to 65,535 or 0 to 4,294,967,295
short 2 bytes -32,768 to 32,767
unsigned short 2 bytes 0 to 65,535
long 4 bytes -2,147,483,648 to 2,147,483,647
unsigned long 4 bytes 0 to 4,294,967,295
53
What will be the output of the following C code?
#include <stdio.h>
void main()
{
    int x = 97;
    char y = x;
    printf("%c\n", y);
}
Discuss
Answer & Solution
Answer: Option A
Solution:
1. Declaration: int x = 97;

2. Conversion: char y = x;

3. ASCII Value: The ASCII value of 97 corresponds to the character 'a'.

4. Print: printf("%c\n", y); prints the character 'a'.
54
Will the following C code compile without any error?
#include <stdio.h>
int main()
{
    for (int k = 0; k < 10; k++);
        return 0;
}
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
55
Variable name resolution (number of significant characters for the uniqueness of variable) depends on . . . . . . . .
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
56
What will be the final values of a and c in the following C statement? (Initial values: a = 2, c = 1)
c = (c) ? a = 0 : 2;
Discuss
Answer & Solution
Answer: Option A
Solution:
Initial values: a = 2, c = 1;

The statement is: c = (c) ? a = 0 : 2;

This is a ternary conditional expression. The condition is (c), which means if c is non-zero, the expression before the colon is executed.

Since c = 1 (non-zero), the true part is executed: a = 0

Then the value of the true expression (a = 0) is assigned to c.

So now:

a becomes 0

c becomes 0 (since the result of a = 0 is 0)

Final values: a = 0, c = 0
57
What will be the output of the following C code?
#include <stdio.h>
int main()
{
    unsigned int a = 10;
    a = ~a;
    printf("%d\n", a);
}
Discuss
Answer & Solution
Answer: Option C
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>
int main()
{
    int a = 1, b = 2;
    a += b -= a;
    printf("%d %d", a, b);
}
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
59
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 A
No explanation is given for this question. Let's Discuss on Board
60
What will be the output of the following C code?
#include <stdio.h>
int main()
{
    int a = 1, b = 1, d = 1;
    printf("%d, %d, %d", ++a + ++a+a++, a++ + ++b, ++d + d++ + a++);
}
Discuss
Answer & Solution
Answer: Option D
No explanation is given for this question. Let's Discuss on Board