Assignment 2
Assignment 2
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
UNIT IV
2 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
16 Marks