JavaScript Application - Advanced Programming - Exam, Exams of Computer Programming

Javascript Application, Fleet of Trucks, Associated Estimate Weights, Completed Script, Compiler, Business Related Implementation, Largest and Second Largest Numbers, Three Integers, Declare an Empty, Initialised. This advanced programming course was taught to management information science students.

Typology: Exams

2011/2012

Uploaded on 11/24/2012

divye
divye 🇮🇳

4.6

(12)

92 documents

1 / 5

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Ollscoil na hÉireann, Gaillimh
GX_____
National University of Ireland, Galway
Autumn Examinations 2007/2008
Exam Code(s)
3BF1
Exam(s)
Third Year BSc in Business Information Systems
Module Code(s)
MS315
Module(s)
Advanced Programming
Paper No.
1
Repeat Paper
External Examiner(s)
Professor H. van der Heijden
Internal Examiner(s)
Professor J. F. Collins
Dr. T. Acton
Instructions:
Answer any THREE QUESTIONS.
All questions carry equal marks.
Duration
2 hrs
No. of Answer books
Requirements:
Handout
MCQ
Statistical Tables
Graph Paper
Log Graph Paper
Other Material
No. of Pages
5
including this page
Department(s)
Accountancy and Finance
pf3
pf4
pf5

Partial preview of the text

Download JavaScript Application - Advanced Programming - Exam and more Exams Computer Programming in PDF only on Docsity!

Ollscoil na hÉireann, Gaillimh GX_____

National University of Ireland, Galway

Autumn Examinations 2007/

Exam Code(s) 3BF Exam(s) Third Year BSc in Business Information Systems Module Code(s) MS Module(s) Advanced Programming Paper No. 1 Repeat Paper External Examiner(s) Professor H. van der Heijden Internal Examiner(s) Professor J. F. Collins Dr. T. Acton Instructions: (^) Answer any THREE QUESTIONS. All questions carry equal marks. Duration 2 hrs No. of Answer books Requirements : Handout MCQ Statistical Tables Graph Paper Log Graph Paper Other Material No. of Pages 5 including this page Department(s) Accountancy and Finance

OLLSCOIL NA hÉIREANN

NATIONAL UNIVERSITY OF IRELAND, GALWAY

AUTUMN EXAMINATIONS 2007/

THIRD YEAR BSc. IN BUSINESS INFORMATION SYSTEMS EXAMINATION (MS315) ADVANCED PROGRAMMING Professor H. van der Heijden Professor J. F. Collins Dr. T. Acton Time Allowed: TWO hours Answer any THREE QUESTIONS. All questions carry equal marks. Q1. An organisation wants a JavaScript application to determine the weekly fuel costs for its fleet of trucks. Trucks can carry dfferent loads from week to week. Weekly fuel is allocated to each truck at the start of each week, and is based on its load weight for that particular week: weights up to 30 tonnes are allocated 400 litres of fuel, weights between 30 and 50 tonnes inclusive are allocated 600 litres, and trucks over 50 tonnes are allocated 700 litres. Each litre of fuel costs €1.45. To test the application you have been provided with a list of trucks and associated estimate weights. Your application should input these data for each truck. The application should output an XHTML table showing each truck’s fuel costs, as well as the total weekly fuel cost. The partially completed script is provided below (you do not need to rewrite the provided code in your answer).

Q1: Truck Fleet Fuel Costs

Click Refresh (or Reload) to run this script again.

(33.3 marks)

(b) Write JavaScript statements to accomplish each of the following tasks: (i) Declare an empty array of three integers (ii) Total the elements of array m , which contains 10 numeric elements (iii) Print the integers from 1 to 18 using a FOR loop and the counter variable i. Assume that i has been declared but not initialised. Print only 3 integers per line. Write Unix commands to accomplish each of the following tasks: (iv) Rename a file named ‘data’ to ‘old_data’. (v) Folder1 contains a folder named ‘folder2’ and a file named ‘shopping_list.txt’. Move the file ‘shopping_list.txt’ into folder2. (vi) Search the file ‘report.txt’ for the string ‘sincerely’. (vii) Change file permissions on a file named ‘stuff’ so that all users can read, execute and write to it. (viii) Pipe the contents of a file ‘report.txt’ to the appropriate word count command to determine the file’s word count. (23.3 marks) Q4. (a) Create an XML document to mark up the contents of a music album CD. Each CD has an album title, artist name, and a number of songs. Each song has a name, and duration in minutes and seconds. Further, songs have a number sequence, from 1 (for the first song) to x (where x represents the last song on the CD). (12 marks) (b) A palindrome is a number or case-insensitive text phrase that reads the same backwards as forwards. For example, “ABBA”, “madam”, “able was I ere I saw elba”, 24542, 6770776, B2B and 7007 are all palindromes, whereas “Bono”, 123 and “Cavan” are not. Using a language of your choice write a program or script that reads in a 4-digit integer and determines whether it is a palindrome. If the user enters anything other than a 4-digit integer, inform the user, and allow the user to enter a new value. (21.3 marks)

Q5.

The following is a line-numbered Windows web server Perl script that tracks the number of times a web page has been accessed. Give a thorough explanation of what is occurring in each non-blank numbered line of code. 01 #!C:\Perl\bin\perl 02 # track_visits.pl 03 04 use CGI qw( :standard ); 05 06 open( COUNTREAD, "counter.dat" ); 07 $data = ; 08 $data++; 09 close( COUNTREAD ); 10 11 open( COUNTWRITE, ">counter.dat" ); 12 print( COUNTWRITE $data ); 13 close( COUNTWRITE ); 14 15 print( header(), "" ); 17 print( "You are visitor number", br() ); 18 19 for ( $count = 0; $count < length( $data ); $count++ ) { 20 $number = substr( $data, $count, 1 ); 21 print( img( { src => "images/$number.gif" } ), "\n" ); 22 } 23 24 print( "" ); (33.3 marks)