How much javascript do you know ?

Quiz will try to ask few question about basic concepts of javascript it was developed as a survey tool to assess average level js knowledge among C.S. students. such information will help us setup starting point for web development courses we are about to write help us by answering this quick survey to spot points of strengths and weaknesses in basic javascript knowledge.

published on June 22, 2017
1/18

what is difference between client side and server side applications ?

client side means that software is related to user interfaces and website
development, while server side are
low level applications that deal mostly with d...
client side are applications that need to be downloaded and installed on user
machine, while server side work
from serve
client side applications are run scripts at user end, while server side run scripts on
webserver to generate a text response that is presented to
another a...
2/18

console.log( {}==={} ) will return ?

true
false
null
3/18

function foo(){
console.log('1');
}
function foo(){
console.log('2');
}
function foo(){
console.log('3');
}

console.log( foo() )

1
2
3
4/18

function a( data ){
if( typeof data === 'object' ) { return data.value; }
}


is above function safe to use to avoid runtime error Cannot read property 'value' of non object ?

yes, its very accepted to validate variable hold object by checking typeof variable
no, typeof cannot be used to validate type of variable
never use such approach !, it will cause runtime errors
5/18

(function(){
var a = b = 3;
})();

console.log(a);
console.log(b);

when you run above code in console what you will get back from a and b ?

both a and b are undefined
both a and b are = 3
a = undefined and b = 3
6/18

var a = { id:1 };
var b = a;
b.id += 1;

following code what is result of b.id vs a.id ?

b.id < a.id
a.id === b.id
b.id > a.id
7/18

var a = { id:1 };
var b = a;
b.id = a.id++;

following code what is result of b.id vs a.id ?

a.id === b.id
a.id < b.id
a.id > b.id
8/18

function a( b ){
this.c = 1;
return this.c + b;
}
var x = a;
var y = new a;
what is typeof x and y ?

typeof x === 1
typeof y === 1
x === 'function'
y === 'object'
x === 'function'
y === NaN (1+undefined)
9/18

NaN === NaN
this will evaluate true or false ?

true
false
10/18

console.log(typeof null) will return ?

boolean
null
"null"
string
object
11/18

false == '0'
false == 0
false == -1

false, true, true
false, false, false
true true false
12/18

var x = 1.1 + 1.3;
var y = 1.1 + 1.2;

console.log(x===2.4);
console.log(y===2.3);

both true
both false
x true and y false
x false and y true
13/18

function start(){
console.log(1);
setTimeout(function(){ .console.log(2) }, 10);
setTimeout(function(){ .console.log(3) }, 0);
console.log(4);
}

what is the console result of start();

1,2,3,4
1,3,4,2
1,4,3,2
14/18

var a = 1 + "1" + 2;
var b = 1 + +"1" +2;
var c = "A" + 1 + 2;
var d = "A" - 1 + 2;

3 , 4, "A3", NAN
112, 112, A12, A-1
112, 4, A12,NaN
15/18

console.log( typeof [1, 2, 3] ) will return ?

Array
string
object
collection
16/18

var arr = [1, 2];

Which of the following functions will not change the value of arr ?

Hint: 2 choices
arr.concat([2])
arr.push(1)
arr.splice(0, 2)
arr.pop()
arr.shift()
17/18

var x = {
y: {
z:{
id:1,
moreinfo : 'z level',
}
moreinfo : 'y level',
},
moreinfo : 'x level',
}

we want to create a new variable x2 and change x2.y.z.id value to 0 without affecting variable x.
which of the following will do this ?

Hint: 2 choices
var x2 = x;
x2.z.id = 0;
var x2 = Object.assign({}, x);
x2.z.id = 0;
var x2 = JSON.parse( JSON.stringify( x ) );
x2.z.id = 0;
var x2 = {y:{ z:{ id:0,...x.y.z },...x.y }, ...x};
18/18

var x = 120;
var y = 012;

x + y = ?

130
132
120012