Introduction to Programming MCQs with Answers
Practice important Introduction to Programming MCQs with answers and explanations.
Multiple Choice Questions
Q351: How many bytes does the union intOrChar occupy if int is 4 bytes and char is 1 byte?
- A: 1 byte
- B: 4 bytes
- C: 5 bytes
- D: 8 bytes
View Answer
B
Q352: Which statement about unions is true?
- A: All members share the same memory location
- B: Each member has its own memory location
- C: The size of the union is the sum of the sizes of its members
- D: Unions are used to create arrays of different types
View Answer
A
Q353: What is the basic unit of memory in computers?
- A: Byte
- B: Bit
- C: Nibble
- D: Word
View Answer
B
Q354: How many bits form a byte?
- A: 4
- B: 8
- C: 16
- D: 32
View Answer
B
Q355: Which operator returns 1 if both input bits are 1?
- A: Bitwise OR
- B: Bitwise AND
- C: Bitwise XOR
- D: Bitwise NOT
View Answer
B
Q356: What is the result of applying the Bitwise AND operator on binary 1100 and 1000?
- A: 100
- B: 1100
- C: 1000
- D: 0
View Answer
C
Q357: Which operator is used to check if a specific bit in a number is set?
- A: Bitwise OR
- B: Bitwise XOR
- C: Bitwise AND
- D: Bitwise NOT
View Answer
C
Q358: What does the Bitwise OR operator do?
- A: Returns 1 if both bits are 1
- B: Returns 1 if at least one bit is 1
- C: Returns 1 if only one of the bits is 1
- D: Inverts all bits
View Answer
B
Q359: What is the result of 8 ^ 1 where 8 is 1000 and 1 is 0001 in binary?
- A: 1001
- B: 1
- C: 101
- D: 1100
View Answer
A
Q360: If a = 5 and b = 3, what will be the result of a ^ b followed by c ^ b where c = a ^ b?
- A: a
- B: b
- C: c
- D: 0
View Answer
A