Question Paper Code : 70069
B.E./B.Tech. DEGREE EXAMINATIONS, NOVEMBER/DECEMBER 2022.
Second Semester
Computer Science and Engineering
CS 3251 — PROGRAMMING IN C
(Common to : Computer Science and Engineering (Data Science)/Electrical and Computer Engineering/Computer Science and Engineering (Artificial Intelligence and Machine Learning)/Computer Science and Engineering (Cyber Security)/Computer and Communication Engineering/Information Technology)
(Regulations 2021)
Answer ALL questions.
PART A — (10 × 2 = 20 marks)
- 1.
What are the various types of operators?
- 2.
What is the use of preprocessor directive?
- 3.
Declare a float array of size 5 and assign 5 values to it.
- 4.
Sort the following elements using selection sort method 23,55,16,78,2.
- 5.
How is pointer arithmetic done?
- 6.
Which is better to use? Macro or function. Justify your answer.
- 7.
What is meant by structure definition?
- 8.
Define self-referential data structure.
- 9.
Why are files needed?
- 10.
Give an example for fseek().
PART B — (5 × 16 = 80 marks)
- 11.(a)
Explain the storage classes in 'C' with suitable examples.
- Or
- (b)
Explain the looping statement in C with suitable examples.
- 12.(a)
- (i)Write a C program to multiply two matrices (2D array) by getting input from the user.(8)
- (ii)Write a C program to find scaling of two matrices (2D array) which will be entered by a user.(8)
- Or
- (b)
- (i)Write a C program to find determinant of a matrix (2D array) which will be entered by a user.(8)
- (ii)Write a C program for matrix transpose.(8)
- 13.(a)
- (i)Classify the function prototypes with suitable examples.(8)
- (ii)Write a C program to design the scientific calculator using built-in functions.(8)
- Or
- (b)
- (i)Explain the concept of pass by value and pass by reference. Write a C program to swap the content of two variables using pass by reference.(8)
- (ii)Explain about pointers and write the use of pointers in arrays with suitable example.(8)
- 14.(a)
What is a structure? Create a structure with data members of various types and declare two structure variables. Write a program to read data into these and print the same. Justify the need for structured data type.
- Or
- (b)
Write a C program to create mark sheet for students using self-referential structure.
- 15.(a)
- (i)Write a C program to get name and marks of 'n' number of students from user and store them in a file.(8)
- (ii)Write a C program to read name and marks of 'n' number of students from user and store them in a file. If the file previously exits then append the information into the existing file.(8)
- Or
- (b)
- (i)Write a C program to write all the members of an array of structures to a file using fwrite(). Read the array from the file and display on the screen.(8)
- (ii)Describe command line arguments with example C program.(8)