Pre-Board examination question paper set for Scripting Language from the year 2024.

Tribhuvan University
Faculty of Humanities & Social Sciences
OFFICE OF THE DEAN
2025
Bachelor in Computer Applications

Paper detail Value
Course Scripting Language
Code No. CACS254
Semester IVth
Full marks 60
Pass marks 24
Time 3 hours

Candidates are required to answer the questions in their own words as far as possible.

Group B

2. How client side scripting and server side scripting are different? Explain.

3. Explain about event handling in JavaScript. Create a simple HTML button and write a JavaScript event listener that changes the button's text to "Clicked!" when the button is pressed.

4. Write a function filterStrings() in PHP that takes an array of strings and returns a new array with strings that are longer than 3 characters.

5. What is an associative array in PHP? Write a program to demonstrate the concept of 2D associative array in PHP with programming example.

6. Create a html form having two text field and a submit button. Now write PHP code to take two numbers from the text fields and display "Namaste!" if the sum of two numbers is divisible by 7, display "Bye Bye" if the sum is divisible by 5, display "Welcome" if the sum is greater than twice the second number and display "HaHa" otherwise.

Group C

7. Explain about the significance of regular expressions. Create a web application having an image, when mouse cursor is placed over the image, description of the image should be displayed on a paragraph below that image and when mouse cursor is removed from the image, the description should be vanished. Now place a form below that with validation using JS. The validation errors should be displayed after each field if invalid considering following validation rules: All fields are required (name, username, age, password and confirm password); Name cannot have numbers and special characters; Username should be of minimum 8 character and must begin with alphabet; Age cannot be less than 18 years; Password and confirm password must match.

8. Differentiate between for loop and for-each-loop in PHP. WAP in PHP to demonstrate the use of for-each loop to access the elements of an associative array. Use prompt dialogs to take two numbers and an operator (+, -, *, /, %) from user and display the result on alert box according to the operator entered using switch-case statements.