JavaScript: Advantages, Uses, and Techniques, Exams of Web Design and Development

The advantages and limitations of client-side scripting using javascript. It covers common tasks, ways to insert javascript in html, primitive datatypes, operators, and more. Learn about arrays, strings, dates, html manipulation, events, and dom objects.

Typology: Exams

2022/2023

Uploaded on 12/21/2022

sagar925
sagar925 🇮🇳

2 documents

1 / 2

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
JavaScript
1. Mention some advantages and limitations of client side scripting.
2. Mention some common/widely used tasks performed by JavaScript.
3. Explain with examples the different ways to insert JavaScript in HTML code.
4. What are the primitive datatypes of JavaScript?
5. Explain with an example the difference between the operators == and ===.
6. What is the difference between undefined and null?
7. Explain with example the difference among prompt, alert and confirm.
8. Compare and contrast among var, let, and const.
9. Explain with examples:
i) indexOf(), pop(), push(), shift(), unshift(), slice(), splice() methods of Array.
ii) concat(), replace(), search(), split(), slice(), substring(), substr() methods of String.
iii) getFullYear(), getMonth(), getDate(), getHours() methods of Date.
10. Explain with example(s) how an HTML element can be added and removed from an HTML page
with JavaScript.
11. Describe the functionality of the following HTML DOM events: change, mousedown, mouseup,
click, submit, reset, load, unload.
12. Why addEventListener() is used? What is the difference between event bubbling and event
capturing?
13. State some properties and their usages of i) window.screen object and ii) window.navigator object.
14. What functionality is provided by a web Worker?
15. Write JavaScript function(s)/program:
i) To determine whether a given year is a leap year.
ii) To format a number up to specified decimal places.
iii) To check whether a string is palindrome or not.
iv) That accepts a string as a parameter and converts the first letter of each word of
the string in upper case.
Example string: The students of MCA second year
Expected Output: The Students Of MCA Second Year
v) That accepts a string as a parameter and finds the longest word within the string.
Example string: JavaScript Lab Assignments
Expected Output: Assignments
vi) Which accepts an argument and returns the type. Note: There are six possible
values that typeof returns: object, boolean, function, number, string, and
undefined.
vii) To get the number of occurrences of each letter in specified string.
viii) That accepts two arguments, a string and a letter and the function will count the
number of occurrences of the specified letter within the string in a case-insensitive
way.
Sample arguments: MCA students of Second year, s
Expected output: 3
pf2

Partial preview of the text

Download JavaScript: Advantages, Uses, and Techniques and more Exams Web Design and Development in PDF only on Docsity!

JavaScript

  1. Mention some advantages and limitations of client side scripting.
  2. Mention some common/widely used tasks performed by JavaScript.
  3. Explain with examples the different ways to insert JavaScript in HTML code.
  4. What are the primitive datatypes of JavaScript?
  5. Explain with an example the difference between the operators == and ===.
  6. What is the difference between undefined and null?
  7. Explain with example the difference among prompt , alert and confirm.
  8. Compare and contrast among var , let , and const.
  9. Explain with examples:

i) indexOf(), pop(), push(), shift(), unshift(), slice(), splice() methods of Array. ii) concat(), replace(), search(), split(), slice(), substring(), substr() methods of String. iii) getFullYear(), getMonth(), getDate(), getHours() methods of Date.

  1. Explain with example(s) how an HTML element can be added and removed from an HTML page

with JavaScript.

  1. Describe the functionality of the following HTML DOM events: change, mousedown, mouseup,

click, submit, reset, load, unload.

  1. Why addEventListener() is used? What is the difference between event bubbling and event

capturing?

  1. State some properties and their usages of i) window.screen object and ii) window.navigator object.
  2. What functionality is provided by a web Worker?
  3. Write JavaScript function(s)/program:

i) To determine whether a given year is a leap year. ii) To format a number up to specified decimal places. iii) To check whether a string is palindrome or not. iv) That accepts a string as a parameter and converts the first letter of each word of the string in upper case. Example string: The students of MCA second year Expected Output: The Students Of MCA Second Year v) That accepts a string as a parameter and finds the longest word within the string. Example string: JavaScript Lab Assignments Expected Output: Assignments vi) Which accepts an argument and returns the type. Note: There are six possible values that typeof returns: object, boolean, function, number, string, and undefined. vii) To get the number of occurrences of each letter in specified string. viii) That accepts two arguments, a string and a letter and the function will count the number of occurrences of the specified letter within the string in a case-insensitive way. Sample arguments: MCA students of Second year, s Expected output: 3

ix) To remove duplicate items from an array. x) To add specified years to a date. xi) To add specified months to a date. xii) To add specified weeks to a date. xiii) To get difference between two dates in days. xiv) To create a digital clock. xv) To change font, font size and colour of a paragraph. xvi) To change background colour of a paragraph. xvii) To create random background colour. xviii) Validate an HTML student registration form containing roll no, first name, middle name, last name, password, date of birth, mobile number, email address, marks obtained, grade point, with the following validation rules i) All the fields except for middle name cannot be empty. ii) Roll no. will be consisting of digits only. iii) First name, middle name (if present), last name will be consisting of alphabets only. iv) Password length will be 6 to 14, containing alphabets, digits and special characters @, $, #, _ and must contain at least one alphabet, at least one digit and at least one of the special characters. v) Age must be at least 18 years. vi) Mobile number will be 10 digits not starting with zero. vii) Email must be in a valid email format. viii) Grade point will consist of an integer part and a decimal part. ix) A student with negative marks or grade point less than 6.5 will not be allowed registration.