0% found this document useful (0 votes)
5 views1 page

C Programming: Arrays and Functions Guide

The document outlines a series of grouped repetitive questions related to programming in C, specifically focusing on arrays, matrix operations, functions, and storage classes. It includes examples of questions that have appeared in various modules from February 2023 to July 2024. Each question addresses fundamental concepts and programming tasks, such as declaring arrays, performing matrix operations, and understanding functions and storage classes.

Uploaded by

DEMONS clan
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views1 page

C Programming: Arrays and Functions Guide

The document outlines a series of grouped repetitive questions related to programming in C, specifically focusing on arrays, matrix operations, functions, and storage classes. It includes examples of questions that have appeared in various modules from February 2023 to July 2024. Each question addresses fundamental concepts and programming tasks, such as declaring arrays, performing matrix operations, and understanding functions and storage classes.

Uploaded by

DEMONS clan
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

MODULE – 3 : Grouped Repetitive Questions (FINAL – STRICT &

VERIFIED)
Q1.
Define an array. Explain with example. How to declare and initialize one dimensional and two
dimensional arrays.
OR
What is an array? Explain how arrays are declared and initialized.
Appeared in:
• Feb 2023 – Module 3 – Q5(a)
• July 2023 – Module 3 – Q6(a)

Q2.
Write a C program to perform addition of two dimensional matrix.
OR
Write a C program to perform matrix multiplication.
OR
Write a C program to transpose a matrix.
Appeared in:
• Feb 2023 – Module 3 – Q5(c)
• July 2023 – Module 3 – Q6(b)
• Jan 2024 – Module 3 – Q6(c)
• July 2024 – Module 3 – Q5(b)

Q3.
Define function. Explain function declaration, function definition and function call with example.
OR
Explain the parts of a user-defined function.
Appeared in:
• Feb 2023 – Module 4 – Q6(a)
• July 2023 – Module 3 – Q5(a)
• Jan 2024 – Module 3 – Q5(a)
• July 2024 – Module 3 – Q5(a)

Q4.
Describe different types of storage classes in C with example.
OR
Discuss various storage classes in C.
Appeared in:
• July 2023 – Module 3 – Q5(c)
• Jan 2024 – Module 3 – Q5(b)

Q5.
Write a C program to search an element using binary search technique.
Appeared in:
• Feb 2023 – Module 3 – Q5(b)

Common questions

Powered by AI

Binary search works on sorted arrays by repeatedly dividing the search interval in half and comparing the target value to the middle element, eliminating half the search space each time . This technique offers significant computational efficiency with a time complexity of O(log n), compared to the O(n) complexity of linear search, providing faster searches especially in large datasets.

In C, a one-dimensional array is declared with a syntax like `int array[10];` and initialized with `int array[] = {1, 2, 3};` . A two-dimensional array is declared with `int matrix[3][3];` and can be initialized as `int matrix[3][3] = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}};` . The primary difference is that one-dimensional arrays store a list or linear sequence of elements, whereas two-dimensional arrays can be visualized as a table or grid of rows and columns.

Storage classes in C determine variable scope, lifetime, visibility, and memory location. `auto` is default for local variables; `static` retains value across function calls. `extern` indicates a global scope, allowing cross-file variable sharing. Example: `static int count;` keeps a count even if the function is called multiple times . Use `register` for variables frequently accessed for speed, usually hardware registers instead of RAM.

Writing a C program for matrix multiplication involves several steps: initializing two matrices, determining the dimensions that allow multiplication (i.e., columns in the first matrix equal rows in the second), and iterating through rows and columns to compute the products of elements which are summed to get the result at each position . This differs from matrix addition where the matrices must have the same dimensions and the operation involves directly adding corresponding elements.

In C, a function groups code into a reusable block. The declaration specifies the function's name and signature, as `int add(int, int);` . The definition outlines the block's functionality, such as: `int add(int a, int b) { return a + b; }` . This function is called with `add(3, 4);` integrating it into a program's flow by executing its code block.

You might also like