0% found this document useful (0 votes)
8 views

Assignment 2

The document outlines a series of programming exercises and questions related to arrays, pointers, functions, and structures in C programming. It includes tasks for defining concepts, writing C programs for various operations, and explaining differences between data structures. The document is divided into units with questions worth 2 and 16 marks, covering fundamental programming concepts and practical applications.

Uploaded by

PAVITHRA
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

Assignment 2

The document outlines a series of programming exercises and questions related to arrays, pointers, functions, and structures in C programming. It includes tasks for defining concepts, writing C programs for various operations, and explaining differences between data structures. The document is divided into units with questions worth 2 and 16 marks, covering fundamental programming concepts and practical applications.

Uploaded by

PAVITHRA
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

UNIT III

2 Marks

1. Define array.
2. Write a C program read n numbers and find the sum.
3. What will happen when you access the array more than its dimension?
4. What are various ways to initialize the values to 2D array.
5. Give the syntax for two dimensional arrays?
6. How does an ordinary variable differ from an array definition?
7. Write a c program to find length of a string.
8. Write few advantages of Arrays?
9. How strings are represented in language C?
10. Distinguish between character array and string.

16 Marks

1. a) Write a C program to check whether a string is palindrome or not.


b) Write a C program for transpose of a matrix using array
2. a) Develop a C program to sort N names alphabetically
b) Develop a C program to sort N numbers in ascending order
3. a) Write a C Program to searching an element in an array
b) Write a C Program to inserting an element into an array
4. a) Write a C program to find the Multiplication of two matrices.
b) Write a C program to find the largest and smallest number in the given array
5. a) Briefly explain the various string handling functions in C
b) Write a C program to convert the given string from lowercase character to uppercase and
uppercase to lowercase (eg. Hello=hELLO)
6. a) Write a C program to find sum of the diagonal elements of a matrix.
b) Write a C program to find the addition of two matrices.
7. Write a C program to read m × n matrix and to check whether the element of last column of
each row is the sum of the elements of the other column in the row.

UNIT IV
2 Marks

1. What is an argument? Differentiate between formal arguments and actual arguments.


2. How a variable is declared to be a pointer?
3. What do you mean by a pointer? Mention its uses
4. Write the C code for finding the sum of N integers using pointers
5. What is the difference between call by value and call by reference?
6. How does a function work? Explain how arguments are passed and results are returned?
7. Write few advantages of using function?
8. Define Null pointer.
9. Define pointer-to-pointer.
10. Define Recursion.
16 Marks

1. What do you mean by call by reference and call by value? Write a program in C to exchange
the value of two variables using call by reference.
2. Write a function using pointers to add matrix and to return the resultant matrix to the calling function
3. a) Write a C program to count the number of words in a string using pointers.
b) Write a C program to find the factorial of a given number using recursion.
4. a) What is Pointer? How to pass pointer as an argument in function?
b) Write a C program using pointer to read in an array of integers and print its elements in
reverse order.
5. a) How can you pass an array to a function by value?
b) Write a C program to find the sum of the series:
S = 1+x+x2+x3+…+xn
6. a) Explain about the different parameter passing methods with examples.
b) Write a C function to evaluate the series
sin(x) = x − (x3 / 3!) + (x5 / 5!) − (x7 / 7!) + …
7. a) Write a recursive function to obtain the first 25 numbers of a Fibonacci sequence.
b) Write a function to calculate sum of digits of the number.

UNIT V
2 Marks

1. What are the advantages of unions over structures?


2. Define Structure.
3. Define Union.
4. Distinguish between Structure and Union.
5. Distinguish between Array and Structure.
6. Write the syntax for nesting of structures?
7. Define preprocessor.
8. How structure elements can be accessed?
9. Give the rules for defining preprocessor.
10. What is meant by storage class?

16 Marks

1. a) Explain about structure declaration in C with suitable example


b) Write notes on preprocessor directives in ‘C’.
2. a) Define macro substitution preprocessor directive in C.
b) Write a C program to calculate and print student grade using structure.
3. Write a program to print a list of names and address using array of structure concept.
4. Write C program to read and write employee details and their date of joining using nested
structure.
5. Write a C program that gets and displays the report of n students with their personal and
academic details using union.
6. Explain, with examples, the different types of storage classes in C.

You might also like