Skip to main content

Introduction to Programming MCQs with Answers

Practice important Introduction to Programming MCQs with answers and explanations.

Multiple Choice Questions

Q171: Which of the following statements about array indexing is correct?
  • A: The index starts from 1 and ends at size of the array
  • B: The index starts from 0 and ends at size of the array minus 1
  • C: The index starts from 1 and ends at size of the array minus 1
  • D: The index starts from 0 and ends at size of the array
View Answer
B

Q172: Which of the following is used to store a string in C?
  • A: int
  • B: float
  • C: char
  • D: double
View Answer
C

Q173: How do you declare a character array of size 100 in C?
  • A: char name[100];
  • B: int name[100];
  • C: float name[100];
  • D: double name[100];
View Answer
A

Q174: What character does C use to terminate a string?
  • A: Space
  • B: Newline
  • C: Null character
  • D: Tab
View Answer
C

Q175: What is the size of the array needed to store the string 'Hello World' in C?
  • A: 12
  • B: 11
  • C: 13
  • D: 10
View Answer
A

Q176: How does the 'cin' statement read a string into a character array?
  • A: Reads character by character
  • B: Reads until a newline is encountered
  • C: Reads until a space is encountered
  • D: Reads fixed length
View Answer
B

Q177: In the context of arrays, what does the 'null character' signify?
  • A: End of the string
  • B: Start of the string
  • C: Empty space
  • D: End of the array
View Answer
A

Q178: What is the purpose of a loop that checks for the null character while displaying a string?
  • A: To ensure all characters are printed
  • B: To avoid printing garbage values
  • C: To count the number of characters
  • D: To find the length of the string
View Answer
B

Q179: Which loop structure can be used to display a string in C?
  • A: for loop
  • B: while loop
  • C: do-while loop
  • D: All of the above
View Answer
D

Q180: How can we compare two arrays to check if they are equal?
  • A: By comparing their sizes only
  • B: By comparing their values one by one
  • C: By comparing their addresses
  • D: By checking if they are of the same type
View Answer
B

Test Your Knowledge

Take a timed quiz on Introduction to Programming

🚀 Start Quiz Now