Quiz
js
Create a free account to finish this quiz
Save your progress and see your final score.
Already have an account? Sign in
Questions in this quiz (46)
1Please select all correct variants of connection the external JavaScript file:
- A<link rel="stylesheet" href="script.js">
- B<script src="script.js"></script>
- C<script defer src="script.js"></script>
- D<script></script>
2Select all correct variants of variable declaration:
- Avar t = 'Hello))';
- Blet _c = document.body;
- Cvar 1c = 56;
- Dlet $ = true;
- Elet obj = {};
3Is the statement "JS is a dynamically typed language" true?
- ATrue
- BFalse
4Which data type is better to use to create unique values?
- ANumber
- BBigInt
- CSymbol
- DString
5What statement is correct to create a variable of BigInt type?
- Alet a = 123;
- Blet a = 123n;
- Clet a = '123n';
- Dlet a = BigInt(123);
6What is the result of executing the typeof operator in the below code?
let myVar;
typeof myVar;- Anull
- Bundefined
- C"undefined"
- D"null"
7Choose the right variant for accessing an object property:
- Astudent.name;
- Bstudent->name
- Cstudent[name]
- Dstudent["name"]
8How does the data type in JS affect the variable?
- ADefines a range of valid values
- BDefines a set of operations on a variable
- CAllows to check the type of a variable during the code compilation time
- DSpecifies how a variable is stored in memory
9What is output of the code below?
console.log(null==undefined)- ATrue
- BFalse
10What outputs to the console after executing the code?
let a = "75";
let b = "75a";
console.log(Number(a));
console.log(Number(b));- A75 75
- BNaN NaN
- C75 ReferenceError
- D75 NaN
11What is output to the console of the code execution?
let a=5;
let b=7;
let c=a+++b;
console.log(a,b,c);- A6 7 12
- B5 7 12
- C5 8 13
- D6 7 13
- E6 8 14
12What is output to the console of the code execution?
console.log(!1 && undefined && 'test');- Afalse
- B0
- C-1
- Dtest
- Etrue
13What is the output of this code?
console.log(7 % (4 || !1));- A0
- B1
- C2
- D3
- Etrue
- Ferror
14Select all the expressions that return true
- A!!'false' === !!'true'
- Btrue + true
- C0.2+0.7 == 0.9
- D3 > 2 > 1
- Enull >= 0
- Fnull > 0
- Gtrue=="true"
- H0.2 + 0.6 == 0.8
15Put the result of the operation
+("165"+"1") + 10- A1661
- B"165110"
16Choose the right conditional constructs:
- Aif (a==3) then alert('Hello')
- Bif (a==3) alert ('Hello')
- Cif (a==3) {alert ('Hello')}
17What is output to the console?
var b = 10;
if (b % 3 == 0) {
var i = 10;
}
console.log(i);- AError
- BNumber 10
- CNaN value
- DEmpty string value
- Eundefined value
18Is the "else" element required in the conditional construct?
- AYes
- BNo
- CDepends on JavaScript version
- DDifferent in different browsers
19What is a conditional operator?
- AA construct that executes code multiple times
- BConstruct for creating a specific variable
- CConditional branching
20What is the correct way to use the operator IF in JavaScript?
- Aif i == 2 then
- Bif (i == 2){}
- Cif i = 2 then {}
- Dif i = 2{}
21What is stored in the variable?
var a = 5;
var test = 5 == a ? "Yes" : "No";- A"Yes"
- BNo
- C5
- DYes
- Eundefined
22What is output when executing the following code?
var a = false;
if (a == `0`) {
alert(`==`);
}
if (a === `0`) {
alert(`===`);
}- ANothing
- B===
- C==
- D== and ===
23What is output to the console?
- Aundefined
- B"Hello"
- CSyntaxError
- D"Error"
24What value is output in the console?
- A6
- B9
- C7
- DSyntaxError: Wrong default clause in swich statement
- ESyntaxError: More then one sreak clause in swich statement
- F8
- G12
25What is output of the code below?
alert( null || 2 || undefined );- Anull
- B2
- Cundefined
26What is output of the code below ?
var x = 3;
{
var x = 5;
}
console.log(x);- A3
- B4
- C5
27Choose a condition IF to test the fact that age is between 14 and 90 included:
- Aif (age > 14 && age < 90)
- Bif (age >= 14 && age <= 90)
- Cif (age >= 14 || age <= 90)
28How to describe a loop FOR correctly?
- Afor (i <= 10; i++){}
- Bfor i = 1 to 10 {}
- Cfor (i = 0; i <= 10; i++){}
- Dfor (i = 0; i <= 10){}
29What outputs to the console after executing the code?
for(let i=0; i<10; ) {
i++;
}
console.log(i);- Aundefined
- B9
- C10
- DReferenceError
30Which of these loops doesn't exist?
- Afor(var i = 0; i < 3; i++) {}
- Bfor(var key in object) {}
- Cwhile(true) do{}
- Dwhile(true) {}
- Edo{} while(true)
31What is output to the console of the code execution?
for(var i=0; i<10; ) {
i++;
}
console.log(i);- Aundefined
- B9
- C10
- DReferenceError
32What is a correct description of WHILE loop?
- Awhile i = 1 to 7
- Bwhile (i <= 7; i++){}
- Cwhile (i <= 7){}
33What is the output of this code?
for(let i=0; i<3; i++){
console.log(i);
}- AThe result is an error
- B0 1 2
- C1 2 3
34How many times is the code executed?
for(var i = 10; i < 35; i += 5) {
console.log(i);
}- A5
- B6
- C10
35 Which of the followings is not a correct expression for a loop in JavaScript?
- Avar i = 0;
while (i < 5) {
i++;
} - Bvar i = 0;
while (true) {
i = i;
} - Cvar i = 0;
do {
i++;
} while (i < 5); - Dvar i = 0;
while (i < 5) do {
i++;
}
- Avar i = 0;
36How many times is this loop executed?
for (var i = 0; i > -10; i-=3) {
i++;
}- A0
- B1
- C2
- D5
- E10
37What is the last output value of this code?
var i = 3;
while (i) {
alert( i‐‐ );
}- A1
- B2
- C3
- DInfinite loop
- E0
38What values of i does the while loop output?
var i = 0;
while (i++ < 5) {alert( i );}- A0,1,2,3,4
- B1,2,3,4
- C1,2,3,4,5
- Derror
39When the continue without a label is used, it breaks the current iteration of the while, do-while, and for loops and continues the loop:
- Afrom the beginning of the loop
- Bfrom the next iteration
- Cterminates the loop
40Which of the following is the correct syntax to create a function?
- Afunction foo() {}
- Bfunction foo(a) {}
- Cvar a = function(){}
- Dall of the above
41What type of function can be called before it is declared?
- AFunction declaration
- BFunction expression
- Call of the above
42What is the name of the following function type?
var sum = (a, b) => a + b;- AFunction declaration
- BFunction expression
- CArrow function
43What is output to the console in 2 line?
var f = function printLog() {
console.log('My function');
}
f;- ASyntaxError
- Bnothing
- C'My function'
- Df
44What is output to the console?
function showName(firstName='John', secondName='Doe') {
console.log(firstName, secondName);
}
showName("Robert");- AJohn Doe
- Bnothing
- CRobert Doe
- DRobert
45What is output to the console?
- ANaN
- B7
- C6
- DSyntaxError
46What is output to the console?
function sum(a, b){
a + b;
}
let result = sum(2, 5);
console.log(result);- A7
- Bundefined
- C0
- DRuntime error
Information
- Description
- Quiz on js, created by vernona pit on 28/08/2022.
- Author
- vernona pit
- Language
- English
- Views
- 1
- Rating
- No ratings yet Rate this quiz