HTML INTERVIEW QUESTION
Which of the following tags do not required a terminator?
- <u>
- <br>
- <b>
- None of the above
What do we use to get ordered list?
- <h1>
- <ul>
- <ol>
- None of the above
Ans. <ol>
Which one of the following tags is used to insert graphics in the webpage
- <image>
- <images>
- <img>
- <graphics>
Ans. <img>
Which HTML tag is used to display the content as moving text?
- <marquee>
- </img>
- <a href>
- None of the above
Ans. <marquee>
What should HTML comments be enclosed in?
- <!-and->
- <! And !>
- <!—and—“”
- None of the above
Ans. <!-and->
What is the extension of HTML document?
- .htx or .html
- .html or .html
- .hmt or .hmtl
- .htm or .html
Ans. .htm or .html
Which of the following is true?
- BR tag is used to have a blank line.
- In tables, the header cell is centered by default and the data cells are right-aligned.
- The <TR> is used to create a data cell.
- None of the statements are true
Ans. None of the statements are true
Which tag provides visual division between sections of a page and causes the browser to draw a raised line?
- <HL>
- <HR>
- <UR>
- None of the above
Ans. <HR>
What does JPEG mean?
- Joint photographics embedded group
- Joint photographics extended group
- Joint photographic experts group
- None of the above
Ans. Joint Photographic Experts Group
What does TIFF stand for?
- Tagged image file format
- Textual images file format
- Tagged image font file
- None of the above
Ans. Tagged image file format
What can we use for abbreviations in HTML?
- <abbr> </abbr>
- <acronym> </acronym>
- Both of the above
- None of the above
Ans. <abbr> </abbr>
What is the purpose of a DNS server?
- To translate the domain name of another computer into IP address only
- To translate the domain name of another computer into IP address and vice versa on request
- To translate the IP address to the domain name
- None of the above
Ans. To translate the IP address to the domain name
CSS INTERVIEW QUESTION
What is CSS?
CSS stands for Cascading Style Sheets. It is used to style and layout web pages, including design elements such as color, font, and spacing.
What are the different types of CSS?
There are three types of CSS:
- Inline CSS
- Internal CSS
- External CSS
What is the difference between class and id selectors in CSS?
id
is used to target a unique element, and it must be unique within a page.class
can be reused multiple times in different elements.
What is the CSS box model?
The CSS box model defines rectangular boxes generated for elements in the document tree. These are: content
, padding
, border
, and margin
How do you include a CSS file in an HTML document?
You can include a CSS file using the <link>
tag inside the <head> section
What is the z-index in CSS?
The z-index
property specifies the stack order of the elements. Elements with higher z-index
are displayed in front of elements with a lower z-index
.
What is the difference between absolute, relative, fixed, and sticky positioning?
absolute
: Positioned relative to the nearest ancestor.relative
: Positioned relative to its normal position.fixed
: Positioned relative to the browser window.sticky
: Acts likerelative
until a defined scroll point, then behaves likefixed
.
What are pseudo-classes in CSS?
Pseudo-classes define a special state of an element. Examples include :hover
, :focus
, :active
, :nth-child()
, etc.
What are media queries in CSS?
Media queries are used to apply different styles based on conditions such as screen width, device type, or orientation. Example:
@media (max-width: 600px) {
body {
background-color: lightblue;
}
}
What is the difference between display: none and visibility: hidden?
display: none
: The element is removed from the document flow, and it takes up no space.visibility: hidden
: The element is still in the document flow, but it is invisible.
What is Flexbox in CSS?
Flexbox is a layout model in CSS that allows you to more easily create complex layouts by distributing space along rows or columns.
What is CSS Grid, and how is it different from Flexbox?
CSS Grid is a two-dimensional layout system that allows creating complex layouts using rows and columns. Unlike Flexbox, which is one-dimensional (either row or column), Grid can handle both dimensions at the same time.
How can you center a block element horizontally and vertically?
- For horizontal centering:
margin: 0 auto;
- For vertical centering: Use Flexbox or Grid or apply
position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
What are ::before and ::after pseudo-elements?
::before
and ::after
are used to insert content before or after an element’s content. They are commonly used to add icons, quotes, or other visual elements.
Explain the position: sticky; property.
position: sticky;
allows an element to “stick” to a defined location as the user scrolls next to it. This is useful for creating sticky headers or navigation bars.
What are the differences between inline, inline-block, and block elements?
block
: Elements that take up the entire width and start on a new line.inline
: Elements that take up only as much width as necessary and do not start on a new line.inline-block
: Elements that behave like inline elements but allow block-level styling.
What is the purpose of the !important declaration in CSS?
The !important
rule is used to give a CSS rule higher priority than other conflicting rules. This is generally avoided as it may cause maintenance problems.
What is the difference between em, rem, px, and % in CSS?
em
: Related to the font-size of its parent element.rem
: Related to the font-size of the parent element (<html>
).px
: Absolute units, fixed in size.%
: Relative to the parent element’s size.
Explain the calc() function in CSS.
The calc()
function is used to perform calculations to set CSS property values, such as width: calc(100% - 20px)
.
What are CSS Animations and How Do You Create Them?
CSS animations allow smooth changes of styles over time. You create them using the @keyframes
rule and apply the animation with the animation
property.
JAVASCRIPT INTERVIEW QUESTION
What is JavaScript?
JavaScript is a high-level, interpreted programming language used to create dynamic and interactive web content.
What are the data types supported by JavaScript?
JavaScript supports the following data types:
- Primitive:
string
,number
,boolean
,null
,undefined
,symbol
,bigint
- Non-Primitive:
object
What is the difference between var, let, and const?
var
: Scope can be re-declared and hoisted.let
: Block-scoped, can’t be re-declared, can’t be hoisted.const
: Block-scoped, immutable, not hoisted.
What is the difference between == and ===?
==
: Compares values after type conversion (loose equality).===
: Compares values without type conversion (strict equality).
What is the purpose of the isNaN() function?
The isNaN()
function checks whether a value is NaN
(Not-a-Number).
What is the difference between null and undefined?
null
: Represents the intentional absence of a value.undefined
: Represents a variable that has been declared but not assigned a value.
Explain hoisting in JavaScript.
Hoisting is JavaScript’s behavior of moving declarations (var
, function
) to the top of their scope during compilation.
What are JavaScript closures?
A closure is a function that has access to its outer function’s variables even after the outer function has executed.
What is the difference between function declarations and function expressions?
- Function Declaration: Defined with the
function
keyword and hoisted. - Function Expression: Assigned to a variable and not hoisted.
What are JavaScript promises?
Promises are used to handle asynchronous operations. They can be in one of three states: pending
, fulfilled
, or rejected
.
What is the difference between call(), apply(), and bind()?
call()
: Invokes a function with a specifiedthis
context and arguments.apply()
: Similar tocall()
, but takes arguments as an array.bind()
: Returns a new function with the specifiedthis
context.
What is the event loop in JavaScript?
The event loop is a mechanism that ensures non-blocking execution by handling asynchronous operations and executing callbacks.
What are higher-order functions?
A higher-order function is a function that takes another function as an argument or returns a function.
What is the difference between map(), filter(), and reduce()?
map()
: Creates a new array by applying a function to each element.filter()
: Creates a new array with elements that pass a condition.reduce()
: Reduces an array to a single value by applying a function.
Explain the this keyword in JavaScript.
The value of this
depends on how a function is called:
- In a method,
this
refers to the object. - In a regular function,
this
refers to the global object (window
in browsers).
What is the difference between synchronous and asynchronous JavaScript?
- Synchronous: Executes code sequentially, blocking further execution.
- Asynchronous: Executes code without blocking, using callbacks, promises, or
async/await
.
What is the purpose of async and await in JavaScript?
async
functions return promises. await
pauses execution until the promise is resolved.
What is destructuring in JavaScript?
Destructuring is a syntax for extracting values from arrays or objects:
const {name, age} = person;
const [first, second] = array;
What are template literals in JavaScript?
Templates allow to embed variables and expressions using literal backticks () and ${}` syntax:
const greeting = `Hello, ${name}!`;
What is the difference between undefined and not defined in JavaScript?
undefined
: A variable is declared but not assigned a value.not defined
: A variable is not declared in the program.
What is the prototype in JavaScript?
Prototype
is an object associated with every function and object, which is used for inheritance.
What is the difference between setTimeout and setInterval?
setTimeout
: Executes a function after a delay.setInterval
: Executes a function repeatedly at a specified interval.