Question Bank CT1 2022 (CSS)
Question Bank CT1 2022 (CSS)
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).
16. Write a javascript function to generate Fibonacci series till user defined limit.
<html>
<body>
<script>
var t1 = 0;
var t2 = 1;
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(""+t2);
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.
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”
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
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>
</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.
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.
(i) onmouseup
(ii) onblur
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
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.
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
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
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.
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.