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.
Based on our question bank analysis, master these concepts to score high in Web Technology.
Test your knowledge under real exam conditions with our curated mock assessment.
Start Preparing for Primers