Sunteți pe pagina 1din 10

1. ProNet postal delivery services needs to calculate the total cost of delivering a parcel.

ProNet
LOC 1
delivery charges are based on the weight of the package is on following table
Weight of the package Charge per Kg
Less than 2Kg Rs. 1,000
2Kg – 6 Kg Rs. 2,000
6Kg – 10Kg Rs. 3,000
More than 10Kg Rs. 3,500

A. Identify the required inputs, processes and outputs required to solve above problem using
the IPO method. ( 7 marks)
………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

B. With aid of flow chart, explain three basic types of control structures used in programing
logic. ( 3 x 3 =9 marks)

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………...

Page 1 of 10
C. Write the pseudocode for above problem. ( 10 marks )

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

D. Draw the flow chart for above problem. (10 marks)

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

Page 2 of 10
E. Convert this flowchart into pseudocode ( 6 marks)

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

Page 3 of 10
F. Convert the following pseudocode into flowchart. (8 marks)
1. Main

2. prompt for noOfSubjects


3. get noOfSubjects

4. if (noOfSubjects < 1 or noOfSubjects > 4) then


5. print " No of Subjects can be 1- 4"

6. else
7. counter = 1
8. total = 0
9. average = 0
a. while ( counter <= noOfSubjects)
b. prompt for marks
c. get marks
d. total = total + marks
e. average = total / counter
f. counter = counter + 1
g. endwhile
10. Print " Total",total,"Average",average
11. endif

12. End

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………...

Page 4 of 10
2. Answer the questions according to the description given below LOC 2 & 4

A. Consider following program and identify the output/s.

i. function changeLinkColor()
{
var color=prompt(``enter a color please'','''');
document.link=color;
} (5 marks)

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

ii. function squares(size)


{
var sqr;
for (var i=1; i<= size; i++)
{
sqr = i * i;
alert(sqr);
}
}

When call squares (5) (5 marks)

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

iii. var myValue = 20;


myValue += 20;
myValue = myValue * 10;
myValue += "20";
myValue = "New value";

For each of these statements, what does the myValue variable evaluate to after
each statement executes in JavaScript? (5 marks)
………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

Page 5 of 10
B. Write a function that prompts the user to input a number, and then gives those 5 chances
to guess the square of the number. (10 Marks)

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

C. Write a test plan for above program, which includes three various test sample.
(10 marks)
………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………
Page 6 of 10
D. Write a function that takes 3 parameters, price, tax rate, balance, and prints yes in an alert
box if someone has adequate balance to purchase an item at the specified price with the
given tax rate. Otherwise, print out no in an alert box. ( 10 Marks)
………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

E. Explain the usage of following methods.


The alert(), prompt(), confirm() and document.write() methods. (5 marks)
………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………
Page 7 of 10
LOC 5 & 6
3. Answer the question according to the scenario
A. Assume you have created an array of pets:
<script type="text/javascript">
var mypets = new Array();
mypets[0] = "dog";
mypets[1] = "cat";
mypets[2] = "goldfish";
</script>

Add a for loop to print out the array (add code below): (5 marks)
………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

B. Modify the JavaScript to create a second array, mynewpets, containing turtle and gerbil.
Modify mypets to append mynewpets, so that the for loop will now print out the modified
5-element array mypets using the same for loop as above. Add code below:
Use the concat() method to join two arrays.
<script type="text/javascript">
var mypets = new Array();
mypets[0] = "dog";
mypets[1] = "cat";
mypets[2] = "goldfish";
var mynewpets = new Array(); (10 marks
)
………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

Page 8 of 10
C. What is the output of the following JavaScript statements? Why? (10 marks)
var myArray = new Array();
for(i = 0; i < 10; i++) {
myArray[i] = "value " + i + 1;
document.write(myArray[i] + "<br />");
}
………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

D. Write the Short answer for following topics


a. Comments in JavaScript
b. Importance of pseudocode
c. Symbols used in flowchart
d. Scripting Languages
e. Type of testing and importance of testing (5 x 5 =25 Marks)
………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………
Page 9 of 10
………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

………………………………………………………………………………………………………………………………

Page 10 of 10

S-ar putea să vă placă și