Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Btech 2022 1 Sem PPS-1 Sessional Ii

Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

DHARMSINH DESAI UNIVERSITY, NADIAD

FACULTY OF TECHNOLOGY
B.TECH. SEMESTER I [CE/EC/IT]
SUBJECT: (ESC201) PROGRAMMING FOR PROBLEM SOLVING - I

Examination : 2nd Sessional Seat No : ____________________


Date : 14/12/2022 Day : Wednesday
Time : 03.45pm to 05.00pm Max. Marks : 36

INSTRUCTIONS:
1. Figures to the right indicate maximum marks for that question.
2. The symbols used carry their usual meanings.
3. Assume suitable data, if required & mention them clearly.
4. Draw neat sketches wherever necessary.

Q.1 Do as directed. [12]


CO1 R (a) Define ‘Array’ in C and verify the statement “Array is a fundamental data [2]
type of C language”.

CO2 A (b) Demonstrate different ways of reading strings from terminal. [2]

CO2 A (c) Interpret and mention incorrect statement(s) from following that will not [2]
store the concatenation of strings s1 & s2 in string s3.
i. s3 = strcat(s1, s2);
ii. strcat(s3, s2, s1);
iii. strcpy(s3, strcat(s1, s2));
iv. strcpy(strcat(s1, s2), s3);

CO1 R (d) Explain nesting of functions in C. [2]

CO1 U (e) “Use of Terminating null character is a better logical solution while dealing [2]
with character arrays”. Explain above statement.

CO3 N (f) Differentiate ‘Pass by Value’ and ‘Pass by Address’. [2]

Q.2 Attempt Any TWO from the following questions. [12]

CO5 E (a) Predict the output by debugging the following code snippet(s): [6]
i)

ii)

CO5 E (b) Given are two one-dimensional arrays A and B which are sorted in [6]
ascending order. Write a program to merge them into a single sorted array
C that contains every item from Arrays A and B in ascending order.

Page 1 of 2
CO5 E (c) Formulate a recursive function “rec_fun” which will work according to [6]
given function call. Also write appropriate main() function.
Assume Function Prototype: “int rec_fun(int, int)”
Function Call: Function Call:
int x = rec_fun(2,5); int x = rec_fun(3,4);
Output: Output:
2 3
4 9
8 27
16 81
32

Q.3 Do as directed. [12]

CO4 C (a) Design a single user defined function which will perform matrix [6]
multiplication and subtraction. Results should be displayed in main().

CO3 N (b) Compare approaches of following two ways to reverse a string and write a [6]
program of any one:
i) Reverse a string without using any other char array. (In-place
reverse)
(Hint: str1=”Spain” → str1 = ”niapS”)
ii) Reverse a string with the help of another char array.
(Hint: str1=”Spain” → str2 = ”niapS”)

OR
Q.3 Do as directed. [12]

CO4 C (a) Design a c program which read one string S1 from user. String S1 might [6]
contain alphabets, digits and special characters. Create a string S2 that
contains all the alphabets from S1 and create a string S3 that contains all the
digits and special characters from S1. Also include Last character in String
S2 and S3 as total number of characters in it.

Hint:
S1 = “1Hello@3By3e” S1 = “Ab42@3xy4#”
S2 = “HelloBye8” S2 = “Abxy4”
S3 = “1@334” S3 = “42@34#6”

CO3 N (b) Examine following function categories and discuss their functionality. Also [6]
write code snippets for same:
i) Functions without argument and with return value (Code Snippet: Area of
Triangle)
ii) Functions with argument and with return value (Code Snippet: Area of a
Circle)

(Hint: Area of Circle = πr2, Area of Triangle = ½ x base x height)

Blooms Taxonomy levels: R-Remembering, U- Understanding, A-Applying, N-Analyzing, E- Evaluating, C-Creating

Page 2 of 2

You might also like