Skip to main content

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
Question 1 of 40
★ FPSC ★ PPSC

What is the term for accessing elements of an array using an index in C?

Question 2 of 40
★ FPSC ★ PPSC

What character is used to terminate a C string?

Question 3 of 40
★ FPSC ★ PPSC

How can you initialize an array in C at the time of declaration?

Question 4 of 40
★ FPSC ★ PPSC

Which function is used to concatenate two strings in C?

Question 5 of 40
★ FPSC ★ PPSC

What is the correct way to declare and initialize a string in C?

Question 6 of 40
★ FPSC ★ PPSC

What is the term for a character array that is used to store text in C?

Question 7 of 40
★ FPSC ★ PPSC

How can you find the length of an array in C?

Question 8 of 40
★ FPSC ★ PPSC

Which function is used to copy one string to another in C?

Question 9 of 40
★ FPSC ★ PPSC

How do you access the last element of an array arr with n elements in C?

Question 10 of 40
★ FPSC ★ PPSC

What does the strtok function do in C?

Question 11 of 40
★ FPSC ★ PPSC

How do you declare a two-dimensional integer array in C with 3 rows and 4 columns?

Question 12 of 40
★ FPSC ★ PPSC

What is the result of the expression strlen("Hello") in C?

Question 13 of 40
★ FPSC ★ PPSC

Which function is used to find the first occurrence of a character in a string in C?

Question 14 of 40
★ FPSC ★ PPSC

How do you declare a string in C that can store up to 50 characters?

Question 15 of 40
★ FPSC ★ PPSC

What is the purpose of the strncpy function in C?

Question 16 of 40
★ FPSC ★ PPSC

Which function is used to convert a string to an integer in C?

Question 17 of 40
★ FPSC ★ PPSC

What does the fgets function in C do when it encounters a newline character?

Question 18 of 40
★ FPSC ★ PPSC

How can you check if two strings are equal in C?

Question 19 of 40
★ FPSC ★ PPSC

What is the maximum number of dimensions an array in C may have?

Question 20 of 40
★ FPSC ★ PPSC

Array passed as an argument to a function is interpreted as

Question 21 of 40
★ FPSC ★ PPSC

The function sprintf() works like printf(), but operates on ..........

Question 22 of 40
★ FPSC ★ PPSC

errno causes trouble in two subtler ways(vague and explicit).

Question 23 of 40
★ FPSC ★ PPSC

What do the following C function do? int isgraph(int c);

Question 24 of 40
★ FPSC ★ PPSC

The . . . . . . . . function tests for any character for which isalpha or isdigit is true.

Question 25 of 40
★ FPSC ★ PPSC

There are two groups of string functions defined in the header <string.h>. What are they?

Question 26 of 40
★ FPSC ★ PPSC

What error occurs when a result is unde?ned for a given argument value?

Question 27 of 40
★ FPSC ★ PPSC

What is the prototype of strcoll() function?

Question 28 of 40
★ FPSC ★ PPSC

What is the return value of strxfrm()?

Question 29 of 40
★ FPSC ★ PPSC

Which among the following is Copying function?

Question 30 of 40
★ FPSC ★ PPSC

Which function tests for any character that is an uppercase letter.

Question 31 of 40
★ FPSC ★ PPSC

No library function will store a zero in errno.

Question 32 of 40
★ FPSC ★ PPSC

The . . . . . . . . function tests for any hexadecimal-digit character.

Question 33 of 40
★ FPSC ★ PPSC

What does the following C code do? int iscntrl( int c);

Question 34 of 40
★ FPSC ★ PPSC

Which of the given function is used to return a pointer to the located character?

Question 35 of 40
★ 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);

Question 36 of 40
★ FPSC ★ PPSC

Which function returns true only for the characters defined as lowercase letters?

Question 37 of 40
★ FPSC ★ PPSC

The . . . . . . . . function returns the number of characters that are present before the terminating null character.

Question 38 of 40
★ FPSC ★ PPSC

The . . . . . . . . function appends not more than n characters.

Question 39 of 40
★ 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);

Question 40 of 40
★ 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);

✓ Link copied to clipboard
Continue Your Practice

Advance Html — Part 1

Master the next curriculum module with 40 exam-standard MCQs.

Next Practice Set →

💡 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.

More Modules in Programming & Software Development

View All →
📚

Study Guides

Topic summaries and syllabus breakdown

Explore Guides →
🎯

Complete Library

Search through 78,000+ verified MCQs

Browse Library →
📱

Mobile App

Offline mock tests and instant bookmarks

Get Mobile App →