ExamVeda
Login
Home
41
If integer needs two bytes of storage, then maximum value of an unsigned integer is
Discuss
Answer & Solution
Answer: Option A
Solution:
An integer is a number with no fractional part; it can be positive, negative or zero. In ordinary usage, one uses a minus sign to designate a negative integer. However, a computer can only store information in bits, which can only have the values zero or one. We might expect, therefore, that the storage of negative integers in a computer might require some special technique. As you might imagine, an unsigned integer is either positive or zero. Consider a single digit decimal number: In a single decimal digit, you can write a number between 0 and 9. In two decimal digits, you can write a number between 0 and 99, and so on. Since nine is equivalent to 101 - 1, 99 is equivalent to 102 - 1, etc. In n decimal digits, you can write a number between 0 and 10n - 1. So, analogously, in the binary number system, An unsigned integer containing n bits can have a value between 0 and 2n - 1 (which is 2n different values).
42
What is the correct value to return to the operating system upon the successful completion of a program?
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
43
Which is the only function all C programs must contain?
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
44
Which of the following is not a correct variable type?
Discuss
Answer & Solution
Answer: Option B
Solution:
Variable types in C define the kind of data that can be stored in a variable.

Option A: float - This is a correct variable type in C, used for storing single-precision floating-point numbers.

Option B: real - This is not a correct variable type in C. There is no data type called real in C.

Option C: int - This is a correct variable type in C, used for storing integers.

Option D: double - This is a correct variable type in C, used for storing double-precision floating-point numbers.

Option E: char - This is a correct variable type in C, used for storing single characters.

Therefore, the correct answer is Option B: real.
45
What number would be shown on the screen after the following statements of C are executed?
char ch; 
int i; 
ch = 'G'; 
i = ch-'A';
printf("%d", i);
Discuss
Answer & Solution
Answer: Option B
Solution:

Since the ASCII value of G is 71 and the garbage value if A is 65 and hence the difference is 6.

46
Which of following is not a valid name for a C variable?
Discuss
Answer & Solution
Answer: Option C
Solution:

No spaces are allowed in the variable names.

47
Find the output of the following program. void main() { int i=01289; printf("%d", i); }
Discuss
Answer & Solution
Answer: Option E
Solution:

The prefix 0 in an integer value indicates octal value. In octal value use of 8 and 9 is not allowed and hence the error.

48
Find the output of the following program.
void main()
{
   int i=065, j=65;
   printf("%d %d", i, j);
}
Discuss
Answer & Solution
Answer: Option A
Solution:

As octal 65 ( 065 ) is equivalent of decimal value 53.

49
If ASCII value of 'x' is 120, then what is the value of the H, if
H = ('x' – 'w' ) / 3;
Discuss
Answer & Solution
Answer: Option E
Solution:

Because 'x'-'w' = 120-119. And hence 1/3 results in 0(integer division)

50
What is the difference between a declaration and a definition of a variable?
Discuss
Answer & Solution
Answer: Option D
No explanation is given for this question. Let's Discuss on Board