Skip to main content

Important Introduction to Programming Short Questions

Chapter: 20
Question 1:
What is an array of structures?
Answer: An array of structures is a collection of elements, where each element is of a structure type. For example: student s[100]; declares an array of 100 student structures.
Chapter: 20
Question 2:
Can you assign one structure variable to another?
Answer: Yes, assignment between two structure variables of the same type copies the values of all members from one structure to another. For example, s2 = s1; copies all data from s1 to s2.
Chapter: 20
Question 3:
How can you find the size of a structure?
Answer: Use the sizeof operator to find the size of a structure. For example, sizeof(s1) will give the number of bytes used by the structure variable s1.
Chapter: 21
Question 4:
What is a bit in the context of bit manipulation?
Answer: A bit is the smallest unit of memory in a computer, represented as either 0 or 1.
Chapter: 21
Question 5:
How many bits form a byte?
Answer: Eight bits form one byte.
Chapter: 21
Question 6:
What does the bitwise AND operator (&) do?
Answer: It compares two bits and returns 1 if both bits are 1; otherwise, it returns 0.
Chapter: 21
Question 7:
What is the result of applying the bitwise AND operator on 12 and 8?
Answer: The result is 8. In binary, 12 is 1100 and 8 is 1000; their AND operation results in 1000, which is 8.
Chapter: 21
Question 8:
How does the bitwise OR operator (
Answer: ) differ from the bitwise AND operator (&)?
Chapter: 21
Question 9:
What is the result of 12
Answer: 8?
Chapter: 21
Question 10:
Explain the bitwise XOR (^) operator.
Answer: XOR returns 1 if one bit is 1 and the other is 0; it returns 0 if both bits are the same.