Introduction to Programming MCQs with Answers
Practice important Introduction to Programming MCQs with answers and explanations.
Multiple Choice Questions
Q241: What is the purpose of the C language function isdigit?
- A: To check if a character is an alphabet
- B: To check if a character is a digit
- C: To convert a character to uppercase
- D: To convert a character to lowercase
View Answer
B
Q242: Which header file is required to use string manipulation functions in C?
- A: stdio.h
- B: ctype.h
- C: string.h
- D: stdlib.h
View Answer
C
Q243: What does the strlen function do?
- A: Copies a string from one location to another
- B: Concatenates two strings
- C: Determines the length of a string
- D: Compares two strings
View Answer
C
Q244: How does the strcpy function work?
- A: Copies at most n characters of one string to another
- B: Concatenates two strings
- C: Copies a string from one location to another
- D: Compares two strings
View Answer
C
Q245: Which function would you use to check if a character is a lowercase letter?
- A: isalpha
- B: isspace
- C: islower
- D: isupper
View Answer
C
Q246: What is the output of the atoi function when provided with the string "45.5"?
- A: 45.5
- B: 45
- C: 0
- D: Error
View Answer
B
Q247: Which function locates the first occurrence of a character in a string?
- A: strrchr
- B: strstr
- C: strchr
- D: strpbrk
View Answer
C
Q248: What does the strcat function do?
- A: Compares two strings
- B: Copies part of a string
- C: Appends one string to another
- D: Converts a string to an integer
View Answer
C
Q249: How does strncat differ from strcat?
- A: strncat appends up to n characters
- B: strncat replaces characters
- C: strncat does not append characters
- D: strncat copies strings
View Answer
A
Q250: Which function would you use to convert a string to a long integer?
- A: atof
- B: atoi
- C: atol
- D: strtol
View Answer
C