// Anna University, Chennai / 2025
Anna University — Programming in C (CS3251), November/December 2025
Programming in C · CS3251 · R2021 · B.E./B.Tech. Engineering (common paper) · Semester 2
Files open in a new tab. Use your browser's download or save option to keep a copy.
Work through the questions
15 questions
No verified answers are available for this paper.
Write program snippets that print the first 10 odd numbers using a while loop and a for statement.
No verified answer or solution is available for this question.
Name any four preprocessor directives.
No verified answer or solution is available for this question.
Find the output of the following code snippet. #include<stdio.h> int main() { int arr[8]; int n=0; while (n<8) { arr[n] = ++n; } }
No verified answer or solution is available for this question.
- 2025
- 2023
Also asked in Anna University — Programming in C (CS3251), November/December 2023 (2023).
Write any two string handling functions in C with their syntax and purpose.
No verified answer or solution is available for this question.
Predict the output: #include <stdio.h> int main() { int a=10, b=20, *p, s=0; p = &a; a++; *p++; s=a+b+*p; printf("%d\n",s); return 0; }
No verified answer or solution is available for this question.
Give the declaration syntax for passing a function to other functions.
No verified answer or solution is available for this question.
- 2026
- 2025
- 2023
Also asked in Anna University — Programming in C (CS3251), April/May 2026 (2026), Anna University — Programming in C (CS3251), November/December 2023 (2023).
Differentiate a structure and a union.
No verified answer or solution is available for this question.
Give an example of using a static variable in a scope.
No verified answer or solution is available for this question.
When are fread() and fwrite() used in file processing?
No verified answer or solution is available for this question.
- 2025
- 2023
Also asked in Anna University — Programming in C (CS3251), November/December 2023 (2023).
Name any two functions used in random access files and specify their use in C.
No verified answer or solution is available for this question.
(a) (i) List C operators and their precedence rules. Evaluate the expressions below given a = 5, b = 3 and c = -8. (4 + 3 + 3 marks) (1) S = (a+b)/c % d - a+b * (a/b) (2) a==b && a<c (ii) Distinguish keywords and identifiers with examples of each. (6 marks) (OR) (b) (i) Find the output of the following C code and discuss the execution steps. (6 marks) main() { int t = 2, j = 3, k, p; float a, b; k = t / j * j; I = j / t * t; a = t / j * j; b = j / t * t; printf("%d %d %f %f", k, p, a, b); } (ii) Illustrate these with suitable examples: (1) replacing if-else with a conditional operator and (2) break and continue statements. (5 + 5 marks)
No verified answer or solution is available for this question.
(a) (i) Write a C program to display the most frequent character in a one-dimensional character array. (6 marks) (ii) Write a C program that creates two integer matrices and prints the values in the second matrix that are absent from the first. (10 marks) (OR) (b) (i) Write pseudocode to implement binary search. (6 marks) (ii) Using string functions in C, (1) accept a string and a substring and print how many times the substring occurs (5 marks), and (2) accept a string and uppercase characters in odd positions and lowercase characters in even positions (5 marks).
No verified answer or solution is available for this question.
(a) (i) Illustrate the difference between a pointer to an array and an array of pointers. (6 marks) (ii) Write a C program that calculates the total marks and grade of n students using arrays passed to a function. (10 marks) (OR) (b) (i) Use pointers and functions to count positions in two matrices that contain the same element. (10 marks) (ii) Differentiate call by value and call by reference with appropriate examples. (6 marks)
No verified answer or solution is available for this question.
(a) (i) Give an example of a nested structure and a self-referential structure. (4 + 5 marks) (ii) Explain insertion at the middle and deletion at the beginning of a singly linked list. (7 marks) (OR) (b) Create a structure to store dress code, gender, size, category and price. Use typedef and pointers to write a C program that generates a bill for a family shopping for clothes: (i) If the purchase includes any dress for a girl under 10, give a 5% discount on the total. (8 marks) (ii) If the purchase includes any dress for a boy under 5, give a 3% discount on the total. (8 marks)
No verified answer or solution is available for this question.
(a) (i) Give an example of using command line arguments. (6 marks) (ii) Write a C program to collect customer registration details for Amazon, including name, gender, occupation and age, and store them as structures in a file. Create a second file for customers rejected because they are under 20. (10 marks) (OR) (b) (i) Create trains.txt in C for trains passing through Bangalore Junction. Use file operations to (1) add the details of a new train (5 marks) and (2) delete records for all trains whose destination is Chennai (5 marks). (ii) List the modes for opening a C file and explain the purpose of each. (6 marks)
No verified answer or solution is available for this question.