Wajb Tariq

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 13

Arab Open University Faculty of Computer Studies M150 Data, computing and information

M 150A Tutor-marked Assignment 01 Fall 2011/2012 Cut-off date: December 11, 2011 Total marks: 80
This TMA sh ould be sub mitted to your tutor electr onical ly through the LMS system bef ore the cut-off date indicated above. You shou l d wr i t e y ou r s o lu t i on s t o t he quest ions i n a si ngl e word document . Head the document with your name and your Personal Identif ier (ID). This TMA assesses your understanding of Units 1, 2, 6 and 7 (Sections 1, 2 & 3) of M150. It is marked out of 80, out of which 20% will be considered for the continuous assessment grade. It consists of 4 questions. The total marks for each question are shown at the beginning of each question. The marks allocated to each part of a question are indicated in the margin. You should be able to answer the questions of this TMA once you have completed the units each question covers: Question 1: Unit 1 & Unit 2 Quest i on 2 : U n i t 3 Q u e s t i o n 3 : U n i t 6 Question 4: Unit 7 (Sections 1, 2 & 3) Important note: Before you start working with this assignment, you need to refer to section 8.2 of the M150 co urs e c ompani on to read about plagi arism and how t o avoid it. Thi s wi ll help you get a high grade in this TMA.

Question 1 [20 marks]


1. M o s t o f o u r d ai l y a c t i v i ti e s i nv o l v e ex c h an g i ng d a t a o r f in d i n g a n d us in g information. Computers control (entirely or partially) most modern mechanical devices. T hi n k ab o u t y o u r d ai l y l i f e a n d b ri efl y t a l k a bo u t t h r ee t h i n g s y o u u s e t h a t involve computers. [6]

Microwave oven: computer in the oven machine processes strokes on the buttons of the control panel (inp ut) and turn it into microwaves producing heat (output). Cash machines in dept. stores: computer reads the barcode on the goods (input) and calculates the cost and displays it (output) i-pad: turns audio files in a computer readable form (input) to sound and music (output)

2.

Briefly define the term Netiquette. Mention three Netiquettes that you need to follow when us i ng the discus s i on forum i n the LMS. If you want to use any external resources make sure to include your references. [5]

Netiquette is the name of collection of guidelines setting out appropriate email behavior to minimize discourtesy misunderstanding in email use. Examples: 1. Respect other peoples time and bandwidth. 2. Help keep flame wars under control. 3. Respect other peoples http://www.albion.com/netiquette/corerules.html 12/15/2011 7:44 PM
3. Communic ation with humans or computers relies on shared conventions. What u n d e r s t a n d i n g f r o m t h e t e r m c o n v e n t i o n ? G i v e t w o e x a m p l e s o n conventions. [4] is your

Convention is an agreement between a collection of participants about what a message means. Examples: -Traffic signs (a public convention) -Language (a private convention)

4 . E a c h f i l e s a v e d i n y o u r c o m p u t e r s h o u l d h a v e a n e x t e n s i o n , w h y ? [ 2 ] 5. What type of information might be included in the following files: message.wav, me.png, graduation.mpeg. [3]

Because the extension denotes the format of the file so that t he system would know which application to launch to open the file. message.wav is an audio file. me.png is an image file. graduation.mpeg is a video file.

Question 2 [20 marks]


1. Any feature of the analogue worl d can be taken inside the boundary of the c o m p u t e r u s i n g t w o s t e p s p r o c e s s . M e n t i o n s t h e t w o s t e p s w i t h b r i e f explanation giving an example that illustrates them. [6] 1.

breaking the analogue feature into parts. like a text for example is broken into characters, an image into pixels and sampling audio features.
2.

mapping each part onto a binary digit. Each character in a text is represented with a binary digit. Each pixel is given a binary digit. audio quantization also is a way of mapping.
2. Show all the steps required to conve rt the binary value 111001101 to its decimal representation. [3]

111001101 2 = 1*(2) 0 +0*(2) 1 +1*(2) 2 +1*(2) 3 +0*(2) 4 +0*(2) 5 +1*(2) 6 +1*(2) 7 +1*(2) 8 =1+0+4+8+0+0+64+128+256 =461

3.

S h o w a l l t h e s t e p s r e q u i r e d t o c o n v e r t t h e o c t a l v a l u e 4 4 0 2 t o i t s b i n a r y representation. [5]

4402 8 = 2*(8) 0 +0*(8) 1 +4*(8) 2 +4*(8) 3 =2+0+256+2048 =2306 1 0

2306 10 1153 576 288 144 72 36 18 9 4 2 1

0 1 0 0 0 0 0 0 1 0 0 1

4402 8 = 100100000010 2
4. Consider an image of size 700 X 800 pixels. Find the number of bits used to represent each pixel, the pixel amplitude and the coloring system used for the following two cases: a. If the image requires 70000 bytes to be stored inside the computer. [3]

Number of pixels=700*800=560000p Number of bytes used to represent each pixel=70000/560000=1/8 bytes =1/8*8=1bit Since each pixel is represented with only one bit, then it can be only given two values. Either 1 for black or 0 for white. The system is a black and white system.
b. If the image requires 1680000 bytes to be stored inside the computer. [3]

Number of pixels=700*800=560000p Number of bytes used to represent each pixel=1680000/560000=3bytes =3*8=24bits The system used is 24-bit RGB.

Question 3 [20 marks]

1. What is a. b. c.

the function of the followi ng: [6] Cac he memory . ALU. Assembler.

The speed of the processors register exceeds that of the main memory, potentially leading to a situation where processing is slowed down due to the wait for data to be delivered from main memory. Cache memory is used to bridge the gap in speed between the register and the main memory. ALU is used to carry out arithmetic and logical operations. Assembler is used to translate code written in assembly language to machine language.

Complete the following truth table for the Boolean expression: [3] (A AND B) OR (NOT A)

A T T F F

B T F T F

A AND B T F F F

NOT A F F T T

(A AND B) OR (NOT A)

T F T T

2.

The following flowchart diagram shows a loop structure program. [11]

a.

H o w m a n y t i m e s wi l l the l o o p be e xe c u t ed ?

5 Times

b.

What is the exact output after these instructions have been executed? You need to draw a simple tracing table that shows how you got your answer.

Li ne b ei ng ex cut ed

x ? 2

x <=10 ? ? t rue

Start 1 2 3 4 5 2 3 4 5 2 3 4 5 2 3 4 5 2 3 4 5 2 6
2 4 6 8 10 Finish

Li ne i n out put wi ndow 1

In form at i on t o be wri t t en out

2 2 4 t rue 4 3 6 t rue 6 4 8 t rue 8 5


10 true 10 6 12 false Finish

c.

What i s the v al ue of x when the loop stops?

12
d. Make a unique change i n the above flowchart so that the odd numbers from 1 to 9 are printed.

Change Set x to 2

Set x to 1

Question 4 [20 marks]


1. [8] a. Y o u a r e r e q u i r e d t o w r i t e J a v a S c r i p t p r o g r a m t o d o t h e f o l l o w i n g : Prompt the user three times: once for their first name; once for their family name; once for their title (e.g. Ms., Mr., Dr., Prof etc.). The program will then display on the screen a personalized greeting such as: Welcome Prof Albert Einstein or whatever information the user may have entered.

<html> <head> <title> Welcome </title> <body> <Script = JavaScript> /**************************** ******************************************/ /**************************Qestion 4 part 1****************************/ /*******************say your name, i say welcome***********************/ /**********************************************************************/ var firstName, familyName, title; firstName = window.prompt("Enter your first name please","Your name"); /***********************/ familyName = window.prompt("Enter your famil y name please","Your last name"); /***say your name*******/ title = window.prompt("Enter yout title please","Your title"); /***********************/ document.write("Welcome "+title+" "+firstName+" "+familyName);//notice the order title,firs t name,last name// </script> </body> </head> </html>

Run your program with your name and the title you like. In your Solution document include two screenshots: one showing the program prompting for the title, with the user having entered a response but not yet pressed OK;

b.

one showing a greeting displayed in the browser window.

2. The price of a ticket to a passenger on AOU -Airways is computed based on the following table: [9] Class First Class Economy Class (with meal) Economy Class (without meal) Price KD 300 KD 150 KD 130

Using nested if statements, write a JavaScript code which will work according to the following specifications: a. Read the class that the passenger wants to travel on. b. If the class is the first class, print the price of ticket. c. If the class is the economy class, ask the user if he/she wants a meal on the flight. Then print the price of the ticket according to the response of the passenger. The program should simply accept one possible strings the user enters; it is not required to work for all possible inputs such as First, first, FIRST or Yes , yes, YES.
Im p o rt a n t n o te : W hen w r i ti ng t he tw o Jav a Scr ip t p rog ra m re qu ir ed in thi s question, you should follow good programming style that helps readability. This includes: [3]

Using short c omment at the beginning stating the purpose of your program. Selecting meani ngful v ari abl es names. Using spacing and indentations to help make the structure of your program clear.

<html> <head> <title> Buy a ticket online </title> </head> <body> <script = JavaScript> /**********************************************************************************************/ /******************program for giving information about air fares on AOU Air*******************/ /**********************************************************************************************/ var comfort; var food; comfort = window.prompt("Please choose your class","First or Economy"); if (comfort == "First") { document.write("Your ticket price is 300KD" ); } else { if (comfort == "Economy") //when passenger chooses economy, ask him if he'd want a meal// { food = window.prompt("Would you like a meal?", ""); } }; if (food == "yes") { document.write("Your ticket price is 150KD"); } else { if (food == "no") { document.write("Your ticket price is 130KD" ); } }; </script> </body> </html>

Bibliography: M150 DATA, COMPUTING and INFORMATION: Unit 1 Unit 2 Unit 3 Unit 6 Unit 7

You might also like