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, 20173 responses 0

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 databases and server engines
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 application to interpret

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

true
false
null

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

console.log( foo() )

1
2
3

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

(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

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

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

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)

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

true
false

console.log(typeof null) will return ?

boolean
null
"null"
string
object

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

false, true, true
false, false, false
true true false

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

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

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

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

Array
string
object
collection

var arr = [1, 2];

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

Select the two correct answers
arr.concat([2])
arr.push(1)
arr.splice(0, 2)
arr.pop()
arr.shift()

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 ?

Select the two correct answers
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};

var x = 120;
var y = 012;

x + y = ?

130
132
120012