Cis115 Midterm Answers

Only available on StudyMode
  • Download(s) : 158
  • Published : April 21, 2011
Open Document
Text Preview
____________________________________________________________

_________________________

Spring 2011CIS115 Introduction to Programming and LogicMidterm Exam ____________________________________________________________

_________________________

ANSWERS

[Please do not share these answers with anybody]

Question 1 to 15: Choose the best answer. Four points for each question.

1. An algorithm is __________.

a) a type of software that analyzes a problem
b) a graphical representation of the steps in a program
c) a chart that lists input, output and processing items of a program d) a set of step-by-step instructions that is designed to accomplish a task

Correct answer: (d). Answer (b) is flowchart. Answer (c) is IPO chart.

2. What is the last step in the six-step model of creating computer solutions to problems?

(a) developing an algorithm to solve the problem
(b) writing code to solve the problem
(c) evaluate and modify (if necessary) the program
(d) desk checking the program

Correct answer: (c). Answer (a) is step 2 in the six-step model. Answer (b) is step 4. Answer (d) is step 5.

3. What are the goals for desk-checking an algorithm?

(a) to verify that the algorithm is not missing any step
(b) to verify that the steps are logical and in proper order c) both (a) and (b) are goals for desk-checking an algorithm d) neither (a) nor (b) is a goal for desk-checking an algorithm

Correct answer: (c)

4. What is pseudocode?

(a) An old programming language no longer used by programmers (b) A type of informal code that is used to show the steps in an algorithm a. (c) Programming code with syntax errors
(d) Comments and notes inserted in program code

Correct answer: (b)

Read the following paragraph for questions 5, 6 and 7:

A teacher has the following information of each student in the class: name, ID, date of birth, midterm exam score, project score and final exam score. The teacher is writing a program to calculate a student's weighted total score, which is the sum of 30% of midterm exam score, 30% of project score, and 40% of final exam score. The teacher wants the program to display the ID and the weighted total score of the student but nothing else. He does not want to enter anything unnecessary into the program.

5. The midterm exam score of the student is

(a) an input item
(b) a processing item
c) an output item
(d) none of the above

Correct answer: (a). The teacher has to enter midterm score into the program.

6. The weighted total score of the student is

(a) an input item
(b) a processing item
c) an output item
(d) none of the above

Correct answer: (c). The goal of the program is to calculate the weighted total score.

7. The date of birth of the student is

(a) an input item
(b) a processing item
c) an output item
(d) none of the above

Correct answer: (d). The date of birth is not entered nor used in the program. It is irrelevant information.

8. When we create a desk-checking table to test an algorithm, we

(a) create a column for every unique input item only
(b) create a column for every unique output item only
(c) create a column for every unique input and output item (d) create a column for every unique input, processing and output item

Correct answer: (d)

9. A compiler

(a) checks for syntax errors in your C++ instructions
(b) translates your C++ instructions into machine code
c) does everything described in (a) and (b)
d) does nothing described in (a) and (b)

Correct answer: (c)

10. The following statement is used to declare and initialize a variable in a C++ program:

double height = 0.0;

Which of the following is true?

(a) This statement has a syntax error.
(b) This statement has a logical error but no syntax error. (c) This statement has...
tracking img