JavaScript Questions & Answers – Creating a Shared Configuration File using JavaScript

«
»

This set of JavaScript Questions and Answers for Aptitude test focuses on “Creating a Shared Configuration File using JavaScript”.

1. What is the necessity to create a separate file after having an API key?
a) To hold configuration information
b) To hold key details
c) To hold URL details
d) To hold the speed of the process
View Answer

Answer: a
Explanation: An application programming interface key (API key) is a code passed in by computer programs calling an application programming interface (API) to identify the calling program, its developer, or its user to the Web site. Once you have an API key you should create a separate file to hold all of the configuration information that you will need to share between processes.
advertisement

2. How many parameters does the API accept?
a) 5
b) 6
c) 7
d) 8
View Answer

Answer: d
Explanation: Parameters are options you can pass with the endpoint (such as specifying the response format or the amount returned) to influence the response. The API accepts a total of 8 parameters namely:

  1. url
  2. location
  3. runs
  4. fvonly
  5. private
  6. block
  7. f
  8. k
  9. .

advertisement
advertisement

3. What is not the purpose of the parameter location?
a) Specifies agent location
b) Specifies speed
c) Specifies browser
d) Specifies block
View Answer

Answer: d
Explanation: The window.location object can be used to get the current page address (URL) and to redirect the browser to a new page. The parameter location specifies the agent location, speed and browser to use for the test, formatted as location.browser:location.

4. What will happen if the fvonly parameter is set to 1?
a) Results got for the first view
b) Can run the repeat view test
c) Running the test again
d) Ending the test
View Answer

Answer: a
Explanation: fvonly is an optional parameter which is set to 1 to skip the Repeat View test. If you set fvonly to 1, you get results only for the first view, and do not run the repeat view test.
Participate in JavaScript Certification Contest of the Month Now!
advertisement

5. How many reserved words are there in JavaScript?
a) 63
b) 54
c) 68
d) 90
View Answer

Answer: a
Explanation: Keywords are reserved words in JavaScript which you cannot use to name the variables labels or function names. There are a total of 63 reserved words in JavaScript.

6. What is the purpose of the window.location object in JavaScript?
a) Get the URL and redirect
b) Get the location of the cursor
c) Get the path to the next page
d) Get the location & path of the next page
View Answer

Answer: a
Explanation: The window.location object can be used to get the current page address (URL) and to redirect the browser to a new page. The parameter location specifies the agent location, speed and browser to use for the test, formatted as location.browser:location.
advertisement

7. Which of the following method loads a new document?
a) location.new()
b) loadnew()
c) location.load()
d) location.assign()
View Answer

Answer: d
Explanation: The window.location object can be written without the window prefix.
Some examples are window.location.href returns the href (URL) of the current page
window.location.hostname returns the domain name of the web host.

8. Which of the following method will wait for certain milliseconds to execute a specified method?
a) setInterval()
b) setTimeout()
c) setmilli()
d) setseconds()
View Answer

Answer: a
Explanation: The setInterval() method calls a function or evaluates an expression at specified intervals (in milliseconds). The setInterval() method will wait a specified number of milliseconds, and then execute a specified function, and it will continue to execute the function, once at every given time-interval.
advertisement

9. What is the method used to stop an execution of a method?
a) clearInterval()
b) clearTimeout()
c) both clearInterval() and clearTimeout()
d) clearmethod()
View Answer

Answer: c
Explanation: The clearInterval() method is used to stop further executions of the function specified in the setInterval() method) The clearTimeout() method is used to stop the execution of the function specified in the setTimeout() method.

10. What is the meaning of JavaScript Hoisting?
a) Moving declarations to bottom
b) Moving declarations to top
c) Hosting variables by itself
d) Moving declarations to specified location
View Answer

Answer: b
Explanation: Hoisting is JavaScript’s default behavior of moving all declarations to the top of the current scope (to the top of the current script or the current function). In JavaScript, a variable can be declared after it has been used. In other words; a variable can be used before it has been declared.

Sanfoundry Global Education & Learning Series – Javascript Programming.

To practice all areas of JavaScript for Aptitude test, here is complete set of 1000+ Multiple Choice Questions and Answers on Javascript.

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & technical discussions at Telegram SanfoundryClasses.