A directory of Objective Type Questions covering all the Computer Science subjects. Here you can access and discuss Multiple choice questions and answers for various compitative exams and interviews.

1. Which of the following is correct about JavaScript?
a. JavaScript is a lightweight, interpreted programming language.
b. JavaScript has object-oriented capabilities that allows you to build interactivity into otherwise static HTML pages.
c. The general-purpose core of the language has been embedded in Netscape, Internet Explorer, and other web browsers.
d. All of the above.
View Answer Report Discuss Too Difficult! Search Google
Answer: (d).All of the above.

2. Which of the following is the correct syntax to print a page using JavaScript?
a. window.print();
b. browser.print();
c. navigator.print();
d. document.print();
View Answer Report Discuss Too Difficult! Search Google
Answer: (a).window.print();

3. Which of the following type of variable is visible only within a function where it is defined?
a. global variable
b. local variable
c. Both of the above.
d. None of the above.
View Answer Report Discuss Too Difficult! Search Google
Answer: (b).local variable

4. Which built-in method returns the calling string value converted to upper case?
a. toUpperCase()
b. toUpper()
c. changeCase(case)
d. None of the above.
View Answer Report Discuss Too Difficult! Search Google
Answer: (a).toUpperCase()

5. Which of the following function of Number object returns the number's value?
a. toString()
b. valueOf()
c. toLocaleString()
d. toPrecision()
View Answer Report Discuss Too Difficult! Search Google
Answer: (b).valueOf()

6. Which of the following function of String object returns the index within the calling String object of the first occurrence of the specified value?
a. substr()
b. search()
c. lastIndexOf()
d. indexOf()
View Answer Report Discuss Too Difficult! Search Google
Answer: (d).indexOf()

7. Which of the following function of String object creates an HTML anchor that is used as a hypertext target?
a. anchor()
b. link()
c. blink()
d. big()
View Answer Report Discuss Too Difficult! Search Google
Answer: (a).anchor()

8. Which of the following function of String object causes a string to be displayed as struck-out text, as if it were in a strike tag?
a. sup()
b. small()
c. strike()
d. sub()
View Answer Report Discuss Too Difficult! Search Google
Answer: (c).strike()

9. Which of the following is true about variable naming conventions in JavaScript?
a. You should not use any of the JavaScript reserved keyword as variable name.
b. JavaScript variable names should not start with a numeral (0-9).
c. Both of the above.
d. None of the above.
View Answer Report Discuss Too Difficult! Search Google
Answer: (c).Both of the above.

10. Which of the following is the correct syntax to redirect a url using JavaScript?
a. document.location='http://www.newlocation.com';
b. browser.location='http://www.newlocation.com';
c. navigator.location='http://www.newlocation.com';
d. window.location='http://www.newlocation.com';
View Answer Report Discuss Too Difficult! Search Google
Answer: (d).window.location='http://www.newlocation.com';

Page 1 of 11