C MCQ set number 00689

1. function tolower(c) defined in library works for
a) Ascii character set
b) Unicode character set
c) Ascii and utf-8 but not EBSIDIC character set
d) Any character set

Answer

Answer: d [Reason:] None.

2. What is the output of the below code considering size of short int is 2, char is 1 and int is 4 bytes?

  1.     #include <stdio.h>
  2.     int main()
  3.     {
  4.         short int i = 20;
  5.         char c = 97;
  6.         printf("%d, %d, %dn", sizeof(i), sizeof(c), sizeof(c + i));
  7.         return 0;
  8.     }

a) 2, 1, 2
b) 2, 1, 1
c) 2, 1, 4
d) 2, 2, 8

Answer

Answer: c [Reason:] None.

3. Which type conversion is NOT accepted?
a) From char to int
b) From float to char pointer
c) From negative int to char
d) From double to char

Answer

Answer: b [Reason:] Conversion of a float to pointer type is not allowed.

4. What will be the data type of the result of the following operation?
(float)a * (int)b / (long)c * (double)d
a) int
b) long
c) float
d) double

Answer

Answer: d [Reason:] None.

5. Which of the following type-casting have chances for wrap around?
a) From int to float
b) From int to char
c) From char to short
d) From char to int

Answer

Answer: b [Reason:] None.

6. Which of the following typecasting is accepted by C?
a) Widening conversions
b) Narrowing conversions
c) Widening & Narrowing conversions
d) None of the mentioned

Answer

Answer: c [Reason:] None.

7. When do you need to use type-conversions?
a) The value to be stored is beyond the max limit
b) The value to be stored is in a form not supported by that data type
c) To reduce the memory in use, relevant to the value
d) All of the mentioned

Answer

Answer: d [Reason:] None.

ed010d383e1f191bdb025d5985cc03fc?s=120&d=mm&r=g

DistPub Team

Distance Publisher (DistPub.com) provide project writing help from year 2007 and provide writing and editing help to hundreds student every year.