100% found this document useful (1 vote)
83 views

Question Bank CT1 2022 (CSS)

This document contains a question bank for a Class Test 1 on JavaScript. It includes 16 questions in Chapter 1 on JavaScript features, objects, loops, functions, and more. Chapter 2 includes 17 additional questions on arrays, functions, strings, averages, and palindromes. Chapter 3 has 14 questions on forms, grades, intrinsic functions, and more. Chapter 4 concludes with 12 questions on locations, prompts, cookies, windows, and timing events. The document provides sample code answers for many of the questions.

Uploaded by

Diri Caf
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
83 views

Question Bank CT1 2022 (CSS)

This document contains a question bank for a Class Test 1 on JavaScript. It includes 16 questions in Chapter 1 on JavaScript features, objects, loops, functions, and more. Chapter 2 includes 17 additional questions on arrays, functions, strings, averages, and palindromes. Chapter 3 has 14 questions on forms, grades, intrinsic functions, and more. Chapter 4 concludes with 12 questions on locations, prompts, cookies, windows, and timing events. The document provides sample code answers for many of the questions.

Uploaded by

Diri Caf
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 14

Question Bank

Class Test 1 (CSS)


Chapter 1
1. List any four features of Java script.

2. List the comparison operators in Java script.

3. Write Java script to create person object with properties firstname, lastname, age, eye
color, delete eye color property and display remaining properties of person object.
4. Explain getter and setter properties in Java script with suitable example.

5. State the use of dot syntax in JavaScript with the help of suitable example.
6. List and explain Logical operators in JavaScript.
7. Describe all the tokens of the following statements :
i. document.bgColor
ii. document.write()
8. Differentiate between prompt() and alert() methods.
9. State use of getters and setters
10. Write a JavaScript that displays first 20 even numbers on the document window.
11. Write a program to print sum of even numbers between 1 to 100 using for loop.
12. State the features of Javascript.

13. Write a javascript program to check whether entered number is prime or not.

14. Write a javascript program to validate user accounts for multiple set of user ID and password
(using swith case statement).

15. Differentiate between For-loop and For-in loop.

16. Write a javascript function to generate Fibonacci series till user defined limit.

Ans. NOT USER DEFINED

<html>

<body>

<script>

var t1 = 0;
var t2 = 1;

document.write("Fibonacci series includes : ");

document.write(" "+t1+" "+t2);

for(i = 0; i<=6; i++)

t3 = t2 + t1;

document.write(" "+t3);

t1=t2;

t2=t3;

</script>

</body>

</html>

OR

USER DEFINED

<html>

<body>

<script>

var t1 = 1;

var t2 = 0;

document.write("Fibonacci series includes : ");

document.write(""+t2);

var x = parseInt(prompt("Enter max length for fibonacci series","6"));

for(i = 0; i<x-1; i++)


{

t3 = t1 + t2;

document.write(" "+t3);

t1=t2;

t2=t3;

</script>

</body>

</html>

Chapter 2

1. Write a Java script that initializes an array called flowers with the names of 3
flowers. The script then displays array elements.

2. Write Java script to call function from HTML.

3. Write the use of CharAt() and indexof() with syntax and example.
4. Differentiate between concat () and join () methods of array object.

5. Write a Java script that will replace following specified value with another
value in a string.
String = “ I will fail”
Replace “fail” by “pass”

6. Write a Java script code to display 5 elements of array in sorted order.

7. Write a JavaScript program which compute, the average marks of the following students Then, this
average is used to determine the corresponding grade.
Student Name Marks
Advait 80
Anay 77
Manyata 88
Saanvi 95
Saachi 68

The grades are computed as follows :


Range Grade
<60 F
<70 D
<80 C
<90 B
<100 A

8. Write a JavaScript function that checks whether a passed string is palindrome or not.
Ans.

<html>
<body>
<script>
var s1 = prompt("Enter a string to check palindrome","madam");
s1 = s1.toUpperCase();
var s2 = s1.split(""); //converting it to array
var s3 = s2.reverse(); //reversing the array
var s4 = s3.join(""); //combining array back into a string
if(s1==s4) //condition for palindrome
{
alert("It is a palindrome");
}
else
{
alert("It is not a palindrome");
}
</script>
</body>
</html>
OR
<html>
<body>
<script>
var s1 = prompt("Enter a string to check palindrome","madam");
s1 = s1.toUpperCase();
var len = s1.length-1;
for(i=0;i<len/2;i++)
{
if(s1.charAt(i)!=s1.charAt(len-i))
{
alert("It is not a palindrome");
break;
}
}
if(i==len/2)
{
alert("It is a palindrome");
}
</script>
</body>
</html>

9. Differentiate between concat() and join() methods of array object.


10. Write a JavaScript function to count the number of vowels in a given string.
11. Write a JavaScript that find and displays number of duplicate values in an array.
12. Develop JavaScript to convert the given character to Unicode and vice versa.
13. Explain text rollover with suitable example.

14. State and explain any two properties of array object


15. Write a JavaScript function to insert a string within a string at a particular position
16. State the use of following methods.
i. charCodeAt()
ii. fromCharCode()
17. Differentiate between concat() and join() methods of array object.
18. Write a javascript function that accepts a string as a parameter and find the
length of the string.
Ans.
<html>
<body>
<script>
function sayHello(msg){
document.write("Hello "+msg +"<br>");
document.write("The length of your name is : "+msg.length +"<br>");
}

var x = prompt("Enter your name : ")


sayHello(x);

</script>
</body>
</html>
19. Write a javascript to checks whether a passed string is palindrome or not.

20. Develop javascript to convert the given character to unicode and vice-versa.
Chapter 3

1. Write a Java script to design a form to accept values for user ID & password.

2. Write a Java script program which computes, the average marks of the
following students then, this average is used to determine the corresponding grade.
StudentName Marks

Sumit 80
Kalpesh 77

Amit 88

Tejas 93

Abhishek 65
The grades are computed as follows :
Range Grade

< 60 E

< 70 D

< 80 C

< 90 B

< 100 A
3. Give syntax of and explain the use of “with” statement/clause in JavaScript using suitable example.
4. Enlist and explain the use of any two Intrinsic JavaScript functions.
5. Write a function that prompts the user for a color and uses what they select to set the background
color of the new webpage opened .

6. Write HTML Script that displays textboxes for accepting Name, middlename, Surname of the user
and a Submit button. Write proper JavaScript such that when the user clicks on submit button
i) all texboxes must get disabled and change the color to “RED”. and with respective
labels.

ii) Constructs the mailID as <name>.<surname>@msbte.com and displays mail ID as


message. (Ex. If user enters Rajni as name and Pathak as surname mailID will be constructed
as [email protected]) .

7. Write HTML Script that displays dropdownlist containing options NewDelhi, Mumbai, Bangalore.
Write proper JavaScript such that when the user selects any options corresponding description of about
20 words and image of the city appear in table which appears below on the same page.

8. Write a HTML script which displays 2 radiobuttons to the users for fruits and
vegetable and 1 option list. When user select fruits radio button option list should present only
fruits names to the user & when user select vegetable radio button option list should present
only vegetable names to the user.

9. Describe how to evaluate checkbox selection. Explain with suitable example.

10. Generate college Admission form using html form tag

11. Explain following form events :

(i) onmouseup

(ii) onblur

12. Write a javascript program to demonstrate java intrinsic function.

13. Write a javascript program to calculate add, sub, multiplication and division
of two number (input from user). Form should contain two text boxes to input numbers of four
buttons for addition, subtraction, multiplication and division.

14. Write a javascript to create option list containing list of images and then
display images in new window as per selection.

Chapter 4

1. State any two properties and methods of location object.

2. Explain prompt () and confirm () method of Java script with syntax and
example.
3. Write a JavaScript that initializes an array called “Fruits” with names of five fruits. The script then
displays the array in a message box.
4. State and explain what is a session cookie ?

5. Write syntax of and explain prompt method in JavaScript with the help of suitable example.

6. Write a JavaScript that displays all properties of window object. Explain the code .
7. Write the syntax of and explain use of following methods of JavaScript Timing Event. a.
a.setTimeout()
b. setInterval()
8. Write a webpage that diplays a form that contains an input for Username and password. User is
prompted to enter the input and password and password becomes value of the cookie. 9. Write The
JavaScript function for storing the cookie . It gets executed when the password changes.
10. Explain open () method of window object with syntax and example.

11. State the method to put message in web browser status bar?
12. Write a JavaScript that creates a persistent cookies of Itemnames. Write appropriate HTML
script for the same.

13. Describe, how to read cookie value and write a cookie value. Explain with
example.

14. Differentiate between bession cookies and persistent cookies.

15. Write a javascript program to changing the contents of a window.

16. Design a webpage that displays a form that contains an input for user name
and password. User is prompted to enter the input user name and password and password
become value of the cookies. Write the javascript function for storing the cookies.

17. Write a javascript program to create read, update and delete cookies.

18. Write a javascript to open a new window and the new window is having two
frames. One frame containing buthon as “click here !”, and after clicking this button an image
should open in the second frame of that child window.
Chapter 5

1. Describe regular expression. Explain search () method used in regular


expression with suitable example.
2. Write a Java script to modify the status bar using on MouseOver and on MouseOut with
links. When the user moves his mouse over the link, it will display “MSBTE” in the status bar.
When the user moves his mouse away from the link the status bar will display nothing.

3. Write a Java script that displays textboxes for accepting name & email ID & a
submit button. Write Java script code such that when the user clicks on submit
button

(1) Name Validation

(2) Email ID validation

4. Write a script for creating following frame structure (Repeat)

FRAME 1

FRAME 2 FRAME 3

• FRUITS

• FLOWERS

• CITIES
FRUITS, FLOWERS and CITIES are links to the webpage fruits.html,
flowers.html, cities.html respectively. When these links are clicked corresponding data appears in
FRAME 3.

5. Write a JavaScript that identifies a running browser.


6. State what is a regular expression? Explain its meaning with the help of a suitable example.
7. Write a webpage that accepts Username and adharcard as input texts. When the user enters
adhaarcard number ,the JavaScript validates card number and diplays whether card number is valid or
not. (Assume valid adhaar card format to be nnnn.nnnn.nnnn or nnnn-nnnn-nnnn).

8. Design the frameset tag for following frame layout :


FRAME1

FRAME2

FRAME3

9. State what is a regular expression? Explain its meaning with the help of a suitable example.
10.Write a JavaScript function to check whether a given value is valid IP value or not.
11. Write a javascript syntax to accessing elements of another child window.

12. State what is regular expression. Explain its meaning with the help of a
suitable example.
13. Write a javascript program to validate email ID of the user using regular
expression.
14. Write a javascript program to design HTML page with books information in
tabular format, use rollovers to display the discount information.

Chapter 6

1. List ways of protecting your web page and describe any one of them.
2. Create a slideshow with the group of three images, also simulate next and
previous transition between slides in your Java script.

3. Write a Javascript to create a pull – down menu with three options [Google, MSBTE, Yahoo]
once the user will select one of the options then user will be redirected to that site.

4. List ways of Protecting your webpage and describe any one of them.
5. Develop a JavaScript Program to Create Rotating Banner Ads with URL Links.
6. Create a slideshow with the group of four images, also simulate the next and previous transition
between slides in your JavaScript.
7. Write a JavaScript program to create rollover effect for three images.
8. Write a JavaScript program that create a scrolling text on the status line of a window.
9. Explain frame works of javascript and its application.
10. Write a javascript program to link banner advertisements to different URLs.

11. List ways of protecting your webpage and describe any one of them.

12. Write a javascript program to create a silde show with the group of six
images, also simulate the next and previous transition between slides in your javascript.

You might also like