Javascript Multichoice Basic Flashcards

1
Q
function aaa() { return {test: 1}} alert(typeof aaa()); 
What does the above alert return
A

undefined

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

(true + false) > 2 + true;

What is the result

A

false

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q
function bar() {
 return foo;
foo = 10;
function foo() {}
var foo = '11';
}
alert(typeof bar());

what is alerted?

A

function

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Q 1 - Which of the following is correct about JavaScript?

A - JavaScript is a lightweight, interpreted programming language.

B - JavaScript has object-oriented capabilities that allows you to build interactivity into otherwise static HTML pages.

C - The general-purpose core of the language has been embedded in Netscape, Internet Explorer, and other web browsers.

D - All of the above.

A

D

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Q 2 - Which of the following is correct about features of JavaScript?

A - JavaScript is a lightweight, interpreted programming language.

B - JavaScript is designed for creating network-centric applications.

C - JavaScript is complementary to and integrated with Java.

D - All of the above.

A

D

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Q 4 - Which of the following is an advantage of using JavaScript?

A - Less server interaction

B - Immediate feedback to the visitors

C - Increased interactivity

D - All of the above.

A

D

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Q 5 - Which of the following is a disadvantage of using JavaScript?

A - Client-side JavaScript does not allow the reading or writing of files.

B - JavaScript can not be used for Networking applications because there is no such support available.

C - JavaScript doesn’t have any multithreading or multiprocess capabilities.

D - All of the above.

A

C

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

*Q 6 - Is JavaScript a case-sensitive language?

A - true

B - false

A

A

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Q 7 - Which of the following is true about variable naming conventions in JavaScript?

A - You should not use any of the JavaScript reserved keyword as variable name.

B - JavaScript variable names should not start with a numeral (0-9).

C - Both of the above.

D - None of the above.

A

C

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Q 8 - Which of the following is true about variable naming conventions in JavaScript?

A - JavaScript variable names must begin with a letter or the underscore character.

B - JavaScript variable names are case sensitive.

C - Both of the above.

D - None of the above.

A

C

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Q 9 - Which of the following is true about typeof operator in JavaScript?

A - The typeof is a unary operator that is placed before its single operand, which can be of any type.

B - Its value is a string indicating the data type of the operand.

C - Both of the above.

D - None of the above.

A

C

Unary: In computer programming, a unary operator is an operator that takes only one value for its operation. An example in the C programming language is the increment operator (++), which increments a given value by 1.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Q 10 - Can you access Cookie using javascript?

A - true

B - false

A

A

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Q 11 - Which of the following is true about cookie handling in JavaScript?

A - JavaScript can manipulate cookies using the cookie property of the Document object.

B - JavaScript can read, create, modify, and delete the cookie or cookies that apply to the current web page.

C - Both of the above.

D - None of the above.

A

C

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Q 12 - Which of the following is the correct syntax to create a cookie using JavaScript?

A - document.cookie = ‘key1 = value1; key2 = value2; expires = date’;

B - browser.cookie = ‘key1 = value1; key2 = value2; expires = date’;

C - window.cookie = ‘key1 = value1; key2 = value2; expires = date’;

D - navigator.cookie = ‘key1 = value1; key2 = value2; expires = date’;

A

A

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Q 13 - Which of the following is the correct syntax to redirect a url using JavaScript?

A - document.location=’http://www.newlocation.com’;

B - browser.location=’http://www.newlocation.com’;

C - navigator.location=’http://www.newlocation.com’;

D - window.location=’http://www.newlocation.com’;

A

C

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

*Q 14 - Which of the following is the correct syntax to print a page using JavaScript?

A - window.print();

B - browser.print();

C - navigator.print();

D - document.print();

A

A

17
Q

*Q 15 - Which of the following is a valid type of function javascript supports?

A - named function

B - anonymous function

C - Both of the above.

D - None of the above.

A

A

18
Q

*Q 16 - Can you assign a anonymous function to a variable?

A - true

B - false

A

A

19
Q

Q 18 - How can you get the type of arguments passed to a function?

A - using typeof operator

B - using getType function

C - Both of the above.

D - None of the above.

A

A

20
Q

Q 19 - How can you get the total number of arguments passed to a function?

A - Using args.length property

B - Using arguments.length property

C - Both of the above.

D - None of the above.

A

B

21
Q

Q 20 - Which of the following type of variable is visible everywhere in your JavaScript code?

A - global variable

B - local variable

C - Both of the above.

D - None of the above.

A

A

22
Q

Q 21 - Which of the following type of variable is visible only within a function where it is defined?

A - global variable

B - local variable

C - Both of the above.

D - None of the above.

A

B

23
Q

Q 22 - Which of the following type of variable takes precedence over other if names are same?

A - global variable

B - local variable

C - Both of the above.

D - None of the above.

A

B

24
Q

Q 23 - Which of the following is correct about callbacks?

A - A callback is a plain JavaScript function passed to some method as an argument or option.

B - Some callbacks are just events, called to give the user a chance to react when a certain state is triggered.

C - Both of the above.

D - None of the above.

A

C

25
Q

Q 24 - Which built-in method returns the character at the specified index?

A - characterAt()

B - getCharAt()

C - charAt()

D - None of the above.

A

C

26
Q

Q 25 - Which built-in method combines the text of two strings and returns a new string?

A - append()

B - concat()

C - attach()

D - None of the above.

A

B

27
Q

Q 3 - Which of the following is correct about features of JavaScript?

A - JavaScript is is complementary to and integrated with HTML.

B - JavaScript is open and cross-platform.

C - Both of the above.

D - All of the above.

A

C