Skip to content

// 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.

  1. Question 1

    Part AUnit 1Descriptive2 marks

    Programming in C

    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.

  2. Question 2

    Part AUnit 1Descriptive2 marks

    Programming in C

    Name any four preprocessor directives.

    No verified answer or solution is available for this question.

  3. Question 3

    Part AUnits 1, 2Descriptive2 marks

    Programming in C

    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.

  4. Question 4

    Part AUnit 2Descriptive2 marks

    Programming in C

    Write any two string handling functions in C with their syntax and purpose.

    No verified answer or solution is available for this question.

  5. Question 5

    Part AUnit 3Descriptive2 marks

    Programming in C

    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.

  6. Question 6

    Part AUnit 3Descriptive2 marks

    Programming in C

    Give the declaration syntax for passing a function to other functions.

    No verified answer or solution is available for this question.

  7. Question 7

    Part AUnit 4Descriptive2 marks

    Programming in C

    Differentiate a structure and a union.

    No verified answer or solution is available for this question.

  8. Question 8

    Part AUnit 4Descriptive2 marks

    Programming in C

    Give an example of using a static variable in a scope.

    No verified answer or solution is available for this question.

  9. Question 9

    Part AUnit 5Descriptive2 marks

    Programming in C

    When are fread() and fwrite() used in file processing?

    No verified answer or solution is available for this question.

  10. Question 10

    Part AUnit 5Descriptive2 marks

    Programming in C

    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.

  11. Question 11

    Part BUnit 1Descriptive16 marks

    Programming in C

    (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.

  12. Question 12

    Part BUnit 2Descriptive16 marks

    Programming in C

    (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.

  13. Question 13

    Part BUnits 2, 3Descriptive16 marks

    Programming in C

    (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.

  14. Question 14

    Part BUnits 3, 4Descriptive16 marks

    Programming in C

    (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.

  15. Question 15

    Part BUnits 4, 5Descriptive16 marks

    Programming in C

    (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.

Keep preparing

Revisit another year or explore a different paper in the library.

More from this exam