Infosys Certified JavaScript Developer
Practice with real exam-pattern questions for Infosys Certified JavaScript Developer. Each question includes a detailed explanation to help you understand the concept, not just memorise the answer. Try 10 questions free — no login required.
Full question bank for this exam + 1,357+ others. Cancel anytime.
Join Premium10 Infosys Certified JavaScript Developer practice questions with answers
Real Lex exam-pattern multiple-choice questions for the Infosys Certified JavaScript Developer certification. Each question includes the correct answer. The full question bank is available to Premium members.
- Question 1
A JavaScript web application allows users to submit comments on articles. However, an attacker exploits a vulnerability in the comment submission form to inject a malicious script that steals users' session cookies. Which of the following best describes the type of attack and the appropriate mitigation strategy?
- ✓
Attack type: Cross-Site Scripting (XSS)
Mitigation: Implement input validation and output encoding.
Correct - B
Attack type: Cross-Site Request Forgery (CSRF)
Mitigation: Generate and validate unique tokens for each user session.
- C
Attack type: Cross-Site Scripting (XSS)
Mitigation: Use strong password policies to protect against session hijacking.
- D
Attack type: Cross-Site Request Forgery (CSRF)
Mitigation: Restrict access to sensitive cookies through HTTP-only flags.
- ✓
- Question 2
_________attack targets at gathering sensitive information pretending to be reputable source.
- ✓
keylogging
Correct - B
Phishing
- C
Cross-Site Scripting (XSS)
- D
DOM Injection
- ✓
- Question 3
Javascript dynamically includes the malicious script provided by the user on the web page results in a ____.
- ✓
DOM-based XSS
Correct - B
Reflected XSS
- C
Persistent XSS
- D
Cross Site Request Forgery
- ✓
- Question 4
Which of the following is a valid way to handle errors in an asynchronous function?
- ✓
try- catch block
Correct - B
if-else statement
- C
switch-case statement
- D
while loop
- ✓
- Question 5
Select the incorrect statement about the modules in JavaScript:
- ✓
Functions or variables defined in a module are not visible outside unless they are explicitly exported.
Correct - B
Developers can create a module and export only those values which are required to be accessed by other parts of the application.
- C
Modules are always by default in strict-mode code.
- D
We can use many default export in a single file.
- ✓
- Question 6
Annie is developing a web application with one of the functionalities as getting the list of courses available for a particular semester. But the application returned an error as follows :
“fetchapi.html:11 Uncaught (in promise) TypeError: Failed to fetch”. A part of the code she had written is as follows :async function myFetchAPI() { let response = await fetch('http://localhost:4400/courses');//Line1 if (response.ok) { let json = await response.json();//Line2 console.log(json) } else { console.log("HTTP-Error: " + response.status); } } myFetchAPI();//Line3
Which of the lines can be modified such that a user-friendly error message can be recorded on the console?- ✓
Line3.
CorrectmyFetchAPI(function(error){ console.log(error)}); - B
Line2.
let json = await response.json().catch(error); - C
Line1.
let response = new Promise(function(resolve, reject){ resolve(courses)}); - D
Line3.
myFetchAPI().catch(function(error){ console.log("HTTP-Error: " + error.message) });
- ✓
- Question 7
Output of the following code is Good Morning, It's a bright sunny Day. Which feauture of eventHandling is responsible for the sequence in the output?
<div onclick="console.log('It's a bright sunny day)"> <p onclick="console.log('Good Morning,')"> Click here! </p> </div>- ✓
Capturing
Correct - B
Targeting
- C
Clicking
- D
Bubbling
- ✓
- Question 8
Consider the below-mentioned code snippet. What will be the output of the following code snippet?
async function getData() { await Promise.reject("Error occurred"); return "Data"; } getData() .then(console.log) .catch(console.error);- ✓
"Error occurred"
Correct - B
"Data"
- C
Promise {<rejected>}
- D
Promise {<resolved>: "Data"}
- ✓
- Question 9
Peter wants to use spaces as separators when converting the below array to a string. Fill in the blank at line 1 to discover the right approach.
let courses=['HTML', 'CSS', 'Java', 'Angular']; courses._____(' '); //line 1- ✓
split
Correct - B
concat
- C
join
- D
slice
- ✓
- Question 10
What is the output of the following code snippet?
var arr=[3,2,,,5,7]; for(i=0;i<5;i++){ console.log(arr[i]); }- ✓
3 2 5
Correct - B
3 2 5 7
- C
3 2 undefined undefined 5
- D
3 2 undefined 5 7
- ✓
More in UI
Pay once. Clear every cert this year.
One subscription, full Telegram channel access, every PDF posted during your membership.
- Full access to all 1,357+ certifications
- Monthly updated question banks
- Telegram private channel access
- Cancel anytime
- Everything in Monthly
- Save ₹2,100 vs monthly billing
- Priority answer key requests
- Best for increasing DQ score fast
- Everything in Quarterly
- Lifetime channel access — no renewals
- All future certifications included
- Priority response from admin team
Common questions, straight answers.
A monthly-updated Telegram channel where we post real exam-pattern question banks and detailed answer keys for 1,357+ Infosys Lex certifications. You join once, you get every PDF posted during your membership.
Right after payment on our Graphy page, you'll receive a private invite link to the Telegram channel. Access is instant — usually under 30 seconds.
We compile question banks from the actual Lex test pattern, sourced and verified by 180K+ community members who've recently cleared these exams. Match rate is consistently 85–95%.
Every single month. When Infosys rolls out new versions of certifications, we post updated dumps within 7–10 days. You'll see channel activity weekly.
Clearing certifications is one of the highest-weighted DQ factors. Members typically clear 3–5 certifications in their first 3 months, which moves DQ scores up by a full band.