Mid-Term Exam

Test Instruction Sheet

Computer Science 104

Section 0101

SSN #_____

 

 

Begin /* mid term exam */

 

/* Initialization */

· You will be given 75 minutes to complete this exam.

· Exam sheets will be collected PROMPTLY at the end of the testing period.

· On your exam fill in the top right corner with your student identification number.

· Exams will not be graded without SSN.

· You may not use any notes or calculators on this exam.

· Make sure that your test packet contains 6 pages!

Section Scores:

I

II

III

IV

V

VI

VII

VIII

IX

                 

Total Score: ______ out of a possible 100

 

/* Section I - computer architecture – identify components - (10 points) */

(1-8). On your answer sheet identify each lettered component of this generic computer. (1 point each)

1) A = _____CPU_________ 5) E = ______ROM________

2) B = __Address Bus______ 6) F = _______I/O_________

3) C = ____Data Bus_______ 7) G = ______Bridge_______

4) D = ______RAM________ 8) H = __Specialized Bus____

 

Answer True of False:

9) (True / False) An ALU is part of the CPU.

10) (True / False) Non-volatile memory "remembers" its contents even in the absence of power.

/* Section II – Understanding of Memory – (20 points) */

Assume a RAM memory is 16 bits wide and 256 bytes deep. Also assume that this is the only memory available in this system.

Fill the memory with the following data in this order (addresses and data are given in hex).

Location 0 – 0010

Location 55 – 1234

Location AA – CAFE

Location AB – F00D

Location 1B0 – 4410

Location G5 – 1010

Location 0 – 0101

Location F0 – 56789

Answer questions 11-18 on your answer sheet using the configuration specified above. (2 point each)

11) What are the contents of location 0? ____0x0101__

12) Why? ___Last value written to this location_______

13) What are the contents of location 55? ____0x1234__

14) Why? __Only value written to this location_________

15) What are the contents of location 1B0? ___Unknown_

16) Why? __Outside of specified memory location______

17) What are the contents of location F0? ___Unknown__

18) Why? __Too many bits wide____________________

Assume your system contains a ROM memory which is 16 bits wide and 256 bytes deep. Write the following data to the ROM:

Location 0 – 0010

Location 55 – 1234

Location 0 – 0110

Answer the following questions on your answer sheet using the above configuration. (2 point each)

19) What is the value of location 0? _Unknown__

20) Why? _Can't write to ROM_______________

 

 

/* Section III – Conversions – (10 points) */

convert the following and write the answers on your answer sheet:

(1 point each).

21) 1011 1010 11012 = _BAD_ H_

22) 100 10 = ____64_ H

23) A0 H = __160_ 10

24) AA H XOR BB H = __11_ H

25) AA H AND BB H = __AA_ H

26) NOT AAH = ___55_ H

27) The logical expression for the above circuit is: (2 points)

a). Light On = (A AND B) OR (C AND D)

b). Light On = (A AND C) OR (B AND D)

c). Light On = (A OR B) AND (C OR D)

d). Light On = (A AND B) XOR (C AND D)

e). None of the above

28) The logical expression for the above circuit is: (2 points)

a). Light On = (A AND B) AND (C AND D)

b). Light On = (A AND B AND C) OR D

c). Light On = (A OR B OR C) AND D

d). Light On = (A AND B) XOR (C AND D)

e). None of the above

 

/* Section IV – Operating System Fundamentals – (10 points) */

Identify A, B, C and D in the following chart. (1 point each)

29) A = _Boot Code or Boot Strap______

30) B = _Hardware Drivers or Device Drivers_

31) C = _Input/Output Interface____________

32) D = _Any kind of memory or mass storage, CPU_

Briefly describe the major differences among Operating System commands, utilities, and applications? (6 points)

33). A). Operating System

Coordinates users and resources, basic interface to disk systems

B). Utility

Small programs that make the operating system easier to use

C). Application

More expensive program targeted to doing a specific, complex task

 

 

/* Section V – UNIX – (10 points) */

Execute these commands in order:

Mkdir alpha

Mkdir beta

Mkdir gamma

Cd gamma

Mkdir delta

Cd ..

Mkdir epsilon

Cd epsilon

Mkdir psi

Cd alpha

Pwd > Q

34) Draw the directory structure that the above commands create (3 points).

35) Identify the contents of file ‘Q’. (3 points).

~/epsilon

36) How do you invoke the C compiler? (2 points).

cc filename.c

37) What are arguments? (2 points).

Arguments are parameters that are used as inputs into a program or functions

 

/* Section VI – Pseudo coding/Flow charting – (20 points) */

Start Algorithm 1:

Set variable X to 0

Read variable N from user

Loop N times

Read variable Q from user

Add Q to X and store result in X

End Loop N times

Set variable Y to X divided by N

Display Y

End Algorithm 1

Start Algorithm 2:

Set variable X to 1

Set variable Last_X to 1

Read variable N from user

Loop N times

Print X

Set X to X plus Last_X

Set Last_X to X

End Loop N times

End Algorithm 2

Start Algorithm 3:

Set variable B to 0

Read variable C

While C is not ‘Q’ then

Print C

Read Variable C

Increment B

End While

Print B

End Algorithm 3

Identify by function, any two of the three above algorithms: ( 10 pts each).

Circle the algorithm you are answering, then circle the function of that algorithm.

38). Algorithm 1 Algorithm 2 Algorithm 3

a). Compute Fibonicci Sequence

b). Compute Average Algorithm 1

c). Compute Squares

d). Builds Addition Tables

e). Count the number of characters the user types Algorithm 3

f). None of the above. Algorithm 2

Convert algorithm 2 to a flowchart. (10 points).

39)

/* Section VII – ‘C’ language skills – (10 points) */

What is the result of the following C printf statements (2 point each)

40) printf("Hello, World!\n"); Hello, World! (new line)

41) printf("and the answer is…%d",answer); (let answer = 5)

and the answer is…5

  1. printf("\"Abracadabara!\""); "Abracadabara!"

43). (True / False) If your program does not generate any syntax errors, then your program will run correctly.

44). (True / False) Your C source code file must end in with the extension ".c"

45). Move one line to fix the following flowchart: (5 points)

Line #10 - If the process needs to loop back to develop/modify algorithm.

/* Section VIII – Programming methodology – (10 points) */

Fill in the blanks using the following:

B, F, __C__, A, ___G___, E, H, ___D___

#44 #45 #46

A. Design the algorithms with Pseudo Coding/Flowcharting

B. Identify Problem

C. Draw Black Box

D. Debug

E. Design Algorithms

F. Understand the Problem

G. Code solution

H. Design test vector set

 

  1. A program should always begin with: comment header/program header

Answer the following true or false:

  1. (True / False) Documentation should always be done at the end of the project, just before customer delivery.
  2. (True / False) Once Pseudo Code is written it can be discarded – it no longer servers any useful purpose in code development.
  3. (True / False) Your professor is the most intelligent, gifted, handsome person to walk the face of the Earth.
  4. (True / False) Structured code, by its nature, is modular.
  5. (True / False) Modular code can be used in other programs that are not closely related in function to the program for which it was originally created.

52) (True / False) Bill Gates is an evil son-of-a-!$%&^

who can’t get all of the bugs out of any version of Windows.

 

 

 

 

/* Section IX – Extra Credit – (10 points) */

We often refer to large blocks of memory as "K’s"

(i.e. I have a 64K video cache).

53) What does the "K" mean? (2 points).

"K" literally means Kilo

 

54) Is a 64K video cache actually 64,000 bytes or words long? (1 point).

No

55) Why? (2 points).

Because a "K" to a human means 1000, but to a computer, it means 1024,

So a 64K video cache is really 64 * 1024 bytes/words long

 

 

56) Identify the GUI on the overhead (indicate left or right) (1 point).

Left

57) What does GUI mean? (2 points).

Graphical User Interface

 

58) How does a GUI differ from a command line interface? (2 points).

Command line interface is keyboard driven, all commands, options and arguments must be specified textually.

A GUI uses a "point-and-click" mouse driven interface. Command, options and arguments are selected through various graphic lists.

 

 

Congratulations!!!! You’re done!

 

End /* mid term exam */