B.E. / [Link]. / [Link].
First & Second Semester (Common for all Branches) (NEP) Winter 2024
ESC - Computer Programming
P. Pages : 2 AG - 7466
Time : Three Hours *5383* Max. Marks : 60
_____________________________________________________________________
Notes : 1. Due credit will be given to neatness and adequate dimensions.
2. Illustrate your answer necessary with the help of neat sketches.
3. Use of pen Blue/Black ink/refill only for writing the answer book.
SECTION-A
1. a) What are keywords in C? Why they are important? 6
12
b) Find output of the following program: 4
7:
# include stdio.h
Void main ( )
:3
{
12
Int i = 15, j = 4, m, n;
m = i > 9;
n = j > 4 & & j! = 2;
printf(“m=%d n=%d”, m, n); 5
02
}
OR
/2
2. a) Write a C program that converts a given temperature in Celsius to Fahrenheit using the 4
01
expression-
Fahrenheit = (Celsius * 9/5) + 32.
/
20
b) Explain basic Data Types in C. 6
3. a) What are concise test expression in C? Explain with an example. 5
8
38
b) Write a C program to calculate the factorial of a number using a loop. 5
OR
H
4. a) Write a C program to enter any number and print its reverse. 4
kC
b) Give the difference between ‘continue’ and ‘break’ with example. 4
B
c) Find output of the following code- 2
# include stdio.h
int main ( ) {
int x = 2;
switch (x) {
case 1 : printf (“One”); break;
case 2 : printf (“Two”);
default: printf (“befault”);
}
Return 0;
}
AG - 7466 1 P.T.O
5. a) What is multidimensional array in C? How is it declared and accessed? 5
b) Write a C program to calculate the average of an array of numbers. 5
OR
6. a) Write a C program to find the largest and smallest element in an array. 6
b) Find the output of the code- 4
# include stdio.h
int. main ( ){
int arr [ ] = {5, 10, 15, 20, 25};
printf (“% d\n”, arr [2]);
printf (“% d\n”, arr [4]);
printf (“%d\n”, arr [1] + arr [3]);
12
printf (“% d\n”, arr [0] * arr [4]);
return 0;
7:
}
SECTION-B
:3
7. a) Explain the difference between strupr ( ) and strlwr ( ) functions in C. Provide examples of 6
12
their usage.
b) Write a C program to find the length of the string without using built in string function. 4
5
OR
02
8. a) Write a C program to count the number of Vowels and Consonants in a string. 5
/2
b) Explain how to read a string from the terminal and display it on the screen in C. 5
01
9. a) Explain the difference between pass by value and pass by reference in function calls. 5
/
b) What is pointer? Explain with example. 3
20
c) What is the output of following code- 2
# include stdio.h
8
main ( )
38
{
Printf (“\n computer”);
H
main ( );
kC
}
OR
B
10. a) Write a C program to swap two numbers using a function. 5
b) Explain recursive function with example. 5
11. a) Explain the functions used for opening and closing files in C. 4
b) What is Union? Differentiate structure and union. 6
OR
12. a) Define a struct and use type def to represent a Book, including details such as title, author, 4
price, publication year.
b) Write a C program to read and display the contents of a text file. 6
************
AG - 7466 2