Roll Number: __________________________Name of student: ________________________
NATIONAL INSTITUTE OF TECHNOLOGY, JAMSHEDPUR
Department of Computer Science and Engineering
(Spring Sem) End Semester Examination, April, 2022
B. Tech (First Year, Civil Engg): II Semester Course Code: CS1101
Course Name: Introduction to Programming
and DS (CE)
Date of Exam: 18/04/2022 Mode: OPEN BOOK
Time: 3 Hours, M. Marks: 50 Name of Faculty: Dr. Mudassir Rafi
Note: Attempt all questions. Each question carries ten marks.
Question 1: (a) Answer the following questions:
(5 x 2= 10 marks)
[1]. What are various data types used in C Language.
[2]. How do you declare an array of 10 pointers pointing to integers?
[3]. What will be the output of the following C code?
1. #include <stdio.h>
2. void main()
3. {
4. int x = 1, y = 0, z = 5;
5. int a = x && y || z++;
6. printf("%d", z);
7. }
[4]. What will be the output of the following C code?
1. #include <stdio.h>
2. int main()
3. {
4. int i = 3;
5. int l = i / -2;
6. int k = i % -2;
7. printf("%d %d\n", l, k);
8. return 0;
[5]. What will be the output of the following program?
1. #include <stdio.h>
2. int main()
3. {
4. int i=5;
5. for(;scanf(“%s”,&i);printf(“%d\n”,i));
6. return 0;
7. }
Question 2: (a) Write a C program into generate first n prime numbers.
(5 marks)
(b) Differentiate between the three types of loops present in C programming.
(5 marks)
Question 3: (a) Define array of Structure and Array of strings. Write a program to count number
of vowels in a string entered by the user.
(5 marks)
(b) Define Dynamic memory allocation. How does it help in developing complex program?
(5 marks)
Question 4: (a) Write a program to create a file which will store student (name, roll no., marks) record.
(5 marks)
(b) Write short notes on any two of the following:
(5 marks)
I. C as a Structural Programming language
II. Self-Referential Structure
III. Storage Classes
IV. String
Question 5: (a) Write a program in C to exchange the content of two variables without using third variable.
(5 marks)
(b) Illustrate the concept of Pass by Value and Pass by reference with example.
(5 marks)