Complete Subject Question Bank
Consider the below webpage: Which of the following is used to do this ?
HTML provides various elements for structuring and displaying web page content. The specific element depends on the layout type: tables for tabular data, divs for layout, semantic tags for content grouping.
If the phone number should accept only 10 digit numbers, which of the following options will suit?
To accept only 10-digit phone numbers, use HTML5 input type='tel' with pattern='[0-9]{10}' or implement JavaScript regex validation using /^[0-9]{10}$/.test(value).
Ram has designed a portal with 'like' and 'unlike' image buttons that redirect to 'thanks.html'. Which HTML code correctly implements this?
The correct approach uses <input type="image"> which creates a clickable image submit button. The src attribute specifies the image, and the form action redirects to thanks.html on click.
HTML stands for __________
HTML stands for HyperText Markup Language. 'HyperText' refers to links connecting pages, and 'Markup Language' refers to the use of tags to annotate content for web browsers.
Which element is a container for all the head elements, and may include the document title, scripts, styles, meta information, and more?
The HTML <head> element is a container for document metadata and head elements, including the <title>, <link> to stylesheets, <script> tags, <meta> tags, and more.
An application that lets you search and see material on the internet is
A web browser (e.g., Chrome, Firefox, Safari) is an application used to search for and view content on the internet by fetching and rendering HTML pages.
Choose the correct JavaScript statement which helps you to write "World of JavaScript" in a web page.
document.write() is the correct JavaScript method for writing content to the HTML document. System.out.println is Java syntax, and plain write() or println() are not valid browser JavaScript functions.
Which of the below is the correct syntax for exectuing some code if "amt" is equal to 5000?
The correct JavaScript syntax for an equality condition is: if(amt == 5000) { ... }. Using == checks loose equality (value only) while === checks strict equality (value and type).
Polson needs to extract every character from a text string for email validation. Which JavaScript method is best suited?
JavaScript's charAt(index) method returns the character at the specified position in a string, making it ideal for iterating through each character for validation.
Ram's banking website has a 'Check Interest Rates' button that should redirect users to a separate page. Which JavaScript code accomplishes this?
window.location.href (or location.href) is the standard JavaScript property used to redirect the browser to a different URL.
Predict the output of the following JavaScript code: <html> <head> <script> var txt= "pass 70% fail 30%"; var pattern = /\D/g; var res= txt.match(pattern); document.write(res); </script> </head> </html>
The \D regex matches any non-digit character. Applied globally to "pass 70% fail 30%", it returns all letters, spaces, and symbols. The output will be an array of non-digit characters joined by commas when written to the document.
What is the output of the below code snippet <script type="text/javascript"> amt=55+"55"; document.write(amt); </script>
In JavaScript, when a number is added to a string using +, type coercion converts the number to a string and performs concatenation. So 55 + '55' equals '5555', not 110.
The parseInt() method converts the string to a integer. Before applying this function, Ram wants to know the type of the argument that is passed to the function. Which operator in javascript would support this ?
The typeof operator in JavaScript returns a string describing the data type of its operand (e.g., 'number', 'string', 'boolean', 'object', 'undefined'). It is used before parseInt() to check the argument type.
When a user views a page containing a JavaScript program, which machine actually executes the script?
Client-side JavaScript is executed by the user's local machine (web browser), not the web server. This enables interactive functionality without requiring round-trips to the server.
David, a beginner in web development trying to perform one particular operation using client side JavaScript. Choose the correct option(s) that he can't be done with client-side JavaScript?
Client-side JavaScript running in a browser cannot write files to the server filesystem, access OS-level resources, or directly modify server databases. These operations require server-side code.
When you want to enclose; some JavaScript statements to an HTML file, which is the correct tag you have to use?
JavaScript is embedded in HTML using the <script> tag. It can appear in <head> or <body>, either with inline code or a src attribute pointing to an external .js file.
Which of the below statements are used to comment a line in JavaScript file?
JavaScript supports two comment syntaxes: // for single-line comments and /* ... */ for multi-line block comments. Both are valid for commenting code.
Sita wishes to greet the user when the user clicks on "Greet Me" button. In which event does she need to write the JavaScript code for greeting the user?
Sita should write the JavaScript greeting code in the onclick event of the button. The onclick event fires when the user clicks the element.
Which of the below java script code helps to change the content of the paragraph tag dynamically? <p id="pid1">Aim Higher.. Sky is your limit
document.getElementById('pid1').innerHTML = 'new content' dynamically changes the HTML content inside the paragraph with id='pid1'. This is the standard DOM manipulation approach.
Rhita wants to replace jQuery's $(document).ready(fun) with an equivalent shorter method.
$(fun) is the shorthand for $(document).ready(fun) in jQuery. It executes the provided function once the DOM is fully loaded and ready for manipulation.
$("#name").remove(); This will remove the text field when you click on the button. State true or false.
TRUE — jQuery's .remove() method removes the matched element and all its descendants from the DOM. $('#name').remove() removes the element with id='name'.
jQuery is a JavaScript Object Notation library
FALSE — jQuery is a fast, lightweight JavaScript library for DOM manipulation, event handling, animations, and AJAX. It is NOT related to JSON (JavaScript Object Notation), which is a data serialization format.
Bind an event handler to the "blur" JavaScript event on an element.
jQuery's .blur() method attaches an event handler for the blur event, which fires when an element (typically a form field) loses focus. Commonly used for input validation.
Raju wants to remove an event handler that was attached with on() function.Help him to select the correct option.
jQuery's .off() method removes event handlers that were attached with .on(). It is the standard way to unbind events in jQuery.
John sets an element's CSS position property to its default value and applies jQuery animations. What is the output?
jQuery animations require the CSS position property to be 'relative', 'absolute', or 'fixed'. The default value is 'static', which prevents movement-based animations from working, so both options B and C correctly describe the failure.
Kiran wants to remove all the child nodes from the given div element. Help him to select the correct option to remove all the child node from the div element. <body> <div> This is some text <h2>Good morning</h2> <p>This is a paragraph inside the div.</p> </div> <p>This is a paragraph outside the div.</p> </body>
jQuery's .empty() method removes all child nodes and content from the selected element while keeping the element itself. Use .remove() to delete the element and its children entirely.
Some users don't want animations to interfere with their web page experience. How can a user turn off animations?
jQuery's .stop() method stops the currently running animation on the matched elements. Setting $.fx.off = true globally disables all animations, but .stop() is the standard per-element control method.
When referencing an HTML element using jQuery preceded by a # , what JavaScript function is this equivalent to?
TRUE — Using # in jQuery (e.g., ) is the equivalent of document.getElementById("myId") in plain JavaScript. Both select an element by its unique id attribute.
If you want to change the color of a link to red when moving mouse pointer on top of it, which CSS property you need to change?
To change a link's color when hovering, modify the CSS 'color' property. This can be done via the CSS :hover pseudo-class or dynamically using jQuery's .css('color', 'red') in a hover event.
Which of the following is most appropriate tag in html 5 to divide the document into logical document groups?
The HTML5 <section> element is the most appropriate tag for dividing a document into logical groups based on thematic content. It is more semantic than a generic <div>.
The following elements are newly added elements in HTML5: <section> <article> <aside> These elements are called _____________
The <section>, <article>, and <aside> elements introduced in HTML5 are called semantic elements. They convey meaning about their content to browsers, developers, and accessibility tools.
Based on our question bank analysis, master these concepts to score high in Web Technology.
"Focus on understanding the logic behind pseudocode loops and selection statements, as they form the bulk of technical assessments."