top of page
Writer's pictureRajesh Singh

JavaScript MCQ Questions

Updated: Nov 21

Q1. JavaScript was invented by

  1. W3- Group

  2. Hel Sinki Linux

  3. Brendan Eich

  4. None

Ans: C

Q2. Variable can hold which type of value at a time:-

A.    Multiple

B.     Single

C.     Double

D.    None

Ans: B

Q3. Javascript is a Language -

  1. Programming

  2. Scripting

  3. Hyper Text Markup

  4. None

Ans: B

Q4. The extension of Javascript fill is -

  1. .HTML

  2. .AJS

  3. .JS

  4. HTM

Ans: C

Q5. JS is Ideal to

  1. Make Competition in HTML simpler

  2. the Download time for client

  3. Minimize Storage requirement on the Web Server

  4. None

Ans: C

Q6. Integer variable is declared in JS.

A.    Int num:

B.     Integer num;

C.     Integers nums;

D.    Var num;

Ans: D

Q7. Multiple declaration of variable are separated by

A.    ,

B.     :

C.     *

D.    ;

Ans: A

Q8. Java Script was originally developed under the name

A.    Action Script

B.     Senche()

C.     Cak

D.    Mocha

Ans: D

Q9. Which was the first browser to support JS?

A.    NetScape

B.     IE

C.     Google Chrome

D.    Mozilla Firefox

Ans: A

Q10. Which of the following attributes is used to include external JS code inside html document?

A.    Script

B.     Src

C.     Link

D.    Rel

Ans:B

Q11. JS is designed for following purpose:

A.    To execute query related to database on server

B.     To style html page

C.     To add inter activity to html page

D.    To perform server site scripting language

Ans: C

 

Q12. What is output of the following code?

<script language=”javascript”>function n()

{ document.write(2+5+”8”);

}

</script>

A.    258

B.     78

C.     15

D.    None

Ans: B

Q13. What is the output of following code?

<script>

X=4+”4”;

{

Document.write(X);

}

</script>

A.    44

B.     8

C.     0

D.    None

Ans:A

Q14. Which process is used by checkbox?

A.    Select

B.     Focus

C.     Blur

D.    Click

Ans: D

Q15. Which method of JS that a value of input user and store in a variable?

A.    Alert()

B.     Write()

C.     Prompt()

D.    None

Ans: C

Q16. Which type of JS language is….

A.    Object oriented

B.     Assembly language

C.     High Level Language

D.    Object based

Ans: D

Q17. What is the output of following code?

Var=5,y=1

Var obj={x:10}

With(obj)

{

Alert(y)

}

A.    1

B.     Error

C.     10

D.    5

Ans: A

Q18. Which of the following also known as conditional expression:

A.    Alternative to if else

B.     Switch statement

C.     If then else statement

D.    Immediate if

Ans: D

Q19. In JS what is a block of statement;

A.    Conditional block

B.     Block that combine a number of statement into a single component

C.     Both A & B

D.    Block that content a single statement

Ans: C

Q20. The function and var are known as

A.    Data types

B.     Keywords

C.     Prototype

D.    Declaration statement

Ans: D

Q21. What is the output of following JS code?

Var count=0;

While(count<10)

{

Console.log(count);

Count++i

}

A.    Error in display

B.     An exception is throwing

C.     The value of count variable is loged or store in a particular location on storage

D.    The value of count from ‘0 to 9’ is display in the console.

Ans: C

Q22. The output of following JS code

 

Int x=8;

If(x==9)

{

document.write(9);

}

Else

document.write(x);

 

A.    9

B.     0

C.     8

D.    Undefined

Ans: C

Q23. Write the output of following JS Code?

Var grade=”c”;

Var result

Switch(grade)

{

Case ‘A’:

{

Result+=’10’;

Break;

Case B:

{

Result+=’9’;

Break;

Case C:

{

Result=’8’;

Break;

}

Default:

Result =’0’;

}

document.write(Result);

A.    10

B.     9

C.     8

D.    0

Ans: C

Q24. What is the output of JS code:

Var x=3;

Var y=2;

Var z =0;

If(x==y)

Document.write(x)

Else if (y==x)

Document.write(y)

Else

Document.write(z)

A.    3

B.     Error

C.     1

D.    0

Ans:D

Q25. Which variable takes precedence over the other if the names are same?

A.    The local element

B.     Global variable

C.     Two of Above

D.    None

Ans: A

Q26. Which of the following are the correct ways for calling the JS code:

A.    Preprocessor

B.     RMJ

C.     Triggering ever

D.    Function/method

Ans: D

Q27. Which of the variable is volatile?

A.    Mutable variable

B.     Volatile variable

C.     Immutable volatile

D.    None

Ans: A

Q28. In java script which is not considered as an error?

A.    Syntax error

B.     Missing of semi colons

C.     Division by

D.    Missing of bracket

Ans: C

 

 

 

 

Q29. Which of the following number object function return the value of number?

A.    Two string ()

B.     Value of function

C.     To local string ()

D.    To precession

Ans:B

Q30. In javascript x==y statement provide that

A.    Both are x and y are equal in value only

B.     Both x and y are are equal in value; type and reference

C.     Both are equal in value and data type

D.    Both are not same at old

Ans: C

Q31. What is the output of following java script code?

Var string1=”40”;

Var value unit =50;

Alert(srrint1+int value)

A.    4090

B.     90

C.     4050

D.    5090

Ans: C

Q32IN JS what will be used for calling function definition expression?

A.    Function prototype

B.     Function literal

C.     Function calling

D.    Function decoration

Ans: B

Q33. Which statement suitable to check if the patterns match with the string?

A.    Text(text)

B.     Equals(pattern)

C.     Text(pattern)

D.    Text==pattern

Ans: D

Q34. Architectural pattern of Angular JS is based on

A. MVVM Architectural pattern

B. MVM Architectural pattern

C. MCM Architectural pattern

D. None of Above

Ans: A


Q35. Module created through AngularJS function is called

A. Module()

B. Angular module()

C. mod()

D. None of Above

Ans: B

Q36. Which is perfect for AngularJS

A. Single page Application

B. Multi page Application

C. Both A&B

D. None of Above

Ans: A


 Q37. Which functionality of angular controllers is

A. An angular controller is used for controlling data

B. It id used for displaying data

C. It is used for Analysis data

D. All of Above

Ans: A

Q38. Which directive is used to bind the application data in AngularJS?


A. ng-view directive

B. ng-bn-bind directive

C. ng-bind directive

D. All of Above

Ans: C

Q39. Angular JS is supports which community

A. Google

B. Bing

C. Yahoo

D. All of Above

Ans: A

Q40. Angular JS is

A. It is an open source front end web framework

B. It is not an open source front end web framework

C. It is an open source back end web framework

D. Both A & C

Ans: A

Q41. Angular JS is which type framework

A. Javascript framework

B. W3 CSS framework

C. .Net framework

D. None of Above

Ans: A


Q42. The syntax of create a module in Angular JS is module("app",[]):


Q.43 Which is used to call a javascript code?

A. Function

B. Method

C. Both A & B

D. None of Above

Ans: C

Q44. We used ng-, x- and data-for a prefix for directive.


Q45. The syntax for writing Angular JS expression is {{expression}} and

The syntax for multiple filters in Angular JS is {{expression | filter1 | filter2 |.....}}


Q46. Javascript use which scoping type

A. Lexical

B. Sequential

C. Segmental

D. All of Above

Ans: A (Lexical scoping to resolve the variable names when a function is created inside another function)


Q47. Angular JS is devloped by

A. Misko Hevery

B. Brendan Eich

C. Tim Berners Lee

D. Ray Tomilson

Ans: A


Q48. ng-app directive is used to start an angular JS application.


Q49. AngularJS Directives

ng-app directive initialize an AngularJS application.

ng-init directive initializes appilcation data.

ng-model directive binds the value of HTML controls to application data.

Html contrls like input,select,textarea

Example:

<div ng-app="" ng-init="firstname='CAREER'">


<p>Name: <input type="text" ng-model="firstname"></p>

<p>He write: {{ firstname }}</p>

</div>

What is Angular JS?

Angular JS extends HTML with new attributes with directives and binds data to HTML with expressions and it is perfect for Single page Application (SPAs). It is JavaScript framework and we add simple in HTML page by <script> tag. It is developed by Misko Hevery in 2009 and it support Google community.

We can add angular JS by code

AngularJS Expressions

It is written as {{expression}} and inside a directive it is written as ng-bind="expression".

For example:

{{10+10}} or {{ firsname+""+lastname}}

Angular JS Modules

Angular JS module defines an application and it is a container for application controllers. A module is created by angular.module function. We add controller by ng-controller directive.

AngularJS Directives

ng-app directive initialize an AngularJS application.

ng-init directive initializes appilcation data.

ng-model directive binds the value of HTML controls to application data.

Html contrls like input,select,textarea

 

Angular JS Scope:

It is the binding part among HTML and JavaScript. The scope is available view and controller both. We can pass scope by $scope.

AngularJS Filters

AngularJS provides filters to transform data like currency, date, filter, lowercase, number, order by, uppercase etc.

The syntax for multiple filters in Angular JS is {{expression | filter1 | filter2 |.....}}


JavaScript MCQ Questions Video By Rajesh Sir





 

168 views0 comments

Recent Posts

See All

Files MCQ in Python

File Processing MCQ Q1. Which function writes a list of lines in File? A.      Writelines() B.      Write() C.      Tell() D.      All of...

Python List MCQ Questions

Q1. What is output of below python code? dict= {1:'1', 2:'2', 3:'3'} del dict[1] dict[1] = '10' del dict[2] print (len(dict)) A. 1 B. 2...

Kommentare


bottom of page