Showing posts with label Chapter 5. Show all posts
Showing posts with label Chapter 5. Show all posts

Monday, April 8, 2013

KBP Assignment

Concepts of Programming Language 10th Edition
Chapter 5

For Mr. TriDjokoWahjono

Review Question


1. What are the design issues for names?

The design issues for names are :
  • Are name case sensitive?
  • Are the special words of the language reserved words or keywords?
2. What is the potential danger of case-sensitive names?
The danger is that you might not be able to find the name in a reference even if you have spelled it correctly, because you haven't got the case right. Therefore, you won't find information that you need, or you might incorrectly create a new record with a different case, which nobody else will be able to find because it isn't with the rest of the information.

4. What is an alias?
An alternative name for an object, such as variable, file, or device.

7. Define binding and binding time.
Binding : an association between an attribute and an entity, such as between a variable and its type or value, or between an operation and a symbol.
Binding Time : The time at which a binding takes place.

9. Define static binding and dynamic binding.
Static Binding : the process of mapping a message to a specific sequence of code (method) at compile-time.
Dynamic Binding : the process of mapping a message to a specific sequence of code (method) at runtime.

Problem Set

2. What is l-value? Write a statement in C language which gives the compile time error "l-value required".

l-value is a value that can be the target of an assignment. The "l" stands for "left" or "locator".
A statement in C language which gives compile error :
1 = 2;
int i; (i+2) = 2;

6. Consider the following JavaScript skeletal program:
//the main program
var x;
function sub1(){
   var x;
   function sub2(){
   ...
   }
}
function sub3(){
...
}
Assume that the execution of this program is in the following unit order:
main calls sub1
sub1 calls sub2
sub2 calls sub3
a. Assuming static scoping, in the following, which declaration of x is the correct one for a reference to x?
   i. sub1
   ii. sub2
   iii. sub3
b. Repeat part a, but assume dynamic scoping.

a.) i.) sub1   ii.) sub1   iii.) Main
b.) i.) sub1   ii.) sub1   iii.) sub1

7. Assume the following JavaScript program was interpreted using static-scoping rules. What value of x is displayed in function sub1? Under dynamic scoping rules, what value of x is displayed in function sub1?

var x;
function sub1(){
   document.write("x = " + x + "<br />");
}
functin sub2(){
   var x;
   x = 10;
   sub1();
}
x = 5;
sub2();

Static scoping: x=5;
Dynamic scoping: x=10;

Monday, November 5, 2012

PTI Assignment

Discovering Computers 2011 - Living in a Digital World
Chapter 5
For Mr. TriDjoko Wahjono

True / False
1. T   7. F
2. T   8. F
3. F   9. T
4. T   10. T
5. F   11. T
6. F   12. T

Multiple Choice
1. C   5. D
2. A   6. C
3. B   7. C
4. C   8. C

Matching
1. B   6. A
2. G   7. H
3. D   8. F
4. J    9. I
5. E   10. C

Short Answer
1. - Optical Mouse, Laser Mouse, Air Mouse
    - The way they detect movement of the mouse that are transmitted to the pointer.
2. - Point, Click, Drag, Double-click, Right-click
    - Point: Move the mouse until the pointer on the desktop is positioned on the item of choice
       Ex : Position the pointer on the screen
      Click: Press and release the primary mouse button, which usually is the left mouse button
       Ex : Select or deselect items on the screen or start a program or program feature
      Right-Click: Press and release the secondary mouse button, which usually is the right mouse button
       Ex : Display a shortcut menu
      Double-Click: Quickly press and release the left mouse button twice without moving the mouse
       Ex : Start or choose a program or a program's feature
      Drag: Point to an item, hold down the left mouse button, move the item to the desired location on the screen, and then release the left mouse button.
       Ex : Move an object from one location to another or draw pictures
3. - OCR : is a technology that involves reading type-written, computer-printed, or hand-printed characters form ordinary documents and translating the images into a form that the computer can process.
    - OMR : is a technology that reads hand-drawn marks such as small circles or rectangles.
4. - Fingerprint reader
    - Captures curves and indentations of a fingerprint to identify wether the inputted fingerprint are the right one
5. - Rules for company with 15 or more employees to make a reasonable attempt to accommodate the need of physically challenged workers.
    - Gesture recognition and Computerized implant devices are a way for human to provide a natural computer interface for the physically challenged people through a means of just moving a small part of the body that are still functioning