Skip to main content

Arrays And Strings — Part 1 MCQs with Explanations

Practice high-yield Programming & Software Development MCQs on Arrays And Strings — Part 1 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 highest index for an array with 10 elements in C?

Question 2 of 40
★ FPSC ★ PPSC

What is the size of an integer array declared as int arr[5] in bytes?

Question 3 of 40
★ FPSC ★ PPSC

What is the maximum number of elements that can be stored in an array in C?

Question 4 of 40
★ FPSC ★ PPSC

What is the output of printf("%d", sizeof("Hello")); in C?

Question 5 of 40
★ FPSC ★ PPSC

What is the purpose of the fgets function in C?

Question 6 of 40
★ FPSC ★ PPSC

What is right way to Initialize array?

Question 7 of 40
★ FPSC ★ PPSC

What will be the output of the program? #include<stdio.h> void main() { int a[5] = {5, 1, 15, 20, 25}; int i, j, m; i = ++a[1]; j = a[1]++; m = a[i++]; printf("%d, %d, %d", i, j, m); }

Question 8 of 40
★ FPSC ★ PPSC

What will be the output of following program code? #include <stdio.h> int main(void) { char p; char buf[10] = {1, 2, 3, 4, 5, 6, 9, 8}; p = (buf + 1)[5]; printf("%d", p); return 0; }

Question 9 of 40
★ FPSC ★ PPSC

An array elements are always stored in ________ memory locations.

Question 10 of 40
★ FPSC ★ PPSC

Let x be an array. Which of the following operations are illegal? I. ++x II. x+1 III. x++ IV. x*2

Question 11 of 40
★ FPSC ★ PPSC

Size of the array need not be specified, when

Question 12 of 40
★ FPSC ★ PPSC

Consider the following type definition. typedef char x[10]; x myArray[5]; What will sizeof(myArray) be ? (Assume one character occupies 1 byte)

Question 13 of 40
★ FPSC ★ PPSC

What will be printed after execution of the following code? void main() { int arr[10] = {1,2,3,4,5}; printf("%d", arr[5]); }

Question 14 of 40
★ FPSC ★ PPSC

What will be the output of the following program? void main() { char str1[] = "abcd"; char str2[] = "abcd"; if(str1==str2) printf("Equal"); else printf("Unequal"); }

Question 15 of 40
★ FPSC ★ PPSC

What will be the output of the following code? void main() { int a[10]; printf("%d %d", a[-1], a[12]); }

Question 16 of 40
★ FPSC ★ PPSC

What does the following declaration mean? int ( *ptr ) [ 10 ] ;

Question 17 of 40
★ FPSC ★ PPSC

What will be the output of the program if the array begins at 65472 and each integer occupies 2 bytes? #include<stdio.h> void main() { int a[3][4] = {1, 2, 3, 4, 4, 3, 2, 1, 7, 8, 9, 0}; printf("%u, %u", a+1, &a+1); }

Question 18 of 40
★ FPSC ★ PPSC

What will be the output of the program? #include<stdio.h> int main() { int arr[1] = {10}; printf("%d", 0[arr]); return 0; }

Question 19 of 40
★ FPSC ★ PPSC

What will be the output of the program if the array begins at address 65486? #include<stdio.h> void main() { int arr[] = {12, 14, 15, 23, 45}; printf("%u, %u", arr, &arr); }

Question 20 of 40
★ FPSC ★ PPSC

What will be the output of the program? #include<stdio.h> void main() { float arr[] = {12.4, 2.3, 4.5, 6.7}; printf("%d", sizeof(arr)/sizeof(arr[0])); }

Question 21 of 40
★ FPSC ★ PPSC

Which of the following is correct way to define the function fun() in the below program? #include<stdio.h> void main() { int a[3][4]; fun(a); }

Question 22 of 40
★ FPSC ★ PPSC

Which of the following statements are correct about the program below? #include<stdio.h> void main() { int size, i; scanf("%d", &size); int arr[size]; for(i=1; i<=size; i++) { scanf("%d", arr[i]); printf("%d", arr[i]); } }

Question 23 of 40
★ FPSC ★ PPSC

Which of the following statements are correct about an array? 1. The array int num[26]; can store 26 elements. 2. The expression num[1] designates the very first element in the array. 3. It is necessary to initialize the array at the time of declaration. 4. The declaration num[SIZE] is allowed if SIZE is a macro.

Question 24 of 40
★ FPSC ★ PPSC

If the two strings are identical, then strcmp () function returns

Question 25 of 40
★ FPSC ★ PPSC

The library function used to find the last occurrence of a character in a string is

Question 26 of 40
★ FPSC ★ PPSC

Which of the following function is used to find the first occurrence of a given string in another string?

Question 27 of 40
★ FPSC ★ PPSC

Which of the following function is more appropriate for reading in a multi-word string?

Question 28 of 40
★ FPSC ★ PPSC

What will be the output of the program? #include<stdio.h> #include<string.h> void main() { char str1[20] = "Hello", str2[20] = " World"; printf("%s", strcpy(str2, strcat(str1, str2))); }

Question 29 of 40
★ FPSC ★ PPSC

What will be the output of the program? #include<stdio.h> void main() { printf(5+"Good Morningn"); }

Question 30 of 40
★ FPSC ★ PPSC

What will be the output of the program? #include<stdio.h> #include<string.h> void main() { char str[] = "Exam\0Veda"; printf("%s", str); }

Question 31 of 40
★ FPSC ★ PPSC

Which of the following correctly accesses the seventh element stored in arr, an array with 100 elements?

Question 32 of 40
★ FPSC ★ PPSC

What is the return value of the following statement if it is placed in C program? strcmp("ABC", "ABC");

Question 33 of 40
★ FPSC ★ PPSC

int a [ 5 ] = { 1,2,3 } What is the value of a [ 4 ] ?

Question 34 of 40
★ FPSC ★ PPSC

What will be the correct output of the following program? #include<string.h> void main() { char str[] = "C EXAMINATION", rev[17]; int i = strlen(str), j=0; for( ; i>=0; rev[j++] = str[i--]) rev[j] = str[j] ; puts(rev); }

Question 35 of 40
★ FPSC ★ PPSC

String concatenation means -

Question 36 of 40
★ FPSC ★ PPSC

Which keyword is used to declare a character array in C?

Question 37 of 40
★ FPSC ★ PPSC

Which function is used to compare two strings in C?

Question 38 of 40
★ FPSC ★ PPSC

How do you access the first element of an array arr in C?

Question 39 of 40
★ FPSC ★ PPSC

Which type of loop is commonly used to iterate through an array in C?

Question 40 of 40
★ FPSC ★ PPSC

Which function is used to find the length of a string in C?

✓ 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 →