Example questions

advertisement

Yeditepe University

Department of Computer Engineering

CSE 232 Systems Programming

Example Final Exam

Systems Programming Part

Q.1.

() Fill in the blanks in the following questions. TWO WRONG ANSWERS WILL CANCEL ONE CORRECT ANSWER!

_____________ translates a program written in a high-level language into machine language.

__________ loader gets the load point and adds it to the direct address references while loading the program into the memory.

Symbol Table contains _________________________________ and _______________________________.

Q.2. () Explain what is wrong in the following statements.

File manager function of the operating system manages the virtual memory.

Disk and printer are I/O devices that read or write data character by character.

Q.3. Short-answer questions. a. () Convert the following numbers

C6.5

16

is equal to binary _________________ and it is equal to decimal ________

2’s complement of 0110110

2

is ____________

160.75

10

is equal to binary _________________ and it is equal to hexadecimal ________ d.

() Initial contents of the text buffer is given as follows. Show its contents and the links after the following insertion and deletion operations:

INSERT 15 B=B+I

DELETE 30

10 FOR I=1 TO 5

20 A(I)=A(I)+1

30 NEXT I

40 B=B/2 f.

() What will be printed by the following C program?

#define A(X) (X*X) main()

{

} printf (“%d \n”, A(2+5*3));

Q.5. () a.

Consider the following two programs where P1 starts at time 0:

P1 requires 6 seconds of CPU time where, after every 2 seconds it does I/O for 2 seconds i.

P2 requires 5 seconds of CPU time where, after 3 seconds it does I/O for 1 second

On the following time chart, show how P1 and P2 use the CPU in a simple batch system ii.

0 2 4 6 8 10 12 14 16

On the following time chart, show how P1 and P2 use the CPU on a multiprogramming system

0 2 4 6 8 10 12 14 16 b.

Consider the following two programs where P1 starts at time 0:

P1 requires 4 seconds of CPU time

P2 requires 5 seconds of CPU time

On the following time chart, show how P1 and P2 use the CPU on a time-sharing system where time-slice is 1 second

0 2 4 6 8 10 12 14 16

Yeditepe University

Department of Computer Engineering

CSE 232 Systems Programming

Example Final Exam

Assembly Language Programming Part

Q.1. (20 points) Write M6800 assembly language programs for the following questions. a.

Write a time delay program that waits 235 microseconds. Show all calculations. b.

An array has 16

10

elements and it is located in memory starting from address 100

H

. Calculate the following in a single loop:

find the sum of the positive values in the array and store it at location 200

H

.

find the sum of the negative values in the array and store it at location 201

H

.

count the number of positive values in the array and store it at location 202

H

.

count the number of negative values in the array and store it at location 203

H

.

Then, calculate the average of the positive and negative values, such that divide the contents of location 200

H

by the contents of location 202

H

, and divide the contents of location 201

H

by the contents of location 203

H

. Assume that the number of positive values in the array is in powers of 2 (i.e. 1, 2, 4 or 8). Then store the average of the positive and negative numbers at locations 205

H

and

206

H

.

Q.2. (15 points) a.

Write the Linux command(s) to change the permissions of your file /usr/home/file.dat as follows:

-you can read, write and execute

-the users in your group can read and execute, but cannot write

-rest of users can only read b.

Write the following Linux shell script: From the processes that are currently running, find and display the number of processes that are run by your user name and by other users. c.

Suppose the file /usr/home/students.dat contains student information as: Name, id, Birthday, Department

Write a Linux shell script to sort the file according to Name. Then print only the Name and Department of the last student.

Download