Docsity

JavaScript in Notes Domino Applications Practice Exam, Exams of Technology

Toggle sidebar
bg1
Principal CLP613 Using JavaScript in Notes Domino
Applications Practice Exam
**Question 1.** Which JavaScript keyword is used to declare a variable that can
be re‑assigned within a Domino client‑side script?
A) const
B) let
C) var
D) static
Answer: C
Explanation: In classic Domino client‑side JavaScript, `var` is the traditional
keyword for declaring variables that can be re‑assigned. `let` and `const` are ES6
features not guaranteed in older Domino browsers.
**Question 2.** In a Domino web form, which method retrieves a form field by its
HTML name attribute?
A) document.getElementById()
B) document.forms[0].elements["fieldName"]
C) window.getField()
D) Domino.getFieldByName()
Answer: B
Explanation: `document.forms[0].elements["fieldName"]` accesses a field using
the name attribute generated by Domino for web‑rendered forms.
**Question 3.** What does the Domino URL command `?OpenAgent` do when
invoked from client‑side JavaScript?
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36
pf37
pf38
pf39
pf3a
pf3b
pf3c
pf3d
pf3e
pf3f
pf40
pf41
pf42
pf43
pf44
pf45
pf46
pf47
pf48
pf49
pf4a
pf4b
pf4c
pf4d
pf4e
pf4f
pf50
pf51
pf52
pf53
pf54
pf55
pf56
pf57
pf58
pf59
pf5a
pf5b
pf5c
pf5d
pf5e
pf5f
pf60
pf61
pf62
pf63
pf64

Partial preview of the text

Download JavaScript in Notes Domino Applications Practice Exam and more Exams Technology in PDF only on Docsity!

Applications Practice Exam

Question 1. Which JavaScript keyword is used to declare a variable that can be re‑assigned within a Domino client‑side script? A) const B) let C) var D) static Answer: C Explanation: In classic Domino client‑side JavaScript, var is the traditional keyword for declaring variables that can be re‑assigned. let and const are ES features not guaranteed in older Domino browsers. Question 2. In a Domino web form, which method retrieves a form field by its HTML name attribute? A) document.getElementById() B) document.forms[0].elements["fieldName"] C) window.getField() D) Domino.getFieldByName() Answer: B Explanation: document.forms[0].elements["fieldName"] accesses a field using the name attribute generated by Domino for web‑rendered forms. Question 3. What does the Domino URL command ?OpenAgent do when invoked from client‑side JavaScript?

Applications Practice Exam

A) Opens a new Notes client window B) Triggers a server‑side agent execution C) Displays the agent’s source code D) Starts a LotusScript debugger Answer: B Explanation: Adding ?OpenAgent to a URL calls the specified agent on the Domino server, allowing client‑side scripts to invoke server‑side processing. Question 4. Which of the following is the correct way to prevent a form from submitting if a validation function returns false? A) return true; B) event.stopPropagation(); C) return false; D) document.submit = false; Answer: C Explanation: Returning false from the onsubmit handler stops the default submit action, allowing custom validation logic to block the submission. Question 5. In Domino, which object provides access to the current document’s fields on the server side? A) session.document B) database.currentDocument

Applications Practice Exam

Answer: B Explanation: Changing the CSS display property to "none" hides the HTML element generated for the Domino field. Question 8. Which regular expression correctly validates a simple email address in a Domino form? A) /^[a-z0-9._%+-]+@[a-z0-9.-]+.[a-z]{2,4}$/i B) /[^\s]+@[^\s]+.[^\s]{2,}/ C) /^\w+@\w+.\w{2,3}$/ D) /.@...*/ Answer: A Explanation: Option A uses a comprehensive pattern with case‑insensitive flag, ensuring proper local‑part and domain validation. Question 9. What does the JavaScript statement window.open('page.html','_blank','width=600,height=400'); accomplish in a Domino web app? A) Opens the page in the same window B) Opens a new browser window with specified dimensions C) Sends the page to the server for printing D) Refreshes the current page Answer: B

Applications Practice Exam

Explanation: window.open creates a new browser window (or tab) with the URL and optional size parameters. Question 10. Which event is triggered when a user moves focus away from a Domino field? A) onblur B) onchange C) onfocusout D) onexit Answer: A Explanation: The onblur event fires when an element loses focus, commonly used for field validation. Question 11. In a Domino web form, which HTML element is automatically generated for a multi‑value field? A) <input type="text"> B) <select multiple> C) <textarea> D) <input type="checkbox"> Answer: B Explanation: Domino renders multi‑value fields as a <select> element with the multiple attribute.

Applications Practice Exam

Question 14. Which of the following statements about var scope in Domino client‑side scripts is true? A) var is block‑scoped B) var is function‑scoped C) var is globally scoped only D) var cannot be used in Domino scripts Answer: B Explanation: In JavaScript, var declares a variable that is scoped to the nearest enclosing function, not to blocks. Question 15. When using document.getElementById('field1') on a Domino web form, what type of object is returned? A) NotesItem B) HTMLInputElement C) DominoFieldObject D) JavaScript String Answer: B Explanation: The method returns the DOM element representing the HTML input, which is an HTMLInputElement. Question 16. Which JavaScript construct is best for iterating over all items in a Domino view returned as a JSON array?

Applications Practice Exam

A) for…in loop B) while loop C) forEach() method D) do…while loop Answer: C Explanation: Array.prototype.forEach() provides a clean way to process each element of a JSON array representing view entries. Question 17. What is the purpose of the return false; statement inside an onclick handler for a Domino button? A) Submits the form automatically B) Prevents the default button action (form submission) C) Closes the browser window D) Triggers a server‑side agent Answer: B Explanation: Returning false from an event handler cancels the default action, which for a button is typically form submission. Question 18. Which JavaScript function can be used to format a Domino DateTime field into a readable string on the client side? A) formatDate() B) notesDate.format()

Applications Practice Exam

Answer: B Explanation: Domino uses the name attribute to map HTML inputs back to internal field names. Question 21. Which JavaScript statement correctly disables a Domino text field named “email”? A) document.getElementById('email').disabled = true; B) document.email.readOnly = true; C) document.forms[0].email.enable = false; D) notesField.setDisabled(true); Answer: A Explanation: Setting the disabled property of the DOM element to true prevents user interaction. Question 22. How can you prevent Cross‑Site Scripting (XSS) when inserting user‑provided data into a Domino page via JavaScript? A) Use eval() on the data B) Encode special characters with escapeHTML() C) Store data in a hidden field D) Disable JavaScript on the page Answer: B

Applications Practice Exam

Explanation: Encoding characters like <, >, &, ", and ' neutralizes malicious scripts, mitigating XSS risks. Question 23. Which method is used to parse an XML response from a Domino agent in client‑side JavaScript? A) JSON.parse() B) new DOMParser().parseFromString(xmlString, "text/xml") C) eval(xmlString) D) xmlString.toObject() Answer: B Explanation: DOMParser converts an XML string into a traversable DOM document. Question 24. What does the onload event of a Domino form’s <body> tag allow you to do? A) Validate fields before the user sees the form B) Execute code after the page and all resources are fully loaded C) Open a new window automatically D) Submit the form silently Answer: B Explanation: The onload event fires once the entire page, including images and scripts, has finished loading.

Applications Practice Exam

A) document.getElementById('field1').error = "Message"; B) document.getElementById('field1').parentNode.innerHTML += "Message"; C) notesField.setError("Message"); D) alert("Message"); Answer: B Explanation: Appending a <span> with an error class to the field’s container displays a custom message without using alerts. Question 28. Which JavaScript function can be used to delay execution of a validation routine by 500 milliseconds after a user stops typing? A) setTimeout(validate, 500) B) setInterval(validate, 500) C) delay(validate, 500) D) wait(validate, 500) Answer: A Explanation: setTimeout schedules a single call to validate after the specified delay. Question 29. In Domino server‑side JavaScript, which method writes a string directly to the HTTP response? A) response.write()

Applications Practice Exam

B) notesSession.send() C) database.output() D) print() Answer: A Explanation: response.write() streams data back to the client as part of the HTTP response. Question 30. Which JavaScript statement correctly checks whether a variable x is undefined? A) if (x == null) B) if (typeof x === "undefined") C) if (x === undefined) D) if (!x) Answer: B Explanation: Using typeof avoids ReferenceError if x has never been declared. Question 31. When a Domino form is rendered in a web browser, which DOM element represents the entire form? A) <form> B) <div id="form"> C) <table>

Applications Practice Exam

Answer: A Explanation: An <input type="submit"> triggers form submission on Enter key press within a text field. Question 34. Which JavaScript construct is best for performing an action after all fields in a Domino form have been validated successfully? A) try…catch block B) onsubmit handler that returns true C) setInterval polling D) window.onload event Answer: B Explanation: Returning true from the onsubmit handler allows the form to proceed only after validation passes. Question 35. How can you retrieve the value of a hidden Domino field called “docID” using client‑side JavaScript? A) document.getElementById('docID').value B) notesDocument.getItemValue('docID') C) window.docID D) document.forms[0].docID.hiddenValue Answer: A

Applications Practice Exam

Explanation: Hidden fields are rendered as standard <input type="hidden"> elements; their value is accessed via .value. Question 36. Which of the following is a security risk when using eval() on user‑provided data in a Domino web page? A) Slower performance B) Increased memory usage C) Execution of arbitrary code (XSS) D) Browser incompatibility Answer: C Explanation: eval() executes the supplied string as code, allowing attackers to run malicious scripts. Question 37. In Domino, which server‑side JavaScript method can be used to read a document’s item as a string? A) notesDocument.getItemValueString("Field") B) notesDocument.getItemValue("Field")[0] C) notesDocument.getItemValue("Field") D) notesDocument.getItemValueAsText("Field") Answer: B Explanation: getItemValue returns an array; accessing the first element yields the string value.

Applications Practice Exam

Question 40. Which JavaScript function can be used to escape characters that have special meaning in a regular expression? A) escapeRegExp() B) RegExp.escape() C) encodeURIComponent() D) No built‑in; you must replace manually Answer: D Explanation: JavaScript does not provide a native escapeRegExp; developers typically write a helper that replaces special characters. Question 41. In a Domino web page, which tag is used to include a client‑side JavaScript file? A) <script src="file.js"></script> B) <javascript src="file.js"/> C) <link rel="script" href="file.js"> D) <import src="file.js"/> Answer: A Explanation: The standard HTML <script> element with a src attribute loads external JavaScript. Question 42. Which of the following statements correctly describes the difference between == and === in Domino client scripts?

Applications Practice Exam

A) == compares types, === does not B) === performs type coercion, == does not C) == performs type coercion, === does not D) Both behave identically in all cases Answer: C Explanation: == converts operands to a common type before comparison; === requires both value and type to match. Question 43. How can you programmatically submit a Domino form using JavaScript without clicking a button? A) document.forms[0].submit(); B) window.submitForm(); C) notesForm.submit(); D) document.submit(); Answer: A Explanation: The DOM submit() method triggers form submission programmatically. Question 44. Which JavaScript method can be used to add a new option to a <select> element representing a Domino multi‑value field? A) select.addOption() B) select.appendChild(new Option(text, value))