Sie sind auf Seite 1von 3

United International University (UIU)

Dept. of Computer Science & Engineering (CSE)


Final Exam : : Trimester: Summer 2020
Course Code: CSE 1111/CSI 121, Course Title: Structured
Programming Language (SPL): Set B
Total Marks: 25 Duration: 1 hr 15 mins

Answer ALL questions. Write in your own words. Do not copy & paste from web.

1. (a) Can you take “Hello World” as input using scanf() function? If yes, explain why? If
you can't, explain how can you take “Hello World” correctly as input and why? [2]
(b) Write a C program that does the following: [3]
i. In the main function, take a string and a character from user as inputs.
ii. Create a function strSearch(….) that accepts the string and character as
parameters. It will try to find the first occurrence of the character in the string. If
found, it will swap the first character of the string with the first occurrence of the
character.
iii. In the main() function, call the strSearch function and display the string.
Sample input Sample Output
Programming mrograPming
m
comprehension somprehencion
s

2. (a) Create a structure named Club to store matches played, matches won, matches lost,
and points of a Football club. [1]
(b) Write a function struct Club takeInput() that will take the above information for a
club from keyboard and return the club structure. [1]
(c) Write a function void showPointsLessThan60(struct Club clubs[], int len) that will
print all the details of the clubs who have scored less than 60 points but lost not more than
5 games on separate lines. [1.5]
(d) In main function, declare an array of size M of type Club structures, take their inputs
from keyboard, and display the information of clubs who have scored less than 60 points
but lost not more than 5 games using the above created functions. [1.5]
3. (a) Describe in your own words the difference between pass by value and pass by
reference? Also, show differences in their codes. [2]
(b) Write a program, where in the main function, it will take two int values of a range:
minRange and maxRange as input. Then, it calls a function void printMultiple(int
minRange, int maxRange) passing the two range values. You need to implement the
printMultiple function. The printMultiple function will print all the numbers within that
range that are multiple of 5. [3]

4. (a) The following functions are given. Which of the following function calls are valid and
which are invalid? Write brief explanations for the invalid calls. [2]

i) float a = division(3,2);
ii) int b = add(4,5) * add(0,1);
iii) division(3,2) = a;
iv) add(10,20);

(b) In which order the following functions will be called? What will be the output of the
following program? [2+1=3]
5. (a) (i) Explain the output of the following program. (ii) Rewrite (by making necessary
changes in) the code to print all the numbers between 1 to 10 in ascending order. [2]

(b) Write a program with a for loop that counts from 9 to 0. Inside the loop, it displays
the numbers on the screen using a pointer variable. [2]
(c) What are the differences between C file operation mode “r+” and “a+”? [1]

[Any examinee found adopting unfair means will be expelled from the trimester /
program as per UIU disciplinary rules.]

Das könnte Ihnen auch gefallen