Notice: Due to an ongoing migration of our storage and publishing system, material requested since last month will not be uploaded for the time being, and new requests are paused. All existing notes remain available.

Unit 5 MCQs JavaScript Functions, Events and Validation

CSE326 — Internet Programming Laboratory 50 questions. Pick an option to check it.

Read the notes

0 of 50 answered 0 right 0 wrong , 50 left

  1. Question 1 of 50

    Which keyword is used to define a function in JavaScript?

  2. Question 2 of 50

    What is the correct syntax to call a function named 'myFunction'?

  3. Question 3 of 50

    Which statement is used to return a value from a JavaScript function?

  4. Question 4 of 50

    If a function is called with fewer arguments than declared parameters, what value are the missing parameters assigned?

  5. Question 5 of 50

    Which built-in object within a function contains an array-like list of all arguments passed to that function?

  6. Question 6 of 50

    What happens when a return statement is executed inside a function?

  7. Question 7 of 50

    Which event occurs when the user clicks on an HTML element?

  8. Question 8 of 50

    Which event is triggered when the mouse pointer moves over an element?

  9. Question 9 of 50

    Which event is triggered when the mouse pointer moves out of an element?

  10. Question 10 of 50

    Which event handler is used to execute code when a user submits a form?

  11. Question 11 of 50

    In form validation, what should the 'onsubmit' event handler return to prevent the form from submitting?

  12. Question 12 of 50

    Which event fires when an input field loses focus?

  13. Question 13 of 50

    Which event fires immediately when an input field gets focus?

  14. Question 14 of 50

    Which event is triggered when the content of a form element, the selection, or the checked state have changed?

  15. Question 15 of 50

    Which event occurs when the user presses a key on the keyboard?

  16. Question 16 of 50

    Which property of the event object returns the Unicode character code of the key that triggered the onkeypress event?

  17. Question 17 of 50

    Which event is triggered when a user releases a key?

  18. Question 18 of 50

    How can you access the value of an input field with id='email' in JavaScript?

  19. Question 19 of 50

    Which function is commonly used to check if a value is not a number during validation?

  20. Question 20 of 50

    To set the focus to a specific element in validation, which method is used?

  21. Question 21 of 50

    What is the 'this' keyword usually referring to inside an HTML event attribute (e.g., onclick='func(this)')?

  22. Question 22 of 50

    Which event occurs when a user double-clicks on an element?

  23. Question 23 of 50

    Which event occurs when a web page has finished loading?

  24. Question 24 of 50

    Which event is triggered when text is selected in an input or textarea?

  25. Question 25 of 50

    Which method is used to test if a string matches a regular expression pattern?

  26. Question 26 of 50

    When validating an email, which logic is best to check for the presence of '@'?

  27. Question 27 of 50

    What is the correct way to access a form named 'loginForm' via the document object?

  28. Question 28 of 50

    Which property indicates the number of characters in a string value of an input field?

  29. Question 29 of 50

    Which event handler is best suited for validating a field immediately after the user leaves it?

  30. Question 30 of 50

    What is the purpose of 'event.preventDefault()'?

  31. Question 31 of 50

    Which event is triggered when a form is reset?

  32. Question 32 of 50

    How do you check if a checkbox with id='agree' is checked?

  33. Question 33 of 50

    Can a JavaScript function return another function?

  34. Question 34 of 50

    Which mouse event is fired when a mouse button is pressed down (before releasing)?

  35. Question 35 of 50

    To validate that a password is at least 8 characters long, which condition is used?

  36. Question 36 of 50

    What defines the scope of a variable declared with 'var' inside a function?

  37. Question 37 of 50

    Which of the following is an anonymous function?

  38. Question 38 of 50

    Which regex syntax is used to create a Regular Expression object?

  39. Question 39 of 50

    In a dropdown list (select tag), how do you get the index of the selected option?

  40. Question 40 of 50

    What is the default return value of a function that does not have a return statement?

  41. Question 41 of 50

    Which event is commonly used to detect if a user is typing inside a text box?

  42. Question 42 of 50

    How can you stop a function execution if a validation error occurs?

  43. Question 43 of 50

    Which JavaScript function displays a dialog box with a message and an OK button?

  44. Question 44 of 50

    To check if a radio button is selected, which property do we check?

  45. Question 45 of 50

    When handling the 'onkeypress' event, how can you allow only numbers to be entered?

  46. Question 46 of 50

    Which is the correct syntax to bind an event handler in HTML?

  47. Question 47 of 50

    What is passed to the event handler function if defined as 'element.onclick = myFunction;'?

  48. Question 48 of 50

    Which function converts a string argument to an integer?

  49. Question 49 of 50

    In validation, if a field is empty, what does 'field.value' equal?

  50. Question 50 of 50

    What is the order of mouse events when clicking a button?

That's unit 5

Answer a few questions and your score shows up here.