0% found this document useful (0 votes)
34 views

Cse 109 (2020)

This document provides instructions for a computer programming exam consisting of 2 sections worth 180 marks total and lasting 2 hours. Section A is worth 90 marks for 1 hour and contains 4 compulsory questions. Section B is also worth 90 marks for 1 hour and contains 2 compulsory questions. Students must use separate answer sheets for each section. The document provides examples of question types and content that may be included, such as writing C code to calculate a series sum or determine if a number is "amazing". It also specifies formatting rules like assuming reasonable data if needed and that usual symbols have their usual meanings.

Uploaded by

Fariha Tasnim
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views

Cse 109 (2020)

This document provides instructions for a computer programming exam consisting of 2 sections worth 180 marks total and lasting 2 hours. Section A is worth 90 marks for 1 hour and contains 4 compulsory questions. Section B is also worth 90 marks for 1 hour and contains 2 compulsory questions. Students must use separate answer sheets for each section. The document provides examples of question types and content that may be included, such as writing C code to calculate a series sum or determine if a number is "amazing". It also specifies formatting rules like assuming reasonable data if needed and that usual symbols have their usual meanings.

Uploaded by

Fariha Tasnim
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Subiect: CSE-109, Computer Programming

Full Marks: 180


Total: 2.00 hours
Section A : 90
:1.00 hour
Section A
INSTRUCTIONS:

Use SEPARATE answer scripts for each section.


Question-1 and Question -4 (Viva Voce) in Section A are compulsory.
b. Q-28& Q-3).
C. Answer any OTHER ONE question from this section (From
d. Figures in the margin indicate full marks.
Assume reasonable data if necessary.
e.
f. Symbols used have their usual meanings.

SECTION-A

Question-1 (Compulsory) 15
and find its sum.
a. Write a print the following series upto n
C code to
[You must use for loop]
+33-44 ..n^n= sum
11-2^2+3^3-4^4....nn=sum

b. Explain with example the need of having different basic data types
in C programming.

in 8
C code to calculate and print the length of each word
a
c. Write a
sentence. Take input of the sentence from user.

d. What will be the output of the following code snippet of 1(d)? 5

Why?
#include <stdio.h>
voidmain(){
int i= 1

ifi-0)
printf("i is equal to On");
clse
printi"i is not cqual to Oln";

ede 5ti ppot: 10)

Question-2
a. In the Gregorian calendar, years that are multiples of 4 are leap 15
to this rule occurs on century years. A
years. However, exception
century year is a multiple of 100. Such a year is deemed as leap year
only if it is multiple of 400. Write a program that takes a year as
input and prints "Leap Year" if the year is a leap year. Otherwise it
should print "Not a leap year". [You must use switch case for this
question]

b. A number is called AMAZING if one of the following conditions is 15


satisfied.
i. The number is not divisible by 5
ii. The number is divisible by 3 and not divisible by 21
Write a C program that takes input of a positive integer and prit if
it is AMAZING or not.
Page 1 of 2
Example
Input: 7
Output: Amazing number

Input: 5
number
Output: Not amazing
and "continue' statenmet
ent in a
c. What is the principle of "break loop
Determine it.

Question-3
You are given 100 positive
integers as input. All these mumbers
100. Find out the numbers in the range of1
.
in the range of 1 to
in the input.
100 that are missing

executes at least once-Justity your answer with


b. "do while loop
proper example.
Take input of a line from the
C. Designm aword capitalization format.
user. Write a C code
to design a word capitalization algorithm

according to the following rules: in a sentence such as


i. The first characters of the prepositions
letter. [ consider these 4
of, i, for, in" will not be capital
prepositions only J
the" will not be
ii. The first characters of articles "a, an,
changed to capital letters. be capital letter.
ii. The first characters of other words will
character of a word wll
iv. Characters other than the first
remain unchanged.

Question-4 Viva Voce (Compulsory)


BANGLADESH UNIVERSITY OFPROFESSIONALS
Military Institute of Science and Technolody
B.Sc. InElectrical,Electronicsand Communication Engineering
ant Group:0<Eamed Credit Hour sa 36,Final Examinatidn(Fall): Dec 2020

Subject: CSE109,ComputerProgramming
Full Marks: 180
.00 hours
Section B: 90
B : 1.00 hour

UCTIONS:
Use SEPARATE
answer scripts for each section.
Question-5 and Question
-8 (Viva Voce) in Section B are compulsory.
Q.6&0-7).
Answer any OTHER ONE question fromthis section (From
indicate full marks.
Figures in the margin
reaSonable data if necessary.
Assume
used have their usual meanings
Symbols

SECTION-B

stion-5 (Compulsory) 12
employees of a company. The
program
a Write a program to manage
functionalities:
will have the following members emp_name
class with private
i. An "Employee"
emp_salary, work_hour_perDay. of the
function "set_info" to set inforhation
ii. A public member
employees. "show_info" to print the
member function
ii. A protected
information of the employees. adds $20
member function "Add salary" whích the last
iv. A protected works per day more than

with salary if an employee


number
digit of your roll information of m number of
enter
From the main function, show
v.
according to company policy and
employees, add salary
information of the employees.
roll number. 12
last two digits of your the data
"eece.txt" which contains
=

Here, m
Consider a text
file named
b. marks:
within quotation
written below is n andr'
and roll number
My name
tasks: of
Now, do the following I with last
2 digits your
with your full name, in
i. Replace n modifications,
write the sentence
number. After these
roll
and
your answer scrip
the text file using getc( )
which will read
ii. Write a code in the console:
following output
will show the
My name is n
your full
name
Here, n
Example: Output in Console
is Afña
Data in ece.txtroll number is | My name
name and
My the 12
Afia and 70 in our program? Describe
can use
left shift operator
How we
c. shift operator.
of using left
applications 12
take a decimal
number as user input
Question-6 which will You
Write a C program number
corresponding binary
to print it.
it into
and will convert the
conversion.
function to do
must use a

Ante any glohal variable.


code:

f ö l l o w i n g

the #include<stdio.h>
Consider

b. #include<string.h>

struct
Shapes(

5 int helght;

6truct RectangleR

9 s t r u c tr a n g l e

ORINGbase

11 T
13
2 voldset_data(int h) Question-.

14
15 helght=h;

6
17
18
19struct Rectande e
i n twidth
20
21

23 Int main

24
structShapes S;
26 S.setdata(4);
S.R.base5

0
**

code. Also, explain the reasons fo


of the
the output
Now, write
getting the output
enam7 Explain
with proper exanmples
benefits ofusing
c. What are the

Question-7

a Consider the following


code:

indude <stdlo.h

2 Intmain0
3 45.29.8,6.5,2.3,4.5,
3.3,1.2,2.21
X[10]1112 33.1
4 foat
foatp1 &x4]
foat p2 pi 13
(p2)-7
foatp3 8p2
printf(%.2fn p1) .

printf(%.2An, p2)
intkp3
printf(%d"abs((double )02-(double )o1)+k)
13 return 3

14 ':

Cola Sniprek Aiso, code.


he
state n
Find out the of the above mentioned
reasons to getoutput
that output. If there is any error, state that alsO W

proper solution.

Assume that, size of float is 4 bytes and size of double is 8bytes

Page 2 of 3
b. Despite having malloc( ) to allocate memory dynamically, why we
need calloc() also?

c. Define Macro Substitution. What are the types of Macro 06


Substitution? Explain each with proper examples.

d Write a program to keep information of students in a university. 12


The program will have the following functionalities:
i A "Student" union with members name, roll, dept, cgpa,
stipend.
ii. From the main function, enter information of 2 students, add
stipend if a student has ogpa more than 3.6, display all
information effectively so that no garbage may occur.
Viva Voce (Compnlsory) 18
Qnestion-8

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy