Skip to content

// Anna University, Chennai / 2023

Anna University — Programming in C (CS3251), November/December 2023

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

    Justify the statement, "Keywords cannot be used as identifiers."

    No verified answer or solution is available for this question.

  2. Question 2

    Part AUnit 1Descriptive2 marks

    Programming in C

    Distinguish while and do-while loops with one example.

    No verified answer or solution is available for this question.

  3. Question 3

    Part AUnit 2Descriptive2 marks

    Programming in C

    Give an example of initializing a two-dimensional array with a set of values.

    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

    Find the output of the following code. int main() { int a = 10, b = 20; change(&a, b); printf("\n Inside Main : %d %d\n", a, b); return 0; } void change(int *p, int q) { *p = *p*3; q = q*4; printf("\n Inside function : %d %d", *p, q); }

    No verified answer or solution is available for this question.

  6. Question 6

    Part AUnit 3Descriptive2 marks

    Programming in C

    If p points to a float array a[10] with base address 1000, what is the value of p after executing p++? Justify your answer.

    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 AUnits 3, 4Descriptive2 marks

    Programming in C

    Illustrate each of these operators with an example involving pointers or structures: &, *, ., ->.

    No verified answer or solution is available for this question.

  9. Question 9

    Part AUnit 5Descriptive2 marks

    Programming in C

    What are the values of argc and argv[] when the input "run with my values" is passed as command line arguments?

    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) Evaluate the following expressions using operator precedence. Explain the order of execution. (6 marks) (8*3-4)+(5%5 ? 3 : -9)+5-20/10 a*b+(c/d)-2^2-(e+4), where a = 2, b = 3, c = 8, d = 2, e = 5 (ii) Explain the various data types in C with suitable examples. (10 marks) (OR) (b) (i) Find the output of the following C code and discuss the execution steps. (4 marks) for(i=1,j=1; i<=10; ++i, ++j) { if (i == 3) { continue; } else { if (j == 4) { break; } else { printf("\ I am in loop, the values of I and J are: %d, %d", i,j); } } } (ii) Write a C program that accepts age and vaccination details. Use the conditional operator to print "Senior Citizen and Eligible for Booster" if age > 60 and the vaccination input is 2. Otherwise print "Below 60, and Eligible for Vaccination". (5 marks) (iii) Can an if-else ladder be converted to a switch-case statement? Illustrate if possible, or justify why it cannot be done. (7 marks)

    No verified answer or solution is available for this question.

  12. Question 12

    Part BUnit 2Descriptive16 marks

    Programming in C

    (a) (i) Write the string handling function used for each task: combine the first, last and middle names into the full name, show its character count, make the first name uppercase and last name lowercase, and print the full name in reverse order. (2 + 2 + 2 + 2 marks) (ii) Restaurant tables are arranged in rows and each row has an assigned waiter. Write a C program to find the highest bill served by each waiter. (8 marks) (OR) (b) (i) Explain binary search with an example. Show how to search for 14 in the array 12, 56, 90, 14, 19, 63, 88, 25, 37, 49, 110. (3 + 4 marks) (ii) A marathon has 5 tracks, each with n participants. Find the youngest and oldest participant in each track. (9 marks)

    No verified answer or solution is available for this question.

  13. Question 13

    Part BUnits 2, 3Descriptive16 marks

    Programming in C

    (a) (i) Write a C program to create two 2D arrays using arrays of pointers. The first lists employee names and the second lists their designations. Display the designation when a name is entered. (13 marks) (ii) Give an example of a function that receives parameters and returns no value. (3 marks) (OR) (b) (i) Create an array of lucky ticket numbers, accept a ticket number, check it for a prize and display the result using a pointer to the array. (12 marks) (ii) Differentiate pass by value and pass by reference with an example. (4 marks)

    No verified answer or solution is available for this question.

  14. Question 14

    Part BUnit 4Descriptive16 marks

    Programming in C

    (a) (i) Give an example of a nested structure and a self-referential structure. (6 marks) (ii) List linked-list operations. Explain insertion at the end and deletion at the beginning of a singly linked list. (6 marks) (iii) Distinguish calloc() and malloc(). (4 marks) (OR) (b) (i) A furniture structure holds a shop's furniture information. Write a function call passing a pointer to the structure and the number of furniture items, and give the corresponding function definition statement. (8 marks) (ii) Write the function body that prints details of n furniture items. (4 marks) (iii) Use typedef to define furniture as an array of structures. (4 marks)

    No verified answer or solution is available for this question.

  15. Question 15

    Part BUnits 4, 5Descriptive16 marks

    Programming in C

    (a) (i) State the purpose of fseek() in random access files. (3 marks) (ii) When are fread() and fwrite() used in file processing? (5 marks) (iii) List the modes in which a C file can be opened and explain the purpose of each. (5 marks) (iv) What is the use of feof()? (3 marks) (OR) (b) Write a C program that creates a binary file named application.txt with citizen name, Aadhaar number, PAN number, employment, gender and age. Filter by gender and employment and move male applicants who are self-employed into reject.txt. Assume at least 10 candidates.

    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