Unit 5: Introduction to Arrays - Subjective Questions

CAP1008 — C Programming • Practice Questions with Detailed Answers

20 questions

1

Define an array. Explain how one-dimensional arrays are declared and initialized in C with suitable examples.

2

Explain two-dimensional arrays in C. Describe their declaration, initialization, and memory representation.

3

Write a C program to perform addition of two matrices and explain the logic.

4

Explain the Bubble Sort algorithm with a C program and a worked example.

5

Explain Linear Search and Binary Search. Distinguish between them.

6

Write a C program to implement Binary Search and trace it on an example array.

7

What are character arrays and strings in C? Explain the declaration and initialization of strings.

8

Describe the commonly used string handling functions in C with syntax and examples.

9

Write a C program to find the length of a string without using the strlen() function.

10

Define a structure in C. Explain its declaration, definition, and initialization with an example.

11

What is a union in C? Explain its declaration and initialization with an example.

12

Distinguish between a structure and a union in C.

13

Explain how arrays are passed to functions in C with an example.

14

Write a C program to find the largest and smallest elements in a one-dimensional array.

15

Explain Selection Sort with an algorithm, C program, and example.

16

Explain the concept of an array of structures with an example program.

17

Write a C program to concatenate two strings without using the strcat() function.

18

Explain the transpose of a matrix. Write a C program to find the transpose of a matrix.

19

Explain nested structures in C with an example. When are they useful?

20

Describe common applications of arrays in C programming and discuss their advantages and limitations.