Skip to main content

Introduction to Programming MCQs with Answers

Practice important Introduction to Programming MCQs with answers and explanations.

Multiple Choice Questions

Q251: What does the toupper function do?
  • A: Converts a character to lowercase
  • B: Converts a character to uppercase
  • C: Checks if a character is uppercase
  • D: Checks if a character is lowercase
View Answer
B

Q252: What does the strspn function return?
  • A: The length of the initial segment of s1 consisting only of characters in s2
  • B: The length of s1
  • C: The position of the first occurrence of a character in s1
  • D: The length of s1 not containing characters in s2
View Answer
A

Q253: What type of data does the isspace function check?
  • A: Only alphabets
  • B: Only digits
  • C: Whitespace characters
  • D: Control characters
View Answer
C

Q254: Which of the following functions is used to break a string into tokens?
  • A: strtok
  • B: strchr
  • C: strpbrk
  • D: strspn
View Answer
A

Q255: What are the primary types of files in a computer?
  • A: Text files and Image files
  • B: Text files and Program files
  • C: Program files and Image files
  • D: Text files and Data files
View Answer
B

Q256: What type of files contain formatted text, such as bold or italic characters?
  • A: Plain text files
  • B: Executable files
  • C: Word processor files
  • D: Program files
View Answer
C

Q257: Which header file is required for file handling in C++?
  • A:
  • B:
  • C:
  • D:
View Answer
B

Q258: Which of the following streams is used to read from a file in C++?
  • A: ofstream
  • B: cout
  • C: ifstream
  • D: cin
View Answer
C

Q259: What function is used to open a file in C++?
  • A: openfile()
  • B: fileopen()
  • C: open()
  • D: fopen()
View Answer
C

Q260: Which of the following modes is used to open a file for input in C++?
  • A: ios::out
  • B: ios::in
  • C: ios::app
  • D: ios::trunc
View Answer
B

Test Your Knowledge

Take a timed quiz on Introduction to Programming

🚀 Start Quiz Now