Answer each of the following questions, save the document as a PDF, then submit it on blackboard under Homework 2.

Question 1: (2 points)

Evaluate the following expression for x = 4, y = 2 and z = -2





Question 2: (2 points)

Evaluate the following expression for x = 12, y = 15 and z = 14





Question 3: (2 points)

Evaluate the following expression for x = 4, y = 7 and z = 6






Question 4: (4 points)

What is a compiler?

A compiler is a program designed to process statements written in a particular computer language. It converts computer language codes in a way that the computer can use it. They are simply software used by programmers to writer language statements.

What is an interpreter?

It is program that interprets a computer program without having to execute the instructions written in a scripting language. It does not require them to be compiled into a machine language program initially.

What is the difference between the two translators?

The two programs are very similar in structure; however, the compiler translates instructions into machine code while the interpreter is in charge of directly executing instructions in the source program language (Savnik, 2016).

Question 5: (2 points)

What is the definition of the syntax of a programming language?

Syntax are set of computer rules that defines symbol conditions that are considered to be correctly structured document or language. Each language have consequence of symbols that are used to form an executable program according to a specific programing language .

Question 6: (9 points)

What is the output of the following programs? Use the online Python editor to run each of the following programs.

Program 1:

x = 5
y = "John"

Run the code above and paste a screen shot of the output here.


Program 2:

x = 4
x = "Sally"

Run the code above and paste a screen shot of the output here.


Program 3:

Copy the following code and paste it in the python online editor

for x in range(2, 6):


Run the code above and paste a screen shot of the output here.


Operating system

Answer the following questions in full sentences.

Question 7: (2 points)

What is an open source operating system? Give an example of an open source operating system.

An operating system is a low level computer software that function basic computer functions such as peripheral scheduling and control. An open source software is available for downloading and use for free. Some of open source operating systems are Linux Kernel, Chromium and Android OS.

Question 8: (4 points)


  1. List and Explain-three functions of the operating system in a computer. (3 points)
  2. Peripheral devices control- The OS controls computer devices such as keyboard, mouse, and any other gadget connected to a computer system.
  3. Computer resources management- computer resources include available software, memory and hardware devices. The OS ensures that a program is ready and executed when needed by the user.
  • Disk and memory management- the OS controls memory usage in a computer system during reading and writing of the hard disk and any other storage media attached into the computer system.
  1. What is a single user operating system? What is a multi-user operating system?(1 points)

A single user operating system only allows one user at a go. It can only get instructions from one user while multi-user operating system can be used by more than one user at a go. Multi-user operating system can allow many peripheral devices.

Question 8: (3 points)

  • What is device driver and what is the need of it.

Device drivers are groups of files that enable one or more hardware devices to communicate together with the operating system. It allows the computer to send and receive data from hardware devices correctly. A good example is the printer drivers (Mahmood, 2015).



Mahmood, D. Y. (2015). Operating Systems & Device Drivers. Computer Sceinec Journal, 3-5.

Savnik, I. (2016). Compilers and interpreters . Computer Science Journals, 3.