Question Paper Code : 50895
B.E./B.Tech. DEGREE EXAMINATIONS, APRIL/MAY 2024.
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.
List at least any ten keywords in C language.
- 2.
What is the output of the following program? #include <stdio.h> int main() { int i; i = 1, 2, 3; printf ("%d", i); return 0; }
- 3.
What is the output of the following code int main() { int a[4] = {1, 2, 3, 4}; a++; printf("%d", *a); return 0; }
- 4.
What will be the value of var for the following String Operations statement in C language? var = strcmp ("Hello", "World");
- 5.
How the pow() function is defined and which header file provides it?
- 6.
Differentiate pass by reference and pass by value in C.
- 7.
How the nested structure can define in C, explain with syntax and example?
- 8.
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); }
- 9.
What is the typedef function in C?
- 10.
List the properties of Command-Line arguments in C.
PART B — (5 × 16 = 80 marks)
- 11.(a)
- (i)Discuss the structure of C program in detail and explain with simple hello world program.(8)
- (ii)Explain the terms variables and constants. How many types of variables are supported by C.(8)
- Or
- (b)
- (i)What is purpose of Decision Control Statements in C? Explain any two of such types with the general form of simple statements.(8)
- (ii)What are the functionalities of Preprocessor and Compiler? Explain with a simple example.(8)
- 12.(a)
- (i)Compare one dimensional and two dimensional array. Explain the use of multi-dimensional arrays with syntax and example.(10)
- (ii)Explain the four string functions with suitable examples.(6)
- Or
- (b)
- (i)Write an algorithm to sort an array of integers in ascending order using selection sort and find its time complexity.(10)
- (ii)Write a simple binary search program using an iterative method.(6)
- 13.(a)
- (i)Write different types of functions with respect to return type arguments and explain all types with syntax and example.(10)
- (ii)Explain the header file that contains various methods for performing mathematical operations.(6)
- Or
- (b)
- (i)Discuss call by value and call by reference with some simple program.(10)
- (ii)What is a recursive function? Write a simple binary search algorithm using recursive functions.(6)
- 14.(a)
Explain in detail about the dynamic memory allocation process and list memory allocation/deallocation functions.
- Or
- (b)
Discuss the concepts, advantages of self-referential structures and its types and explain with an example program.
- 15.(a)
What is File Organization? Explain its types with pros and cons.
- Or
- (b)
- (i)What is a File and list any five operations that can be performed on a file.(8)
- (ii)What are command line arguments in C? Explain with a suitable program.(8)