SCHOOL OF ICT AND ENGINEERING
JAVASCRIPT PROGRAMMING
TIME: 2 HOURS
SEPTEMBER 2025 EXAM (60mks)
NAME ……………………….……………………….… ADM NO. ………………….
INSTRUCTIONS (Read instruction carefully then answer the QUESTIONS BELOW)
• write your name and admission number in the spaces provided
• All answers MUST be written in English in a separate answer booklet and
Well numbered.
• Answer all questions in section A(Compulsory)
• This paper contains two printed pages.
• Notes, text books and phones are not permitted into the examination room.
• You are not required to rewrite the question in your answer booklet.
• Read each question carefully before attempting it.
Turn over
SECTION A(COMPULSORY)
Question 1 (20 marks)
(a) Define the following JavaScript terms:
(i) Variable hoisting (2 marks)
(ii) Event bubbling (2 marks)
(iii) Callback function (2 marks)
(b) Write a JavaScript program that takes an array of numbers and returns a new array containing
only even numbers. (8 marks)
(c) State THREE differences between let, var, and const in JavaScript. (6 marks)
Section B
Answer ONLY TWO question
Question 2 (20 marks)
(a) Explain FIVE common uses of JavaScript in modern web development. (10 marks)
(b) Using JavaScript, write a function that accepts a number and checks whether it is prime. (8
marks)
(c) State TWO differences between synchronous and asynchronous code execution in JavaScript.
(2 marks)
Question 3 (20 marks)
(a) Write JavaScript code that changes the background color of a webpage to blue when a button
with the ID changeColor is clicked. (6 marks)
(b) Explain FOUR differences between JavaScript and Java programming languages. (8 marks)
(c) Describe THREE advantages of using JavaScript frameworks/libraries such as React or Vue.
(6 marks)
Question 4 (20 marks)
(a) Write a JavaScript function that takes a string and returns the number of vowels it contains. (6
marks)
(b) Explain FIVE JavaScript debugging techniques and the tools commonly used. (10 marks)
(c) State TWO security concerns related to client-side JavaScript and how to mitigate them. (4
marks)