Arrays And Strings — Part 2 MCQs with Explanations
Practice high-yield Programming & Software Development MCQs on Arrays And Strings — Part 2 with worked academic solutions for FPSC, PPSC, NTS, NITB, PTS.
Questions
40
Difficulty Level
Exam-Level
Target Exams
FPSC, PPSC, NTS...
Estimated Time
48 mins
Exam-Level FPSC PPSC NTS NITB PTS
Verified for Commission Syllabus • Oct 14, 2026
40
Verified Practice Questions
Interactive test mode with detailed academic worked solutions
Live Progress|0/40 answered
✓0 correct
✗0 wrong
0% score
🎉 Set complete! All 40 questions answered.
Question 1 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the term for accessing elements of an array using an index in C?
Correct Answer: Option B — Indexing
Detailed Academic Explanation:
Indexing is the correct answer to “What is the term for accessing elements of an array using an index in C”. This question is standard in competitive examination syllabi for Arrays And Strings.
💡Key Conceptual Anchor:Arrays And Strings
Question 2 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What character is used to terminate a C string?
Correct Answer: Option A — �
Detailed Academic Explanation:
� is the correct answer to “What character is used to terminate a C string”. This question is standard in competitive examination syllabi for Arrays And Strings.
💡Key Conceptual Anchor:Arrays And Strings
Question 3 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
How can you initialize an array in C at the time of declaration?
Correct Answer: Option D — Providing a list of values
Detailed Academic Explanation:
Providing a list of values is the correct answer to “How can you initialize an array in C at the time of declaration”. This question is standard in competitive examination syllabi for Arrays And Strings.
💡Key Conceptual Anchor:Arrays And Strings
Question 4 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which function is used to concatenate two strings in C?
Correct Answer: Option A — strcat
Detailed Academic Explanation:
strcat is the correct answer to “Which function is used to concatenate two strings in C”. This question is standard in competitive examination syllabi for Arrays And Strings.
💡Key Conceptual Anchor:Arrays And Strings
Question 5 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the correct way to declare and initialize a string in C?
Correct Answer: Option A — char str[10] = "Hello"
Detailed Academic Explanation:
char str[10] = "Hello" is the correct answer to “What is the correct way to declare and initialize a string in C”. This question is standard in competitive examination syllabi for Arrays And Strings.
💡Key Conceptual Anchor:Arrays And Strings
Question 6 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the term for a character array that is used to store text in C?
Correct Answer: Option C — string
Detailed Academic Explanation:
string is the correct answer to “What is the term for a character array that is used to store text in C”. This question is standard in competitive examination syllabi for Arrays And Strings.
💡Key Conceptual Anchor:Arrays And Strings
Question 7 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
How can you find the length of an array in C?
Correct Answer: Option C — Use the sizeof operator
Detailed Academic Explanation:
Use the sizeof operator is the correct answer to “How can you find the length of an array in C”. This question is standard in competitive examination syllabi for Arrays And Strings.
💡Key Conceptual Anchor:Arrays And Strings
Question 8 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which function is used to copy one string to another in C?
Correct Answer: Option C — strcpy
Detailed Academic Explanation:
strcpy is the correct answer to “Which function is used to copy one string to another in C”. This question is standard in competitive examination syllabi for Arrays And Strings.
💡Key Conceptual Anchor:Arrays And Strings
Question 9 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
How do you access the last element of an array arr with n elements in C?
Correct Answer: Option B — arr[n-1]
Detailed Academic Explanation:
arr[n-1] is the correct answer to “How do you access the last element of an array arr with n elements in C”. This question is standard in competitive examination syllabi for Arrays And Strings.
💡Key Conceptual Anchor:Arrays And Strings
Question 10 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What does the strtok function do in C?
Correct Answer: Option A — Tokenizes a string
Detailed Academic Explanation:
Tokenizes a string is the correct answer to “What does the strtok function do in C”. This question is standard in competitive examination syllabi for Arrays And Strings.
💡Key Conceptual Anchor:Arrays And Strings
Question 11 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
How do you declare a two-dimensional integer array in C with 3 rows and 4 columns?
Correct Answer: Option B — int arr[3][4]
Detailed Academic Explanation:
int arr[3][4] is the correct answer to “How do you declare a two-dimensional integer array in C with 3 rows and 4 columns”. This question is standard in competitive examination syllabi for Arrays And Strings.
💡Key Conceptual Anchor:Arrays And Strings
Question 12 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the result of the expression strlen("Hello") in C?
Correct Answer: Option A — 5
Detailed Academic Explanation:
5 is the correct answer to “What is the result of the expression strlen("Hello") in C”. This question is standard in competitive examination syllabi for Arrays And Strings.
💡Key Conceptual Anchor:Arrays And Strings
Question 13 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which function is used to find the first occurrence of a character in a string in C?
Correct Answer: Option A — strchr
Detailed Academic Explanation:
strchr is the correct answer to “Which function is used to find the first occurrence of a character in a string in C”. This question is standard in competitive examination syllabi for Arrays And Strings.
💡Key Conceptual Anchor:Arrays And Strings
Question 14 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
How do you declare a string in C that can store up to 50 characters?
Correct Answer: Option B — char str[50]
Detailed Academic Explanation:
char str[50] is the correct answer to “How do you declare a string in C that can store up to 50 characters”. This question is standard in competitive examination syllabi for Arrays And Strings.
💡Key Conceptual Anchor:Arrays And Strings
Question 15 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the purpose of the strncpy function in C?
Correct Answer: Option B — Copy a portion of a string
Detailed Academic Explanation:
Copy a portion of a string is the correct answer to “What is the purpose of the strncpy function in C”. This question is standard in competitive examination syllabi for Arrays And Strings.
💡Key Conceptual Anchor:Arrays And Strings
Question 16 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which function is used to convert a string to an integer in C?
Correct Answer: Option C — atoi
Detailed Academic Explanation:
atoi is the correct answer to “Which function is used to convert a string to an integer in C”. This question is standard in competitive examination syllabi for Arrays And Strings.
💡Key Conceptual Anchor:Arrays And Strings
Question 17 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What does the fgets function in C do when it encounters a newline character?
Correct Answer: Option B — Stops reading
Detailed Academic Explanation:
Stops reading is the correct answer to “What does the fgets function in C do when it encounters a newline character”. This question is standard in competitive examination syllabi for Arrays And Strings.
💡Key Conceptual Anchor:Arrays And Strings
Question 18 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
How can you check if two strings are equal in C?
Correct Answer: Option B — Use the strcmp function
Detailed Academic Explanation:
Use the strcmp function is the correct answer to “How can you check if two strings are equal in C”. This question is standard in competitive examination syllabi for Arrays And Strings.
💡Key Conceptual Anchor:Arrays And Strings
Question 19 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the maximum number of dimensions an array in C may have?
Correct Answer: Option E — Theoratically no limit. The only practical limits are memory size and compilers.
Detailed Academic Explanation:
Theoratically no limit. The only practical limits are memory size and compilers. is the correct answer to “What is the maximum number of dimensions an array in C may have”. This question is standard in competitive examination syllabi for Arrays And Strings.
💡Key Conceptual Anchor:Arrays And Strings
Question 20 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Array passed as an argument to a function is interpreted as
Correct Answer: Option C — Address of the first element of the array.
Detailed Academic Explanation:
Address of the first element of the array. is the correct answer to “Array passed as an argument to a function is interpreted as”. This question is standard in competitive examination syllabi for Arrays And Strings.
💡Key Conceptual Anchor:Arrays And Strings
Question 21 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
The function sprintf() works like printf(), but operates on ..........
Correct Answer: Option C — string
Detailed Academic Explanation:
string is the correct answer to “The function sprintf() works like printf(), but operates on ..........”. This question is standard in competitive examination syllabi for Arrays And Strings.
💡Key Conceptual Anchor:Arrays And Strings
Question 22 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
errno causes trouble in two subtler ways(vague and explicit).
Correct Answer: Option A — true
Detailed Academic Explanation:
true is the correct answer to “errno causes trouble in two subtler ways(vague and explicit).”. This question is standard in competitive examination syllabi for Arrays And Strings.
💡Key Conceptual Anchor:Arrays And Strings
Question 23 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What do the following C function do? int isgraph(int c);
Correct Answer: Option D — tests for any printing character
Detailed Academic Explanation:
tests for any printing character is the correct answer to “What do the following C function do? int isgraph(int c);”. This question is standard in competitive examination syllabi for Arrays And Strings.
💡Key Conceptual Anchor:Arrays And Strings
Question 24 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
The . . . . . . . . function tests for any character for which isalpha or isdigit is true.
Correct Answer: Option C — isalnum()
Detailed Academic Explanation:
isalnum() is the correct answer to “The . . . . . . . . function tests for any character for which isalpha or isdigit is true.”. This question is standard in competitive examination syllabi for Arrays And Strings.
💡Key Conceptual Anchor:Arrays And Strings
Question 25 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
There are two groups of string functions defined in the header <string.h>. What are they?
Correct Answer: Option A — first group names beginning with str; second group names beginning with mem
Detailed Academic Explanation:
first group names beginning with str; second group names beginning with mem is the correct answer to “There are two groups of string functions defined in the header <string.h>. What are they”. This question is standard in competitive examination syllabi for Arrays And Strings.
💡Key Conceptual Anchor:Arrays And Strings
Question 26 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What error occurs when a result is unde?ned for a given argument value?
Correct Answer: Option D — domain
Detailed Academic Explanation:
domain is the correct answer to “What error occurs when a result is unde?ned for a given argument value”. This question is standard in competitive examination syllabi for Arrays And Strings.
💡Key Conceptual Anchor:Arrays And Strings
Question 27 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the prototype of strcoll() function?
Correct Answer: Option A — int strcoll(const char *s1,const char *s2)
Detailed Academic Explanation:
int strcoll(const char *s1,const char *s2) is the correct answer to “What is the prototype of strcoll() function”. This question is standard in competitive examination syllabi for Arrays And Strings.
💡Key Conceptual Anchor:Arrays And Strings
Question 28 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the return value of strxfrm()?
Correct Answer: Option A — length of the transformed string, not including the terminating null-character
Detailed Academic Explanation:
length of the transformed string, not including the terminating null-character is the correct answer to “What is the return value of strxfrm()”. This question is standard in competitive examination syllabi for Arrays And Strings.
💡Key Conceptual Anchor:Arrays And Strings
Question 29 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which among the following is Copying function?
Correct Answer: Option A — memcpy()
Detailed Academic Explanation:
memcpy() is the correct answer to “Which among the following is Copying function”. This question is standard in competitive examination syllabi for Arrays And Strings.
💡Key Conceptual Anchor:Arrays And Strings
Question 30 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which function tests for any character that is an uppercase letter.
Correct Answer: Option D — isupper()
Detailed Academic Explanation:
isupper() is the correct answer to “Which function tests for any character that is an uppercase letter.”. This question is standard in competitive examination syllabi for Arrays And Strings.
💡Key Conceptual Anchor:Arrays And Strings
Question 31 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
No library function will store a zero in errno.
Correct Answer: Option A — true
Detailed Academic Explanation:
true is the correct answer to “No library function will store a zero in errno.”. This question is standard in competitive examination syllabi for Arrays And Strings.
💡Key Conceptual Anchor:Arrays And Strings
Question 32 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
The . . . . . . . . function tests for any hexadecimal-digit character.
Correct Answer: Option D — isxdigit()
Detailed Academic Explanation:
isxdigit() is the correct answer to “The . . . . . . . . function tests for any hexadecimal-digit character.”. This question is standard in competitive examination syllabi for Arrays And Strings.
💡Key Conceptual Anchor:Arrays And Strings
Question 33 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What does the following C code do? int iscntrl( int c);
Correct Answer: Option C — tests for any control character
Detailed Academic Explanation:
tests for any control character is the correct answer to “What does the following C code do? int iscntrl( int c);”. This question is standard in competitive examination syllabi for Arrays And Strings.
💡Key Conceptual Anchor:Arrays And Strings
Question 34 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of the given function is used to return a pointer to the located character?
Correct Answer: Option D — strchar()
Detailed Academic Explanation:
strchar() is the correct answer to “Which of the given function is used to return a pointer to the located character”. This question is standard in competitive examination syllabi for Arrays And Strings.
💡Key Conceptual Anchor:Arrays And Strings
Question 35 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will the following C code do? char * strrchr(const char *s, int c ) char ch = c; char *sc; for(sc = NULL; ; ++s) if(*s == ch) SC = 9; i f (*s =='\O' ) return (( char *) s);
Correct Answer: Option A — find last occurrence of c in char s[ ].
Detailed Academic Explanation:
find last occurrence of c in char s[ ]. is the correct answer to “What will the following C code do? char * strrchr(const char *s, int c ) char ch = c; char *sc; for(sc = NULL; ; ++s) if(*s == ch) SC = 9; i f (*s =='\O' ) return (( char *) s);”. This question is standard in competitive examination syllabi for Arrays And Strings.
💡Key Conceptual Anchor:Arrays And Strings
Question 36 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which function returns true only for the characters defined as lowercase letters?
Correct Answer: Option B — islower()
Detailed Academic Explanation:
islower() is the correct answer to “Which function returns true only for the characters defined as lowercase letters”. This question is standard in competitive examination syllabi for Arrays And Strings.
💡Key Conceptual Anchor:Arrays And Strings
Question 37 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
The . . . . . . . . function returns the number of characters that are present before the terminating null character.
Correct Answer: Option B — strlen()
Detailed Academic Explanation:
strlen() is the correct answer to “The . . . . . . . . function returns the number of characters that are present before the terminating null character.”. This question is standard in competitive examination syllabi for Arrays And Strings.
💡Key Conceptual Anchor:Arrays And Strings
Question 38 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
The . . . . . . . . function appends not more than n characters.
Correct Answer: Option C — strncat()
Detailed Academic Explanation:
strncat() is the correct answer to “The . . . . . . . . function appends not more than n characters.”. This question is standard in competitive examination syllabi for Arrays And Strings.
💡Key Conceptual Anchor:Arrays And Strings
Question 39 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C code? const char str1[10]="Helloworld"; const char str2[10] = "world"; char *mat; mat = strstr(str1, str2); printf("The substring is:%s\n", mat);
Correct Answer: Option A — The substring is:world
Detailed Academic Explanation:
The substring is:world is the correct answer to “What will be the output of the following C code? const char str1[10]="Helloworld"; const char str2[10] = "world"; char *mat; mat = strstr(str1, str2); printf("The substring is:%s\n", mat);”. This question is standard in competitive examination syllabi for Arrays And Strings.
💡Key Conceptual Anchor:Arrays And Strings
Question 40 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C code? char ch[ ] = "0xC"; if(isxdigit(ch[ ])) printf("ch = %s is hexadecimal character \n",ch); else printf("ch = %s is not hexadecimal character \n",ch);
Correct Answer: Option A — ch = 0xC is hexadecimal character
Detailed Academic Explanation:
ch = 0xC is hexadecimal character is the correct answer to “What will be the output of the following C code? char ch[ ] = "0xC"; if(isxdigit(ch[ ])) printf("ch = %s is hexadecimal character \n",ch); else printf("ch = %s is not hexadecimal character \n",ch);”. This question is standard in competitive examination syllabi for Arrays And Strings.
💡Key Conceptual Anchor:Arrays And Strings
✓Link copied to clipboard
Continue Your Practice
Advance Html — Part 1
Master the next curriculum module with 40 exam-standard MCQs.
💡Examiner's Advisory for Programming & Software Development
In competitive commission exams (FPSC, PPSC, KPPSC, SPSC, CSS, PMS), questions are frequently phrased with distractor options designed to catch rote learners. Whenever you answer an MCQ, read the Detailed Academic Explanation and Conceptual Anchor to understand why the remaining options are incorrect.