0% found this document useful (0 votes)
6 views5 pages

Midterm 2021 2022 Sol

The document is a midterm exam for the course CMPE-CMSE 107 at Eastern Mediterranean University, consisting of multiple-choice questions, fill-in-the-blank questions, and coding questions related to computer software engineering concepts. The exam emphasizes understanding of computer hardware and software, algorithm construction, and Python programming. Strict rules against cheating and electronic devices are enforced during the exam.

Uploaded by

alper26onder
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)
6 views5 pages

Midterm 2021 2022 Sol

The document is a midterm exam for the course CMPE-CMSE 107 at Eastern Mediterranean University, consisting of multiple-choice questions, fill-in-the-blank questions, and coding questions related to computer software engineering concepts. The exam emphasizes understanding of computer hardware and software, algorithm construction, and Python programming. Strict rules against cheating and electronic devices are enforced during the exam.

Uploaded by

alper26onder
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

CMPE-CMSE 107 Spring-2021/2022 Midterm Page 1

Eastern Name::_____________________________ S O L U T I O N____________________


Mediterranean
University
Signature::_____________________ Group No: _________ Student No::_____________________

Page2

CMPE-CMSE 107
Foundations of Computer-Software Engineering Page3

Page4
Spring-2021-22 (28-04-2022) Midterm Exam

Page5

Asst. Prof. Dr. Cem Ergün, Group 1;


Assoc. Prof. Dr. Adnan Acan, Group 2; Total
John Olorunfemi Olaife, Group 3

Total five pages (including the cover page), four parts, 95 minutes.

- Answers that are not written into the given boxes WILL NOT BE GRADED.

- Student who ATTEMPT TO CHEATING will GET ZERO for the exam, and may
be directed to disciplinary investigation for further punishment. Sharing
pen, pencil, eraser, and sharpeners is considered as attempt to cheating.

- Remove all notes, books and unnecessary objects from your desk.
Keep only THIS BOOKLET, PEN-PENCIL-ERASES AND YOUR ID CARD on
your desk.

- Having any kind of electronic calculators, computers, phones and gadgets


such as earphones, intelligent watches etc. at any easy accessible place is
strictly not allowed. You are allowed to keep electronics gadgets in your
bags after turning their power off.
Do not keep electronic watches on your wrist, desk, or in your pocket.

- Talking, making any kind of noise, asking questions are not allowed. Do
not talk, and do not create any sound once the exam is started.

Course Student Outcome relations:


Questions in PartA and B -Identify the difference between computer hardware and computer software (CO1)
Questions in PartD -Construct an algorithm for solving a computational problem (CO2 CO3)
Questions in PartC - Creating lists and other data structures for storing and manipulation of data (CO6)
Questions in PartC and D -Write a complete Python program for solving a problem (CO4)
Questions in PartC -Use of selection and repetition structures within a Python Program (CO5)
CMPE-CMSE 107 Spring-2021/2022 Midterm Page 2

PART A: (Each is 1pt)


MULTIPLE CHOICE (Mark only one choice) QA9) A category of software is _____ software
[ ] advanced
QA1) Computer output can be______________. [X] system
[X] Sound [ ] compilation
[ ] RAM [ ] bit
[ ] UPS
[ ] Keyboard QA10) In computational problem solving, leaving out
useless details is called ______________
QA2) Computer hardware comprises [ ] adapting
[ ] applications and programs used by your computer [X] abstraction
[ ] files stored on your computer [ ] translation
[X] the physical parts of a computer system [ ] algorithm
[ ] the master system of programs that manage the
basic operations QA11) An algorithm MUST provide results in
a______________ amount of time?
QA3) Which of the followings are all input devices? [X] finite
[X] Mouse, touchscreen, keyboard, microphone [ ] infinite
[ ] Mouse, printer, keyboard, speakers [ ] systematic
[ ] Monitor, printer, mouse, microphone [ ] immediate
[ ] Microphone, mouse, keyboard, speakers
QA12) Python uses
QA4) What are the basic operations which are
[ ] Static-typing
performed by a CPU??
[X] Dynamic-typing
[ ] Arithmetic operations
[ ] Immutable-typing
[ ] Logical operations
[ ] Mutable-typing
[ ] Fetch Decode and Execute
[ X ] All of the above QA13) Which of the following is a valid identifier?
[X ] Sum
QA5) A storage device the loses its contents when the
[ ] 3person
power is off is
[ ] for
[ ] Nonvolatile
[ ] None of the above
[ ] Permanent
[ ] External QA14) In operator precedence, the highest order is
[ X] Volatile given to
[X] Arithmetic operators
QA6) Computational problem solving involves two
[ ] Relational operators
fundamental descriptions. They are:
[ ] Boolean operators
[ ] Hardware-Software
[ ] None of the above
[ ] Input-Output
[ X ] Representation-Algorithm
QA15) All information within a computer system is
[ ] Binary – Decimal number systems.
represented by the use of
QA7) Which provides the fastest data access time?
[ ] Graphs, charts and complex algorithmic languages.
[ ] USB Memory
[X ] Only two digits, 0 and 1.
[X] RAM
[ ] Decimal digits, 0 – 9.
[ ] CD-ROM
[ ] Alphabetical letters.
[ ] Hard disk
QA8) A device-specific software that is used to enable QA16) The software that translates high-level
communication between a computer and an external programming language commands into machine
device is called language commands is called
[ ] Operating system [ X ] a compiler.
[ ] Internet [ ] an assembler.
[ X ] Driver [ ] an operating system.
[ ] Application software [ ] a driver.
CMPE-CMSE 107 Spring-2021/2022 Midterm Page 3

PART B: FILL IN BLANKS QUESTIONS


(Each is 2pts)
Write answers only into the answering box. Q11) ListA + ListB results in ..................... of the two
lists.
QB1) A _______ is a sequence of one or more Answer ???:
Concatenation , join
characters that can stand for itself
Answer ???:
Literal/ identifier QB12) _______ operation adds a new value in a list at
the specified index value
Answer ???:
QB2) ______ are special characters that are not insert
displayed, but control the display of other
characters on the screen?
Answer ???: QB13) _______ operation adds a provided value to
Control characters the end of the list
Answer ???:
append
QB3) The ability that a variable can be assigned
values of different types is referred to as________.
Answer ???: QB14) Lists in Python as _________, which means
expression
Dynamic typing that the contents of the list may be altered.
Answer ???:
mutable
QB4) An ______ is the software that manages and
interacts with the hardware resources of a
computer. QB15) ______ are the same as lists in Python, with the
Answer ???:
exception that they are immutable.
Operating system
if , control Answer ???:
Tuples

QB5) The _______ function is used to display QB16) _______ statements are used for the
information on the screen in Python? construction of definite loops only.
Answer ???:
print Answer ???:
for
QB6) Given that 22/7= 3.142857142857143,
print(format(0.1*22/7, '.3e')) displays ??? QB17) The built-in ________ function in Python can
Answer ???:
3.143e-01 be used for generating a sequence of integers.

Answer ???:
QB7) _______ is a finite number of clearly range
described, unambiguous, “doable” steps that can be
systematically followed to produce a desired result
QB18) Examine the following lines of Python code:
for given input in a finite amount of time.
Answer ???:
Algorithm

QB8) A conditional statement is evaluated to be


______ or _______.
What will the last line return?
Answer ???: Answer ???:
True or False True

QB9) ** (exponential) operator has ........................


associativity. QB19) What will be the output of the following loop?
n = 5
Answer ???: while n > 4:
Right to left print(n, end=’’)
n=n-1
QB10) ListA[-1] represents ................... element print(‘n')
of ListA. Answer ???:
5n
Answer ???:
Last, rightmost n
CMPE-CMSE 107 Spring-2021/2022 Midterm Page 4

PART C: FILL IN BLANKS QUESTIONS QC5) (4pts) The following program is prepared to
Write answers only into the answering box. remove repeated elements from a list ListA and
obtain a new list ListB of unique elements.
QC1) (2pts) The following python code is prepared to Complete the empty lines for this purpose.
compute the Area of the shaded space (AoSh). Fill
the missing statements 1 and 2 accordingly to
compute AoSh.
Area of circle (AoC) = 3.142 × 𝑟 2,
Area of rectangle (AoR) = 𝑙 × 𝑏. 𝑙

𝑟
Answer 1: i not in ListB:
𝑏
Answer 2: ListB.append(i)

QC6) (2pts)The following program is prepared to


change the element “abcd” with 100 in the given list
ListA. Complete the empty lines for this purpose.
Answer a?:
ListA=[[8,[10,[1,2,"abcd",9],5],4],3]
3.142 x (r**r)
Answer ???:
Answer b?: AoR-AofC ListA[0][1][1][2]=100
QC2) (3pts) Complete the code below to print each
fruit and its cost in the order given in the output. QC7) (4pts) The following program is prepared to
check if digit 5 is present in an input integer of any
number of digits. Complete the empty lines for this
purpose.

Answer a?: S range(len(Fruits)) or range(len(Costs)) Answer 1: str(N)


Answer b?: Fruits[item]
Answer 2: "5" in StringN:
Answer c?: Costs[item]

QC8) (6pts) The following program is prepared to


QC3) (2pts) Complete the following code to add two
check if an input string contains the characters “C”,
cities to the empty list Cities.
“M” in this order, and if so it prints their first
occurrence indexes. Complete the empty lines
(labeled as 1,2,3) for this purpose.

Answer :
Cities.append(item)

QC4) (4pts) The following program is prepared to


compute factorials of integers from 0 to 50.
Complete the empty lines for this purpose.

Answer 1: S.index("C")
Answer 1: Fact=FactList[-1]*i
Answer 2: S[IndexC+1:].count("M")
Answer 2: FactList.append(Fact)
Answer 3: IndexC+1+S[IndexC+1:].index("M")
CMPE-CMSE 107 Spring-2021/2022 Midterm Page 5

PART D: FILL IN BLANKS CODING QUESTIONS QD2) (12pts) Given the following algorithm, write the
corresponding Python program
QD1) (15pts) The following flowchart calculates and
lists the numbers that evenly divides input N, write Algorithm
the corresponding Python program according to the 1. Input A,B,C
flowchart. 2. Delta=B**2-4.0*A*C
Start 3. If Delta < 0:
a. Print(“No real roots”)
Input N
4. Else:
a. If Delta = 0
i=2 b. Print(“One real root: ”, -B/(2*A)
ListA= [ ]
c. Else:
d. Print(“Two real roots: “)
T e. Print(“Root1: “, (-B+Delta**0.5)/(2*A))
İf N%i ==0
f. Print(“Root2:”, (-B-Delta**0.5)/(2*A))
F ListA.append(i)

i=i+1

T F
İ < N//2 Print ListA

Stop

Write your code here

You might also like