ANNA UNIVERSITY · REGULATION 2021
Important Questions
CS 3251 — PROGRAMMING IN C
Second Semester · Computer Science and Engineering
Prepared from 6 previous year question papers (Nov/Dec 2024, Apr/May 2024, Nov/Dec 2023, Apr/May 2023, Nov/Dec 2022, Apr/May 2022). Every question was compared with the others of its unit; the ones asked more than once come first. "Most asked topics" shows in how many different exams a syllabus topic had a question.
UNIT 1Basics of C Programming
Most asked topics: Structure of C program (4/6) · Looping statements (4/6) · Keywords (3/6) · Switch statement (3/6) · Applications of C Language (1/6) · Constants (1/6)
Part A · 2 marks
- 1.Write any two applications of C language.(2)
Asked in Nov/Dec 2024
- 2.Differentiate while and Do-While Loop statements.(2)
Asked in Nov/Dec 2024
- 3.List at least any ten keywords in C language.(2)
Asked in Apr/May 2024
- 4.What is the output of the following program? #include <stdio.h> int main() { int i; i = 1, 2, 3; printf ("%d", i); return 0; }(2)
Asked in Apr/May 2024
- 5."Keywords cannot be used as Identifiers" - Justify the correctness of the statement.(2)
Asked in Nov/Dec 2023
- 6.Distinguish between 'While' and 'Do-While' looping constructs with one example.(2)
Asked in Nov/Dec 2023
Part B · 16 marks
- 1.(i) Write a C program to check whether the person is eligible for voting using if/else. (ii) Write a C program to print the grade of student using switch statement.(16)
Asked in Nov/Dec 2024
- 2.(i) Write a structure of a C program. (ii) Explain the preprocessor directives in C programming.(16)
Asked in Nov/Dec 2024
- 3.(i) Discuss the structure of C program in detail and explain with simple hello world program. (ii) Explain the terms variables and constants. How many types of variables are supported by C.(16)
Asked in Apr/May 2024
- 4.(i) What is purpose of Decision Control Statements in C? Explain any two of such types with the general form of simple statements. (ii) What are the functionalities of Preprocessor and Compiler? Explain with a simple example.(16)
Asked in Apr/May 2024
UNIT 2Arrays and Strings
Most asked topics: Selection sort (4/6) · compare (3/6) · Initialization (2/6) · One dimensional array (2/6) · Two dimensional arrays (1/6) · linear and binary search (1/6)
Part A · 2 marks
- 1.Write down the syntax and give an example for array initialization.(2)
Asked 2 times: Apr/May 2023, Apr/May 2022
- 2.If String 1="C Programming" and String 2="Language"; Write the built-in functions to (a) Find the length of the String 1 ; (b) Compare two strings. Whether they are equal.(2)
Asked in Nov/Dec 2024
- 3.What will happen if in a C program you assign a value to an array element whose subscript exceeds the size of array?(2)
Asked in Nov/Dec 2024
- 4.What is the output of the following code int main() { int a[4] = {1, 2, 3, 4}; a++; printf("%d", *a); return 0; }(2)
Asked in Apr/May 2024
- 5.What will be the value of var for the following String Operations statement in C language? var = strcmp ("Hello", "World");(2)
Asked in Apr/May 2024
- 6.Give an example for initialization of a 2D array with a set of values.(2)
Asked in Nov/Dec 2023
Part B · 16 marks
- 1.Write a program using array to read and display the information about an employee and also calculate the payroll of an employee.(16)
Asked in Nov/Dec 2024
- 2.(i) Write a C program to perform Matrix Multiplication. (ii) Write a C programming to Sort the following numbers using selection sort : 45,6,89,3,4,56,10.(16)
Asked in Nov/Dec 2024
- 3.(i) Compare one dimensional and two dimensional array. Explain the use of multi-dimensional arrays with syntax and example. (ii) Explain the four string functions with suitable examples.(16)
Asked in Apr/May 2024
- 4.(i) Write an algorithm to sort an array of integers in ascending order using selection sort and find its time complexity. (ii) Write a simple binary search program using an iterative method.(16)
Asked in Apr/May 2024
UNIT 3Functions and Pointers
Most asked topics: Pointers (4/6) · Pass by reference (4/6) · function call (2/6) · Arrays and pointers (2/6) · Array of pointers (2/6) · Modular programming (1/6)
Part A · 2 marks
- 1.What is the Output of following program? # include <stdio.h> void fun(int *ptr) { *ptr = 30; } int main() { int y = 20; fun(&y); printf("%d", y); return 0 ; }(2)
Asked in Nov/Dec 2024
- 2.List any two math built-in functions.(2)
Asked in Nov/Dec 2024
- 3.How the pow() function is defined and which header file provides it?(2)
Asked in Apr/May 2024
- 4.Differentiate pass by reference and pass by value in C.(2)
Asked in Apr/May 2024
- 5.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); }(2)
Asked in Nov/Dec 2023
- 6.If p is a pointer to a float array a[10] with base address 1000, then what is the value of p after executing the statement p++; ? Justify your answer.(2)
Asked in Nov/Dec 2023
Part B · 16 marks
- 1.(i) Write a C program to generate fibonacci series using a recursive method. (ii) Compare pass by value and pass by reference with an example.(16)
Asked in Nov/Dec 2024
- 2.(i) Write a C program to find if the string is palindrome or not. (ii) Write a program in C to count the number of vowels and consonants in a string using a pointer.(16)
Asked in Nov/Dec 2024
- 3.(i) Write different types of functions with respect to return type arguments and explain all types with syntax and example. (ii) Explain the header file that contains various methods for performing mathematical operations.(16)
Asked in Apr/May 2024
- 4.(i) Discuss call by value and call by reference with some simple program. (ii) What is a recursive function? Write a simple binary search algorithm using recursive functions.(16)
Asked in Apr/May 2024
UNIT 4Structures and Union
Most asked topics: Structure (6/6) · Singly linked list (4/6) · Union (3/6) · Array of structures (2/6) · Self referential structures (2/6) · Dynamic memory allocation (2/6)
Part A · 2 marks
- 1.What are self referential structures?(2)
Asked in Nov/Dec 2024
- 2.Write the syntax for dynamic memory allocation.(2)
Asked in Nov/Dec 2024
- 3.How the nested structure can define in C, explain with syntax and example?(2)
Asked in Apr/May 2024
- 4.What will be the output of the following C code? #include<stdio.h> main() { typedef int a; a b = 2, c = 8, d; d = (b * 2) / 2 +8; printf ("%d", d); }(2)
Asked in Apr/May 2024
- 5.Differentiate 'Structure' and 'Union'.(2)
Asked in Nov/Dec 2023
- 6.Illustrate with an example for each, the following operators with regard to pointers and structures. &, *, . , ->(2)
Asked in Nov/Dec 2023
Part B · 16 marks
- 1.A record contains information regarding In-Patient System such as pname, Address, PID and Admission_Date. Create a structure to hold the records of In-Patients. Write a C program : (i) To insert a new patient into the patient system. (ii) To print all In-Patient details according to the Admission_Date.(16)
Asked in Nov/Dec 2024
- 2.(i) Explain the various operations on Singly linked List. (ii) Write a short note on structures.(16)
Asked in Nov/Dec 2024
- 3.Explain in detail about the dynamic memory allocation process and list memory allocation/deallocation functions.(16)
Asked in Apr/May 2024
- 4.Discuss the concepts, advantages of self-referential structures and its types and explain with an example program.(16)
Asked in Apr/May 2024
UNIT 5File Processing
Most asked topics: Command line arguments (5/6) · Random access (2/6)
Part A · 2 marks
- 1.List the properties of Command-Line arguments in C.(2)
Asked 2 times: Apr/May 2024, Apr/May 2022
- 2.Differentiate between Sequential and random access.(2)
Asked in Nov/Dec 2024
- 3.Write the functions of fscanf() and fprintf().(2)
Asked in Nov/Dec 2024
- 4.What is the typedef function in C?(2)
Asked in Apr/May 2024
- 5.What will be the values for argc and argv[ ] when the input "run with my values" is passed as command line arguments?(2)
Asked in Nov/Dec 2023
- 6.Name any two functions used in Random access files and specify their use in C programming.(2)
Asked in Nov/Dec 2023
Part B · 16 marks
- 1.Write a C program to copy content of one file to another file.(16)
Asked in Nov/Dec 2024
- 2.List the various types of file processing and explain any two.(16)
Asked in Nov/Dec 2024
- 3.What is File Organization? Explain its types with pros and cons.(16)
Asked in Apr/May 2024
- 4.(i) What is a File and list any five operations that can be performed on a file. (ii) What are command line arguments in C? Explain with a suitable program.(16)
Asked in Apr/May 2024