• ¿Documento equivocado? Cámbialo gratis
  • Escrito por estudiantes que aprobaron
  • Inmediatamente disponible después del pago
  • Leer en línea o como PDF
Vender
¿Dónde estudias?
Tu idioma
Document preview thumbnail
Vista previa 3 fuera de 16 páginas
Otro

100 JavaScript Questions and Answers for Exam Preparation

Document preview thumbnail
Vista previa 3 fuera de 16 páginas

This document contains 100 carefully curated JavaScript questions and answers, covering both theoretical and practical aspects of JavaScript. It includes multiple-choice questions (MCQs), conceptual questions, and practical coding exercises, making it ideal for exam preparation, coding interviews, and self-study. Topics covered: JavaScript Basics Functions and Scope Arrays and Objects ES6+ Features DOM Manipulation Asynchronous JavaScript (Promises, Async/Await) Debugging and Error Handling JavaScript Algorithms Each question is designed to enhance your JavaScript skills, ensuring a deep understanding of core concepts.

Vista previa del contenido

100 JavaScript Questions & Answers
1. JavaScript Basics
1. What is JavaScript?
o JavaScript is a high-level, interpreted programming language used to
create dynamic web pages. It enables interactivity, such as form
validation, animations, and API calls.
2. How is JavaScript different from Java?
o Java is a compiled, statically-typed language, while JavaScript is
interpreted and dynamically-typed.
o Java is mainly used for backend applications, whereas JavaScript is
mostly used for web development.
3. What are the different ways to declare a variable in JavaScript?
o var (function-scoped)
o let (block-scoped)
o const (block-scoped and immutable)
4. What is the difference between == and === in JavaScript?
o == checks for value equality with type coercion.
o === checks for both value and type equality.
5. What are the different data types in JavaScript?
o Primitive Types: String, Number, Boolean, Undefined, Null, Symbol,
BigInt.
o Reference Types: Objects, Arrays, Functions.




2. Functions & Scope
6. What is a function in JavaScript?
o A function is a block of reusable code that performs a specific task.
7. What are the different types of functions in JavaScript?
o Named Functions: function greet() {}
o Anonymous Functions: const greet = function() {}
o Arrow Functions: const greet = () => {}

, 8. What is the difference between function declaration and function
expression?
o Function Declaration: Defined using function keyword and can be
hoisted.
o Function Expression: Stored in a variable and cannot be hoisted.
9. What is closure in JavaScript?
o A function that remembers variables from its outer scope even after
the outer function has finished executing.
10.What is the difference between global and local scope?

 Global Scope: Variables declared outside any function are accessible
everywhere.
 Local Scope: Variables declared inside a function are accessible only within
that function.



3. Objects & Prototypes
11.What is an object in JavaScript?
o An object is a collection of key-value pairs used to store and manage
data.
12.How do you create an object in JavaScript?
o Using object literals: const obj = { key: 'value' };
o Using the new Object() syntax: const obj = new Object();
13.What is a prototype in JavaScript?
o A prototype is an object from which other objects inherit properties
and methods.
14.What is the difference between prototypal and classical inheritance?
o Classical Inheritance (like Java) uses classes to create objects.
o Prototypal Inheritance (JavaScript) allows objects to inherit directly
from other objects.
15.How do you add a method to a prototype?
o MyObject.prototype.myMethod = function() { return 'Hello'; }

, 4. Asynchronous JavaScript
16.What is asynchronous programming in JavaScript?
o A method of execution that allows the program to continue running
while waiting for operations to complete.
17.What is the difference between synchronous and asynchronous code?
o Synchronous: Executes line by line, waiting for each task to
complete.
o Asynchronous: Allows multiple tasks to run simultaneously.
18.What are callbacks in JavaScript?
o A function passed as an argument to another function that is
executed later.
19.What are Promises in JavaScript?
o Objects that represent the eventual completion (or failure) of an
asynchronous operation.
20.What is async and await in JavaScript?
o async makes a function return a promise.
o await waits for a promise to resolve before continuing execution.




5. ES6+ Features
21.What are some new features introduced in ES6?
o let and const
o Arrow Functions
o Template Literals
o Destructuring Assignment
o Default Parameters
22.What is the spread operator (...) in JavaScript?
o Used to spread elements of an array or object into a new array or
object.
23.What is destructuring in JavaScript?
o A syntax that allows you to unpack values from arrays or properties
from objects into distinct variables.
24.What are template literals in JavaScript?

Información del documento

Subido en
10 de febrero de 2025
Número de páginas
16
Escrito en
2024/2025
Tipo
Otro
Personaje
Desconocido
$7.29

¿Documento equivocado? Cámbialo gratis Dentro de los 14 días posteriores a la compra y antes de descargarlo, puedes elegir otro documento. Puedes gastar el importe de nuevo.
Escrito por estudiantes que aprobaron
Inmediatamente disponible después del pago
Leer en línea o como PDF

Vendido
0
Seguidores
0
Artículos
252
Última venta
-




Por qué los estudiantes eligen Stuvia

Creado por compañeros estudiantes, verificado por reseñas

Calidad en la que puedes confiar: escrito por estudiantes que aprobaron y evaluado por otros que han usado estos resúmenes.

¿No estás satisfecho? Elige otro documento

¡No te preocupes! Puedes elegir directamente otro documento que se ajuste mejor a lo que buscas.

Paga como quieras, empieza a estudiar al instante

Sin suscripción, sin compromisos. Paga como estés acostumbrado con tarjeta de crédito y descarga tu documento PDF inmediatamente.

Student with book image

“Comprado, descargado y aprobado. Así de fácil puede ser.”

Alisha Student

Preguntas frecuentes