NEW
Font size
WorksheetsProgramming Quiz
Total questions: 70
Worksheet time: 35mins
What is programming?
The process of writing precise instructions for the computer to understand and execute.
The process of designing computer hardware.
The process of creating computer networks.
The process of managing computer databases.
What are programming languages described as in the text?
Tools that allow us to write precise instructions for the computer.
Tools that allow us to design computer hardware.
Tools that allow us to create computer networks.
Tools that allow us to manage computer databases.
According to the text, what happens once you learn one programming language?
You will be able to use other languages.
You will be able to design computer hardware.
You will be able to create computer networks.
You will be able to manage computer databases.
What is JavaScript (JS) primarily used for?
To create databases
To make websites interactive
To design graphics
To manage servers
What does ECMAScript define?
How HTML should be structured
How CSS should be styled
How JavaScript should work
How databases should be managed
Which of the following is a JavaScript engine used by Google Chrome and Opera?
SpiderMonkey
Chakra
V8
Rhino
What are the two ways of running JavaScript mentioned in the text?
In the browser and on a server
In the browser and with a runtime outside the browser
On a server and in a database
With a runtime outside the browser and in a database
Which runtime environments are mentioned for running JavaScript outside the browser?
Node and Bun
Node and Deno
Bun and Deno
Node and Rhino
What is one of the main advantages of using JavaScript as a high-level language?
Ease of Implementation
Speed of Execution
Machine Specific
Code Density
Which of the following is NOT a characteristic of high-level languages?
Flexibility
Portability
Machine Specific
Ease of Implementation
What does JavaScript abstract to keep things simple for the programmer?
Underlying layers
User interface
Database connections
Network protocols
What is the main difference between interpreted and compiled languages?
Interpreted languages are executed line-by-line by an interpreter, while compiled languages are transformed into machine code.
Interpreted languages are faster than compiled languages.
Compiled languages are executed line-by-line by an interpreter, while interpreted languages are transformed into machine code.
Interpreted languages do not require an interpreter.
Which of the following is an example of a compiled language?
Python
JavaScript
C
HTML
In the context of programming languages, what does an interpreter do?
Translates source code into machine code all at once.
Executes source code line-by-line.
Converts machine code back into source code.
Compiles source code into an executable file.
What is a good analogy for understanding the difference between interpreted and compiled languages?
Reading a book in Spanish vs. translating the entire book to English.
Driving a car vs. riding a bicycle.
Cooking a meal vs. ordering takeout.
Writing a letter vs. sending an email.
What is the purpose of variables in JavaScript?
To perform mathematical operations
To store information
To create loops
To define functions
Which keyword is used to declare a variable in JavaScript?
let
const
var
int
In the statement `var name = 'James Bond';`, what does the `=` symbol represent?
Comparison operator
Assignment operator
Equality operator
Logical operator
What is the value assigned to the variable `name` in the statement `var name = 'James Bond';`?
var
name
'James Bond'
;
What does the semicolon (`;`) signify in the statement `var name = 'James Bond';`?
Start of the statement
End of the statement
Assignment operator
Variable identifier
What is a data structure?
A way of organizing and storing data so that it can be accessed and modified efficiently
A specific type of data that the computer can store in memory
A programming language
A type of software
Which of the following is used for textual data in JavaScript?
String
Number
Boolean
BigInt
What is the purpose of the 'Number' data type in JavaScript?
Used for both integer and floating-point numbers
Used to represent True or False
Represents nothing
Indicates that a variable has been declared but not assigned to a value
Which data type in JavaScript is used to represent True or False?
Boolean
String
Number
Null
What does the 'Null' data type represent in JavaScript?
Represents nothing, or it's saying that memory location of the value we are trying to access does not exist
Indicates that a variable has been declared but not assigned to a value
Used to store very big numbers
Used for textual data
What does the 'Undefined' data type indicate in JavaScript?
Indicates that a variable has been declared but not assigned to a value
Used to store very big numbers
Used for both integer and floating-point numbers
Used to represent True or False
Which data type in JavaScript is used to store very big numbers?
BigInt
String
Boolean
Null
Which command is used to show data on the screen or to the terminal in JavaScript?
console.show
console.display
console.log
console.print
What will the following code print to the terminal? console.log("Hello, world!");
Hello, world!
Hello, terminal!
Hello, console!
Hello, screen!
In the code snippet 'let msg = "You guys are the best";', what is 'msg'?
A function
A variable
A constant
A method
What will the following code print to the terminal? console.log(msg) if msg is defined as 'let msg = "You guys are the best";'
You guys are the best
Hello, world!
msg
Undefined
What are operators in JavaScript?
Symbols or keywords that perform operations on operands
Functions that return a value
Variables that store data
Methods that manipulate strings
What is an expression in JavaScript?
A valid unit of code that resolves to a value
A function that performs a task
A variable that stores data
A method that manipulates strings
Which of the following is the operator for addition in JavaScript?
+
-
*
/
Which operator is used for exponentiation in JavaScript?
**
++
--
%
What does the modulus operator (%) do in JavaScript?
Returns the remainder of a division
Adds two numbers
Subtracts one number from another
Multiplies two numbers
What are reserved keywords in JavaScript?
Words that can be used as variable names
Words that have special meaning in the language's syntax
Words that are used for comments
Words that are used for styling
Why is it not good to use reserved keywords as variable names in JavaScript?
They make the code run faster
They are part of the language grammar and cannot be used as identifiers
They are easier to remember
They are used for styling
Which of the following is an example of a reserved keyword in JavaScript?
console
document
let
style
What does "Global" mean in the context of JavaScript scopes?
It can be accessed by anything in your code base
It can be accessed within a specific function
It can be accessed as long as you import data from a file
It is essentially local to the block
What does "Local" mean in the context of JavaScript scopes?
It can be accessed by anything in your code base
It can be accessed within a specific function
It can be accessed as long as you import data from a file
It is essentially local to the block
What does "Module Scoped" mean in the context of JavaScript scopes?
It can be accessed by anything in your code base
It can be accessed within a specific function
It can be accessed as long as you import data from a file
It is essentially local to the block
What does "Block Scope" mean in the context of JavaScript scopes?
It can be accessed by anything in your code base
It can be accessed within a specific function
It can be accessed as long as you import data from a file
It is essentially local to the block
Which of the following is an example of a built-in namespace in a programming language?
User-defined functions
Local variables
Math, Arrays, JSON
Temporary files
What is the correct order of namespaces from the most specific to the most general?
Built-in Namespace, Global Namespace, Local Namespace
Local Namespace, Global Namespace, Built-in Namespace
Global Namespace, Local Namespace, Built-in Namespace
Local Namespace, Built-in Namespace, Global Namespace
What are modules in JavaScript?
Units of independent, reusable code that can be organized and imported into other parts of a program.
Bundles of one or more modules and other assets.
A type of JavaScript variable.
A JavaScript function.
What are packages in JavaScript?
Units of independent, reusable code.
Bundles of one or more modules and potentially other assets.
A type of JavaScript variable.
A JavaScript function.
What module system does JavaScript use by default?
ES Module system
Node.js module system
CommonJS module system
AMD module system
How can you change the module system to ES Module system in JavaScript?
By changing the type in the script tag to "module"
By changing the type in the script tag to "commonjs"
By changing the type in the script tag to "node"
By changing the type in the script tag to "amd"
Which of the following is the correct syntax for importing a module in CommonJS?
import { elem } from './module.js';
const elem = require('module');
module.exports = { elem };
export const elem = { };
Which of the following is the correct syntax for exporting a module in ES Modules?
module.exports = { elem };
const elem = require('module');
export const elem = { };
import { elem } from './module.js';
In ES Modules, which keyword is used to import a module?
require
import
module.exports
export
In CommonJS, which keyword is used to export a module?
import
export
module.exports
const
Which of the following is a characteristic of primitive values?
Immutable
Mutable
Stored by Reference
Stored by Pointer
How are primitive values stored?
Stored by Value
Stored by Reference
Stored by Pointer
Stored by Address
What type of values are objects that are stored and manipulated by reference?
Reference Values
Primitive Values
Constant Values
Temporary Values
Which of the following is NOT a characteristic of reference values?
Immutable
Mutable
Stored by Reference
Stored by Pointer
What does it mean when a value is described as "mutable"?
It can be changed after creation.
It cannot be changed once created.
It is stored directly in the variable's location.
It is stored in the stack.
What is the purpose of casting or type conversion in programming?
To convert a variable from one data type to another
To change the value of a variable
To create a new variable
To delete a variable
Given the code snippet: let str = "123"; let num = Number(str); console.log(num);, what will be the output of console.log(num)?
"123"
123
NaN
undefined
Which function is used to convert a string to a number in JavaScript?
parseInt()
toString()
Number()
String()
What do control structures in JavaScript allow you to manage?
The flow of execution of your code
The styling of your web page
The storage of data in your database
The speed of your internet connection
Which of the following is NOT included in control structures in JavaScript?
Conditional statements
Loops
Jump statements
Variable declarations
In JavaScript, what can we use to determine what piece of code runs given a certain condition is true?
For loops
If statements
While loops
Switch statements
What is the primary concept of control flow in programming as mentioned in the document?
Functions and Variables
If conditions and Loops
Arrays and Objects
Classes and Methods
In the provided JavaScript code snippet, what will be logged to the console if x is 10?
x is less than 5
x is equal to 5
x is greater than 5
x is undefined
What is the purpose of a switch statement in programming?
To execute a block of code based on a specific condition
To iterate over a collection of items
To declare variables
To handle exceptions
In the provided switch statement, what will be the output if the value of 'day' is 3?
Monday
Tuesday
Wednesday
Invalid day
What keyword is used to exit a case in a switch statement?
exit
stop
break
end
What will be the output of the switch statement if the value of 'day' is not 1, 2, or 3?
Monday
Tuesday
Wednesday
Invalid day
