Web Development Practice Test — Questions and Answers
Question 1: In HTML 5, which of the following HTML 4 attributes has been removed?
- link
- text
- rules
- all of the above (Correct answer)
Correct answer: all of the above
HTML5 aimed to separate content from presentation, encouraging developers to use CSS for styling. Consequently, many presentational attributes from HTML4 were removed or deprecated. The `link`, `text`, and `rules` attributes all fall into this category, as their functionalities are now handled more effectively and semantically by Cascading Style Sheets.
Question 2: In HTML 5, which of the following is not a new element?
- audio
- nav
- frameset (Correct answer)
- article
Correct answer: frameset
HTML5 introduced several new semantic elements to improve document structure and accessibility, such as `<audio>`, `<nav>`, and `<article>`. The `<frameset>` element, however, was part of HTML4 and was used for creating framed web pages. This element has been removed in HTML5 due to its outdated nature and accessibility concerns, making it not a new element.
Question 3: In HTML 5, which of the following elements has been removed?
- compact
- marginwidth
- vlink
- dir (Correct answer)
Correct answer: dir
HTML5 deprecated or removed several elements that were either redundant, purely presentational, or had better semantic alternatives. The `<dir>` element, originally intended for directory lists, was removed in favor of using the more versatile `<ul>` (unordered list) element. Therefore, `dir` is an element that has been removed in HTML5.
Question 4: Date/time content is shown using which of the following attributes?
- datetime (Correct answer)
- time
- year
- date
Correct answer: datetime
The `<time>` element in HTML5 is used to represent a specific point in time or a time range. To provide a machine-readable format of this time, the `datetime` attribute is utilized. This attribute allows browsers and search engines to understand the precise date and time, regardless of how the human-readable text is formatted.
Question 5: Which of the following elements is used to highlight content in the same way that a highlighter pen is used to highlight text in a book?
- strong
- mark (Correct answer)
- em
- none of the above
Correct answer: mark
The `<mark>` element in HTML5 is specifically designed to highlight text for reference or notation purposes, similar to using a highlighter pen. It semantically indicates content that is relevant in another context or for a particular reason. While `<strong>` and `<em>` are for emphasis, `<mark>` is for drawing attention to specific parts of text.
Question 6: What else has to be done to make the Open Web Platform deliver on its promises?
- Media and real-time Communications
- Security and Privacy
- Performance and Tuning
- All of the above (Correct answer)
Correct answer: All of the above
The Open Web Platform aims to be a robust and comprehensive environment for application development. To fully realize its potential and deliver on its promises, continuous advancements are necessary across multiple critical areas. These include enhancing media and real-time communication capabilities, strengthening security and privacy features, and improving overall performance and tuning.
Question 7: The wav file format is not supported by which of the following browsers?
- Internet Explorer (Correct answer)
- Chrome
- Firefox
- Opera
Correct answer: Internet Explorer
While many modern browsers offer broad support for various audio formats, Internet Explorer (especially older versions) has historically had more limited native support for certain media types. WAV files, being uncompressed, are often less universally supported for direct web playback across all browser versions compared to more common compressed formats like MP3 or Ogg Vorbis.
Question 8: Which of the following properties includes audio controls such as play, pause, and volume?
- src
- source
- audio
- controls (Correct answer)
Correct answer: controls
In HTML5, when embedding audio or video using the `<audio>` or `<video>` elements, the `controls` attribute is used to display the browser's default playback interface. This interface typically includes essential features like play/pause buttons, a volume slider, and a progress bar. Without this attribute, the media would play without any visible user controls.
Question 9: Which of the following procedures must empty the list of subpaths in order for the context to have zero subpaths once more?
- moveTo()
- closepath()
- beginPath() (Correct answer)
- none of the above
Correct answer: beginPath()
In the HTML Canvas API, the `beginPath()` method is crucial for starting a new drawing path. Its primary function is to empty the list of subpaths, effectively resetting the current path. This ensures that any subsequent drawing commands begin a fresh, independent path, preventing unintended connections to previous drawing segments.
Question 10: Which of the following is not an input tag attribute type?
- week
- month
- time
- day (Correct answer)
Correct answer: day
HTML5 introduced several new `type` attributes for the `<input>` tag to provide specialized input fields for specific data types. These include `week`, `month`, and `time` for various date and time-related inputs. However, `day` is not a standard standalone `type` attribute for the `<input>` tag; individual days are typically handled within `date` or `datetime-local` types.
Question 11: Which option allows a sanboxed iframe to run script from the same domain?
- allow-forms
- allow-scripts (Correct answer)
- allow-same-origin
- none of the above
Correct answer: allow-scripts
The `sandbox` attribute for iframes creates a highly restricted environment for embedded content, enhancing security by default. To allow JavaScript to execute within such a sandboxed iframe, the `allow-scripts` keyword must be explicitly added to the `sandbox` attribute's value. This grants specific permission for script execution within that isolated context.
Question 12: When you refer to variables in other scopes, what does the interpreter do?
- Finds the bugs
- Traverses the queue
- Traverse the stack (Correct answer)
Correct answer: Traverse the stack
When a JavaScript interpreter encounters a variable reference that isn't in the current scope, it systematically searches for that variable in enclosing scopes. This process involves traversing up the scope chain, which is conceptually represented by the call stack. The interpreter continues this traversal until the variable is found or the global scope is reached.
Question 13: To hold value, why do you need to establish locally scoped variables?
- To minimize memory usage
- To cache the reference document location (Correct answer)
- To increase the speed
- To optimized the testing process
Correct answer: To cache the reference document location
Establishing locally scoped variables to hold values, especially references to DOM elements or other objects, is a common optimization technique. By caching these references in a local variable, the JavaScript engine avoids repeatedly traversing the DOM or re-evaluating expressions to find the same resource. This improves performance by providing quicker access to the referenced document location or object.
Question 14: After you've called StartTimeLogging(), what's the next step?
- Compile the code
- Run the code (Correct answer)
- Interpret the code
- None of the above
Correct answer: Run the code
The `StartTimeLogging()` function is typically used to mark the beginning of a code execution block whose performance is to be measured. After initiating this logging, the logical next step is to execute the specific code segment that you intend to profile. Once the code has run, a corresponding `StopTimeLogging()` function would then be called to record the elapsed time.
Question 15: How many different modes can the closure compiler be used in?
- 2 (Correct answer)
- 4
- 5
- 6
Correct answer: 2
The Google Closure Compiler primarily offers two distinct modes for optimizing JavaScript code. These are 'Simple optimizations,' which performs basic minification and whitespace removal, and 'Advanced optimizations,' which applies more aggressive transformations like renaming variables and functions, and dead code elimination. These two modes provide different levels of code size and performance improvements.
Question 16: What is the purpose of using simple mode?
- Does not remove white spaces
- Removes the unwanted words
- Removes the whitespaces (Correct answer)
- None of the above
Correct answer: Removes the whitespaces
The primary purpose of using the 'Simple optimizations' mode in the Google Closure Compiler is to reduce the file size of JavaScript code. This mode achieves its goal by removing unnecessary characters such as whitespace, comments, and line breaks. It makes the code more compact without altering its functionality, leading to faster download times.
Question 17: How efficient is the closure compiler?
- Reduces the speed
- Increase the size of the JavaScript files
- Reduces the size of the JavaScript files (Correct answer)
- Reduce the execution time
Correct answer: Reduces the size of the JavaScript files
The Google Closure Compiler is highly efficient in optimizing JavaScript code for web delivery. Its main purpose is to parse, analyze, and rewrite JavaScript, resulting in significantly smaller file sizes. This reduction in file size directly leads to faster download times and improved overall performance of web applications.
Question 18: One of JavaScript's most important features is which of the following?
- Multi-threaded
- Both Single-threaded and Multi-threaded
- Single-threaded (Correct answer)
- None of the above
Correct answer: Single-threaded
One of JavaScript's most fundamental characteristics is its single-threaded nature, meaning it executes one command at a time in a single sequence. While it can manage asynchronous operations through mechanisms like the event loop and Web Workers, the main execution thread itself remains single-threaded. This design simplifies concurrency management but requires careful handling of long-running tasks.
Question 19: For a new worker, which of the following is a global object?
- Worker
- WorkerScope
- Window
- WokersGlobalScope (Correct answer)
Correct answer: WokersGlobalScope
When a new Web Worker is created in JavaScript, it operates in its own isolated global scope, distinct from the main window's global object. This dedicated global object for worker environments is typically referred to as `WorkerGlobalScope` (or `DedicatedWorkerGlobalScope` for dedicated workers), which is represented by the option 'WokersGlobalScope'. It provides access to worker-specific APIs and properties.
Question 20: To disable only the fopen() and file() functions, which of the following statements should be used?
- function_disable=open, file
- disable_function=fopen(), file()
- disable_function- fopen(), file (Correct answer)
- function_disable-fopen(), file()
Correct answer: disable_function- fopen(), file
The `disable_functions` directive in PHP's `php.ini` file is used to prevent specific functions from being executed for security reasons. To disable multiple functions like `fopen()` and `file()`, their names are listed as a comma-separated string. The option `disable_function- fopen(), file` represents the attempt to specify these functions for disabling, despite a slight deviation from the standard `disable_functions = func1,func2` syntax.
Question 21: What is the meaning of HTML?
- Hyper Text Markup Language (Correct answer)
- Hyper Tag Markup Language
- Hyperlinking Text Marking Language
- Hyperlinks Text Mark Language
Correct answer: Hyper Text Markup Language
HTML is an acronym that stands for HyperText Markup Language. It is the foundational language for creating web pages and web applications. HTML uses a system of tags to structure content, such as headings, paragraphs, images, and links, which are then interpreted and displayed by web browsers.
Question 22: What is the symbol for a tag?
- Commas e.g. ','
- Angle brackets e.g. (Correct answer)
- Exclamation marks e.g. !
- Curved brackets e.g. {,}
Correct answer: Angle brackets e.g.
In HTML, tags are the fundamental components used to define elements and structure content within a web page. These tags are always enclosed within angle brackets, such as `<p>` for a paragraph or `<a>` for a hyperlink. This distinct syntax differentiates HTML tags from regular text content in a document.
Question 23: Which of the following is a real tag keyword?
- Body (Correct answer)
- Header
- Image
- Bold
Correct answer: Body
In HTML, `<body>` is a fundamental and mandatory tag that defines the main content of an HTML document, which is visible to the user. It encapsulates all the content like text, images, links, and other elements that make up the web page. While `<header>`, `<img>`, and `<b>` are also valid HTML tags, `<body>` represents the primary structural keyword for the document's content.
Question 24: What is the correct line break tag?
- "line /"
- "brk /"
- "br /" (Correct answer)
- "bk /"
Correct answer: "br /"
The correct HTML tag for inserting a line break is `<br>`. This is an empty tag, meaning it does not require a closing tag, and it forces the text or content following it to start on a new line. The self-closing format `<br />` is also commonly used for consistency, especially in XHTML.
Question 25: What is the meaning of CSS?
- Creative Style System
- Computing Style Sheet
- Creative Styling Sheet
- Cascading Style Sheet (Correct answer)
Correct answer: Cascading Style Sheet
CSS stands for Cascading Style Sheets. It is a stylesheet language used for describing the presentation of a document written in a markup language like HTML or XML. CSS enables web developers to control the layout, colors, fonts, and other visual aspects of web pages, separating content from presentation.
In HTML 5, which of the following HTML 4 attributes has been removed?