You are on page 1of 2

Dhaka International University

Dept. of Computer Science & Engineering


Mid Term Examination (Summer-2021)
Batch No.: 86th (EVE) Semester: 2nd
Course Code: CSE-103 Course Title: Structured Programing

Total Time: 6 Hour Total Marks: 20


GROUP A
Answer any Two Questions out of Three 5×2=10

1. (a) What is compiler? How a compiler works? 2.5


(b) Briefly describe how a C program compile and execute. 2.5
2. What will be the output of the code given below? Explain briefly. 5

#include<stdio.h>
int main()
{
int a=100;
if(a>10)
{ printf("Bangladesh"); }
else if(a>20)
{ printf("Australia"); }
else if(a>30)
{ printf("Newzealand"); }
return 0;
}

3. What are the differences between int, double and float variables. Give explanations. 5

GROUP B
Answer any One Question out of Two 5×1=5

4. Find out the errors of the code given below. 5

#include <studio.h>
int main()
int number1, number2
printf("Enter two integers: ");
scanf("%d d", &number1, number2);
if(number1 == number2){
printf("%d %d",&number1,number2);
}
else if (number1 > number2){
print("%d", number1, number2);
}
else {
printf(" d %d",number1, &number2);
}
return 0;
}

5. State the differences between switch-case and if-else in c programing. Give examples. 5
GROUP C
This part is compulsory and no alternative here 5×1=5

6. Suppose you are a billionaire and you have 3 luxury cars, Ferrari, Mercedes and Bmw. 5
Every day you go to your office to look after your business but your office is not near
your home and you need to refuel your car from a patrol pump. You use your cars
depends on the amount of petrol you can get from that pump. Now there can be 4
conditions which are given below.

1. You ride in Ferrari if the pump has more than 100 litre of patrol
2. You ride in Mercedes if the pump has less than 50 litre of patrol
3. You use Bmw if you have more than 50 litre but less than 100 litre of patrol.
4. Otherwise You walk for your office

Now solve the scenario by writing a C program.

You might also like