👁️ 287 views
University of Barishal Logo

University of Barishal

Department of Computer Science and Engineering

Final Exam

Course Title: Programming Fundamentals (CSE-1103)

Semester: 1st | Session: 22-23

Time: 180 minutes | Marks: 60.00

Exam Date: February 13, 2024

Answer any five Questions from the followings.

1.


a)

(i) If int i = 7, float f = 5.5, char c='a', What will be the output of (a)'i+c' and (b) 'i+f?

(ii) If int result, i=7, f=8.5, What will be the output of 'result=(i+f)%4'

(iii) If float num = 10.5, What will be the output of 'num%2' and '((int)num)%2'

Please SUBSCRIBE to view full question

Topics: N/A Solution is Coming!
4 Marks
b)

What will be the simplified form of the following

(i) !(a<b)

(ii) !(c<=d)

(iii) !(x=>y)

Please SUBSCRIBE to view full question

Topics: N/A Solution is Coming!
2 Marks
c)

List the syntax error (if any) of each line of the following code (copy the code on you script, mark the error by placing an underline and then explain that error, if you indicate anything as syntax error but really that is not a syntax error, then equivalent negative mark will be given)?

 

#include <stdio>

main()

{

Int x,y

scanf("%dd",&x,&y);

switch (x)

{ case(x<0): printf("x is negative"); break;

case (x>0); printf("x is negative");}

x=fl (y);

printf("Final value of = %d\n", x); }

void fl (int y)

{

y=y*y;

return y;

}

Please SUBSCRIBE to view full question

Topics: N/A Solution is Coming!
4 Marks
d)

What is the difference between the constants 7,'7',"7"?

Please SUBSCRIBE to view full question

Topics: N/A Solution is Coming!
2 Marks
2.


a)

What is meant by constant and variable? Write down the name of different constant types.

Please SUBSCRIBE to view full question

Topics: N/A Solution is Coming!
4 Marks
b)

Define escape sequence. List any 5(five) escape sequences used in C programming.

Please SUBSCRIBE to view full question

Topics: N/A Solution is Coming!
3 Marks
c)

Distinguish between unary and binary operator with example.

Please SUBSCRIBE to view full question

Topics: N/A Solution is Coming!
3 Marks
d)

Find the output of the following code.

void main() {

int a=, b=15, r, s;

float a, b, c;

a=i/j;

b=1.0*i/j;

c=i/j*1.0;

printf("%f%f%f",a,b,c);

}

Please SUBSCRIBE to view full question

Topics: N/A Solution is Coming!
2 Marks
3.


a)

How do do-while and while statement differ? When is a for, do-while, or while control statement preferable to use?

Please SUBSCRIBE to view full question

Topics: N/A Solution is Coming!
4 Marks
b)

What is the purpose of break statement? Suppose you are given an integer (positive and negative) type array containing n elements. Write a C code to find the position of first occurrence of negative number in an array. It is required to stop the searching when the first negative integer is found.

Please SUBSCRIBE to view full question

Topics: N/A Solution is Coming!
6 Marks
c)

Write a statement to create an infinite loop using while loop .

Please SUBSCRIBE to view full question

Topics: N/A Solution is Coming!
2 Marks
4.


a)

What is dynamic memory allocation?

Please SUBSCRIBE to view full question

Topics: N/A Solution is Coming!
3 Marks
b)

Write C program for the following problem, it does not need to think about run-time optimization. (Objective of the question: To check the standard analytical capacity of a student of 1 year as well as to check his/her problem understanding capacity)

 

The chairman of the dept. of CSE of Barishal University is popular for arranging regular innovative events for his students. One day, he planned to arrange a game for the students of 1st year in their electronics lab, and he declared that the winner would be awarded a special prize. As a result, all of the N number of students participated in that game. The chairman brought a basket that contained many balls; having three different colors: red (R), green (G) and blue (B). The numbers of balls of each color were equal and total number of the balls in the basket was 3N; however, the weights of the balls were different and were indicated by an integer number printed on respective ball. The chairman told the students to come up to him one by one and take exactly one red, one green and one blue ball within a second; the point earned by that student would be the product of the value of weights of the respective balls picked up by that student. Therefore, each student tried to pick the balls with the largest weights printed on them.

Input:

The input will have four lines; first line will contain an integer N, the number of students and the next three lines will contain the weights of the different red, green and blue colored balls respectively. For example:

4

5 6 11 3

9 8 2 7

6 2 4 8

Please SUBSCRIBE to view full question

Topics: N/A Solution is Coming!
9 Marks
5.


a)

What are different types of user defined functions used in C? Explain.

Please SUBSCRIBE to view full question

Topics: N/A Solution is Coming!
5 Marks
b)

What are the difference between passing an array to a function and passing a single-valued data item to a function?

Please SUBSCRIBE to view full question

Topics: N/A Solution is Coming!
2 Marks
c)

Write a C program to find the areas of a circle, a triangle and a rectangle using three user defined functions. [Use three different types of user defined functions.]

Please SUBSCRIBE to view full question

Topics: N/A Solution is Coming!
5 Marks
6.


a)

How does a structure differ from an array? How the members of a structure are accessed?

Please SUBSCRIBE to view full question

Topics: N/A Solution is Coming!
3 Marks
b)

Write a program, using structure that will allow you to enter and display the following information of your family:

i) Name ii) Age iii) Occupation iv) Salary

Please SUBSCRIBE to view full question

Topics: N/A Solution is Coming!
6 Marks
c)

What is wrong with the following code? Correct the error, and also give the output.

#include<stdio.h>

int main(){

    struct s{

        char *s;

}

a={"Rithcie"}, *p=&a;

printf("%s",*p.s)}

Please SUBSCRIBE to view full question

Topics: N/A Solution is Coming!
3 Marks
7.


a)

Why do we use file in C programming? What are different modes to open a FILE? Explain.

Please SUBSCRIBE to view full question

Topics: N/A Solution is Coming!
3 Marks
b)

Mention and explain the purposes of any 10 (ten) commonly used C file-system functions.

Please SUBSCRIBE to view full question

Topics: N/A Solution is Coming!
2 Marks
c)

Write C program to find n numbers of prime numbers and store the values into a file.

Please SUBSCRIBE to view full question

Topics: N/A Solution is Coming!
3 Marks
d)

Write a C program to append additional items to an existing file, "Inventory", stored in "d" drive and print the total contents of the file.

Please SUBSCRIBE to view full question

Topics: N/A Solution is Coming!
4 Marks
8.


a)

Draw the 'flow chart' to find out the 'biggest number' from given 10 integers

Please SUBSCRIBE to view full question

Topics: N/A Solution is Coming!
4 Marks
b)

Write C program for the following problem, it does not need to think about run-time optimization. (Objective of the question: To check the problem understanding capacity)

 

One day, one of the students of CSE dept. named Sumon is having a party, and he has invited his friends, p of them have arrived already, but some other are running late. To occupy his guests, Sumon tried playing some team games with them, but he found that it was impossible to divide the p guests into any number of equal-sized groups of more than one person. As a result, he had to wait until q guest(s) arrived, q may be single guest or group of guests arrived at the same time. Finally, summon could make teams of equal sized from the arrived (p+q) guests and started his games.

Input

The input will consist of 5 test cases. Each test case will be given as a non-negative integer (p+q) and (p+q) <100;

Output

For each test case, output will be an integer q that is closest to (p+q)

Sample Input Corresponding Output
                   8                                 1

Please SUBSCRIBE to view full question

Topics: N/A Solution is Coming!
8 Marks

Contributors of this Question:

Role Name Date
Uploaded By: Onebyzero Edu (Test User) Aug. 13, 2024, 11:03 a.m.
Converted By (Img/PDF to Text): Baishakhi Bir Dec. 26, 2025, 11:46 p.m.
Reviewed By: Obaydul Hasan Nayeem Dec. 27, 2025, 8:26 a.m.