Module 5
Question Bank
January 2024
1. Explain how a pointer is assigned with a structure in C and how the member
variable of structure is accessed using pointer?
(3 Marks)
2. What is the role of fseek() in C? Solve the given scenarios with fseek(), assume
file pointer is at 10 th character and there are 100 characters in the file.
(a) Set file pointer to the last character in the file.
(b) Set file pointer to the beginning of the file. (3 Marks)
3. Develop a c program to read numbers from a file and write odd numbers to one
file and even numbers to another file. (8 Marks)
4. Explain with suitable examples, how & and * operators are used with pointer
variable. (3 Marks)
5. Predict the output of the following C program code.
void main ()
{
int a[] = {30, 20, 10};
printf(“%d %d %d\n”, *a, *a+1, *(a+1));
} (3 Marks)
6. Write a C program using pointers to compute the Sum and Mean of all elements
stored in an array of n real numbers. (8 Marks)
7. With suitable example explain different modes for opening a file in C? (6 Marks)
June 2023
1. What is meant by the scale factor of a pointer variable? Explain using
examples. (3 Marks)
2. List out the various modes of opening a file in C language. (3 Marks)
3. Write a program to read and store the details (the name, employee code
(integer) and salary) of ‘n’ employees in a company into a file using structure.
Print the details of the employee whose employee code is given as input. (14 Marks)
4. What is meant by passing arguments into a function by reference? Write a
program to swap two numbers using pass by reference. (8 Marks)
5. Write a program to copy the content of a file to another. (6 Marks)
June 2022
1. Distinguish between text mode and binary mode operation of a file. (3 Marks)
2. What do you mean by a pointer variable? How is it initialised? (3 Marks)
3. Write a C program to replace vowels in a text file with character ‘x’. (7 Marks)
4. Explain how pointers can be passed to functions in C. (7 Marks)
5. Explain any 5 file handling functions in C? (7 Marks)
6. Write a C program to print the elements of an array in reverse order using
pointers. (7 Marks)
July 2021 (FN)
1. Write any three file handling functions in C. (3 Marks)
2. Differentiate between address operator(&) and indirection(*) operator. (3 Marks)
3. Explain the different modes of operations performed on a file in C language. (7 Marks)
4. Write a program in C to copy the contents of one file into another. (7 Marks)
5. Explain how pointers can be passed to functions in C. (7 Marks)
6. Explain any 5 file handling functions in C? (7 Marks)
July 2021 (AN)
1. Differentiate between char name[] and char *name in C. (3 Marks)
2. Explain the use of fseek() function. (3 Marks)
3. Explain any 5 file handling functions in C. (7 Marks)
4. Write a C program to reverse a string using pointers. (7 Marks)
5. Differentiate between array of pointers and pointer to an array. (7 Marks)
6. Write a C program to count number of lines in a text file. (7 Marks)