Instructions

  • 1. Your final score will reflect your grasp of the concepts—approach each question with precision.
  • 2. Thoroughly review each solution before proceeding to ensure full understanding.
  • 3. Final results will be available after submission to provide insights into areas for further improvement.
  • 4. Maintain academic integrity—plagiarism undermines learning and professional growth.
  • 5. Once submitted, responses are final, so ensure you’re confident in your answers.
  • 6. These challenges are designed to test practical knowledge; apply your skills as you would in real-world scenarios.

All Problems

Question

Action

What is the purpose of ES6 modules?

View

How do you export a function from a module in ES6?

View

How do you import a default export from a module?

View

Which of the following is true about named exports?

View

Can you have both default and named exports in the same module?

View

How do you import all exports from a module as a single object?

View

What is the result of this code: export default function greet() { console.log("Hello!"); } import greet from './module'; greet();?

View

Which syntax is used to re-export something from a module?

View

What does a default export allow?

View

What happens if you import something not exported in the module?

View

What is the purpose of ES6 modules?

To merge JavaScript files into one file
To structure JavaScript code into reusable pieces
To convert JavaScript code to another language
To simplify object creation

How do you export a function from a module in ES6?

module.exports myFunction
export function myFunction() {}
export default myFunction()
exports = myFunction()

How do you import a default export from a module?

import { myFunction } from './module';
import * as myFunction from './module';
import myFunction from './module';
import default myFunction from './module';

Which of the following is true about named exports?

A module can only have one named export
Named exports must be imported using curly braces
Named exports can only export variables
Named exports do not need to be imported

Can you have both default and named exports in the same module?

Yes, a module can have both
No, only one type of export is allowed per module
Yes, but only if they are functions
No, default exports cannot coexist with named exports

How do you import all exports from a module as a single object?

import all from './module';
import * as Module from './module';
import { * } from './module';
import allModule from './module';

What is the result of this code: export default function greet() { console.log("Hello!"); } import greet from './module'; greet();?

greet is not a function
Hello!
Syntax error
Module not found

Which syntax is used to re-export something from a module?

export * from './another-module';
export default from './another-module';
export all from './another-module';
module.exports from './another-module';

What does a default export allow?

Exporting multiple variables from a module
Exporting exactly one thing from a module
Importing without specifying a name
Both b and c

What happens if you import something not exported in the module?

It throws a syntax error
It throws a runtime error
It imports undefined
It imports null