Page 232 - Web Applications (803) Class 12
P. 232
Previous Years’ Questions
1. Identify the type of operator in the following statement:
a! = b [2023]
(a) Arithmetic (b) Comparison
(c) Logical (d) Assignment
Ans. (c) Logical
2. If a variable is declared without assigning any value, what is its type (datatype)? [2023]
(a) Float (b) Undefined
(c) Integer (d) String
Ans. (b) Undefined
3. What is the output of the following code snippet? [2023]
document.write (Math.round (5.319))
Ans. 5
4. What is the use of isFinite() in JavaScript? [2023]
Ans. The JavaScript isFinite() function determines whether or not the provided value is a finite number. It returns a
boolean value, which can be true or false.
5. If A=10, B=2 C=4, then what will be the output of the following JavaScript statements? [2023]
if ((A>B) && (B>C))
{ document.write("Hi")
}
else
{
document.write("Bye")
}
Ans. Output will be Bye
6. Which method in JavaScript allows to join all elements of an array into a string? [2023]
Ans. Array join() method
7. Consider the following declaration in JavaScript: [2023]
varTxt= "Life is Beautiful"
Write a statement that will display the string in uppercase.
Ans. document.write("Life is Beautiful".toUpperCase());
8. Jared wants to generate a combined list of fruits and vegetables. She has two arrays: [2023]
var fruits = ["Guava", "Apple", "Mango"]
var vegetables = ["Spinach", "French beans"].
Which inbuilt JavaScript function can be used to join the two arrays?
Ans. The concat() method will combine the fruits and vegetables arrays into a single array – var arr3 = fruits.
concat(vegetables).
9. Define objects with respect to JavaScript. Also give one difference between properties and methods of
an object. [2023]
Ans. In JavaScript, objects are complex data structures that encapsulate data and behaviour. Properties are attributes
that store data, while methods are functions associated with the object, representing its behaviour.
230 Touchpad Web Applications-XII

