Subscribe Facebook Twitter Google Plus Stumble upon

Top 20 Multiple Choice Questions on JavaScript Arrays

Here you will get collections of multiple choice question on JavaScript Arrays includes MCQ on adding and deleting array elements. It also includes different ways of iterating arrays for both dense and sparse arrays along with testing elements in order to execute null, undefined and non existent elements. MCQ on different array iteration methods and ECMAScript 5 array methods in JavaScript also included here.

1. A ...................... array is one in which the elements not have contiguous indexes starting at 0.
A) special
B) sparse
C) heterogeneous
D) dense

2. If the array is .................., the value of the length property is greater than  the number of elements.
A) special
B) sparse
C) heterogeneous
D) dense

3. The length property specifies the number of elements in the ................. array in JavaScript.
A) special
B) sparse
C) heterogeneous
D) dense

4. If an array with five elements a=[1,2,3,4,5]; what will do the expression a.length=0
A) checks length of array is 0 or not
B) deletes all elements
C) replaces all elements with 0
D) adds 0 at the beginning

5. In ECMAScript 5, allows you to make the length property of an array read only with .............
A) Object.defineProperty()
B) Object.readonlyProperty()
C) JavaScript.defineProperty()
D) JavaScript.readonlyProperty()

6. Which of the following is the correct expression to make length property of an array read only.
A) Object.defineProperty(a, "length", {readonly:true});
B) Object.defineProperty(a, "length", {writable:false});
C) Object.defineProperty(a, {length:writable}); 
D) Object.defineProperty(a, "length", {readwrite:false});

7. Which of the following method can't be used to add array elements in JavaScript.
A) push( )
B) shift( )
C) splice( )
D) All are can be used

8. Which of he following methods can be used to delete array elements in JavaScript array.
i) delete   ii) shift( )   iii) splice( )  iv) pop( )
A) i, ii and iii only
B) ii, iii and iv only
C) i, iii and iv only
D) All i, ii, iii and iv only

9. While iterating elements of an array a, ...................... will  test the array elements in order to skip null, undefined and non existent elements.
A) !a[i]
B) a[i]= = = undefined
C) !(i in a)
D) !a.hasOwnProperty(i)

10. While iterating the elements of an array a, what will do the following expression
for(var i=0; i<a.length; i++) {
if(a[i]= = = undefined) continue; // loop body
}
A) Skip null, undefined and non existent elements
B) Skip non existent elements
C) Skip undefined and non existent elements
D) Skip inherited properties

Read More »

Top 30 Multiple Choice Questions On JavaScript Object

This set of multiple choice question on JavaScript object includes MCQ on JavaScript property attributes, object attributes and categories of JavaScript objects. It also includes MCQ and interview questions on object literals, prototypes, inheritance along with deleting properties, testing properties and enumerating properties of JavaScript.

1. An object is an un-ordered collection of ..........................., each of which has a name and a value.
A) properties
B) names
C) values
D) All of the above

2. The ........................... attribute of an object specifies whether the value of the property can be set.
A) readable
B) writable
C) enumerable
D) configurable

3. The ..................... attribute of an object specifies whether the property name is returned by a for/in loop.
A) readable
B) writable
C) enumerable
D) configurable

4. The .......................... attribute of an object specifies whether the property can be deleted and whether its attributes can be altered.
A) readable
B) writable
C) enumerable
D) configurable

5. An object's ............................. is a reference to another object from which properties are inherited.
A) Characteristics
B) Prototype
C) Class
D) Extensible flag

6. An object's ........................ is a string that categorizes the type of an object.
A) Characteristics
B) Prototype
C) Class
D) Extensible flag

7. An object's ............................ specifies whether new properties may be added to the object.
A) Characteristics
B) Prototype
C) Class
D) Extensible flag

8. A ........................... is an object or class or objects defined by the ECMAScript specification which includes arrays, functions, dates and regular expressions.
A) native object
B) host object
C) user defined object
D) remote object

9. A ......................... object is any object created by the execution of JavaScript code.
A) native 
B) host
C) user defined
D) remote

10. JavaScript objects can be created with the new keyword, and with the ................... function.
A) object()
B) object.create()
C) JavaScript.object()
D) create.object()

11. An ........................... is a comma separated list of colon separated name: value paris, enclosed within curly braces.
A) object prototype
B) object literal
C) object class
D) associative arrays

12. An ............................ is an expression that creates and initializes a new and distinct object each time it is evaluated.
A) object prototype
B) object literal
C) object class
D) associative arrays

13. The ........................ returns true only if the named property is an own property and its enumerable attribute is true.
A) hasOwnProperty()
B) propertyIsEnumerable()
C) getOwnProperty()
D) IsPropertyOf()

14. Properties defined by getters and setters are sometimes known as ................. to distinguish them from data properties that have a simple value.
A) accessor properties
B) getters properties
C) setters properties
D) getter and setters properties

15. The ....................... attribute of property descriptor object governs attempts to change the other attributes and also specifies whether the property can be deleted.
A) writable
B) configurable
C) enumerable
D) value

Read More »

Top 20 MCQ On JavaScript Expressions And Operators

This set of multiple choice question on JavaScript expression and operators includes MCQ on JavaScript equality, inequality and comparison operators. It also includes about logical, assignment and evaluation expressions along with different types of operators; conditional, typeof, delete, void and comma used in JavaScript.

1. The ................ operator is known as the equality operator, which checks whether its two operators are "equal" using a more relaxed definition of sameness that allows type conversion.
A) =
B) = =
C) = = =
D) All of the above

2. The ......................... operator is known as strict equality operator, and it checks whether two operands are "identical" using a strict definition of sameness.
A) =
B) = =
C) = = =
D) All of the above

3. The ...................... returns false if two values are equal to each other according to = = and returns true otherwise.
A) !=
B) !
C) != =
D) All of the above

4. The ................. operator returns false if two values are strictly equal to each other and returns true otherwise.
A) !=
B) !
C) != =
D) All of the above

5. If the two values do not have the same type; the .................... operator may still consider them equal.
A) = =
B) = = =
C) Both A and B
D) None of the above

6. State whether the following statements are True or False for equality operator(= =).
i) If one value is null and the other is undefined, they are equal.
ii) If one value is number and the other is a string, convert the string to a number and try to comparison again, using converted value.
A) True, False
B) True, True
C) False, True
D) False, False

7. State whether the following statements are True or False for strict equality operator(= = =).
i) If the two values have different types they are equal.
ii) If both values are null or both values are undefined, they are equal.
iii) If  both of the Boolean value are True or both of the Boolean value are False, they are equal.
A) i-True, ii-False, iii-True
B) i-False, ii-True, iii-True
C) i-True, ii-False, iii-False
D) i-False, ii-True, iii-False

8. The .................... operator evaluates to True if its first operand is less than its second operand; otherwise it evaluates to False.
A) <
B) >
C) <=
D) >=

9. The ................... operator evaluates to True if its first operand is greater than or equal to its second operand; otherwise it evaluates to  False.
A) <
B) >
C) <=
D) >=

10. While using comparison operators, if after object to primitive conversion, at least one operand is not a string, both operands are converted to ..................
A) String
B) Boolean
C) Number
D) Object

Read More »

MCQ On JavaScript Types, Values And Variables Part-2

This set of multiple choice question on JavaScript types, value and variables includes MCQ on JavaScript type conversions, explicit conversion and object to primitive conversions used in JavaScript. It also includes about the difference between primitive values and mutable object reference and equality in JavaScript.

1. Any value other than ..................... has a tostring( ) method and the result of this method is usually the same as that returned by the string( ) function.
i) number     ii) null    iii) boolean   iv) undefined
A) i and ii only
B) ii and iii only
C) ii and iv only
D) iii and v only

2. If one operand of the + operator is a string, it converts the other one to a ...........
A) String
B) TypeError
C) Undefined
D) Number

3. The .................. operator converts its operand to a Boolean and negates it.
A) +
B) -
C) !
D) !!

4. The .................. method defined by the number class accepts an optional argument that specifies a radix, or base for the conversion.
A) toRadix( )
B) toBase( )
C) toString( )
D) toBase10( )

5. ................... converts a number to a string with a specified number of digits after the decimal point.
A) toInt( )
B) toFixed( )
C) toString( )
D) toPrecision( )

6. ............... converts a number to a string with the number of significant digits you specify.
A) toInt( )
B) toFixed( )
C) toString( )
D) toPrecision( )

7. .................. accepts an optional second argument specifying the radix of the number to be parsed.
A) ParseFloat( )
B) ParseInt( )
C) ParseNumber( )
D) ParseString( )

8. While using parseInt( ) and parseFloat( ), if the first nonspace character is not a part of a valid numeric literal, they return .............
A) undefined
B) infinity
C) NaN
D) zero

9. The global function parseInt("11",2) in JavaScript returns which of the following values.
A) 2
B) 3
C) 11
D) 13

10. The global function parseFloat(".1") returns which of the following values.
A) 1
B) 0.1
C) 0
D) NaN

Read More »

MCQ On JavaScript Types, Values And Variables Part-1

This set of multiple choice question on JavaScript types, value and variables includes MCQ on number, text or strings, Boolean, null and undefined values along with global and wrapper objects used in JavaScript. It also includes about the difference between primitive values and mutable object reference, type conversions and equality in JavaScript.

1. The kind of values that can be represented and manipulated in a programming language are known as ..............
A) Types
B) Variables
C) Symbols
D) Constants

2. A ..................... defines a symbolic name for a value and allows the value to be referred to by name.
A) Types
B) Variables
C) Symbols
D) Constants

3. JavaScript's ................... types include numbers, strings or text and Boolean truth values.
A) standard
B) variable
C) object
D) primitive

4. The special JavaScript values null and undefined are ................ values, but they are not numbers, strings or booleans.
A) standard
B) variable
C) object
D) primitive

5. In JavaScript ................... are the only values that methods cannot be invoked on.
i) numbers   ii) strings   iii) null   iv) booleans  v) undefined
A) i and ii only
B) ii and iii only
C) iii and iv only
D) iii and v only

6. In which of the following JavaScript type, a JavaScript program can change  the values of object properties.
A) Numbers
B) Booleans
C) Objects
D) Null

7. State whether the following statements about JavaScript types are True or False
i) JavaScript variables are untyped
ii) Numbers, Boolean and null and undefined are immutable
A) i-True, ii-True
B) i-True, ii-False
C) i-False, ii-True
D) i-False, ii-False

8. .................... in JavaScript returns infinity or negative infinity.
A) Division by zero
B) Zero divided by zero
C) Division by infinity
D) Infinity divided by infinity

9. ................ does not return any well defined value, and the result of operation in the special not a number value which is printed as NaN.
i) Division by zero ii) Zero divided by zero iii) Division by infinity  iv) Infinity divided by infinity
A) i and ii only
B) ii and iii only
C) ii and iv only
D) i and iv only

10. JavaScript predefined global variables ................ to hold the positive infinity and not a number value.
i) infinity    ii) zero   iii) NaN   iv) Number
A) i and ii only
B) ii and iii only
C) ii and iv only
D) i and iii only

Read More »

MCQ Questions On Windows Forms In VB.Net Part-2

This set of multiple choice questions on windows forms in visual basic .net includes MCQ on windows form controls such as text boxes, rich text boxes, labels and link labels along with their public properties, methods and events. 

1. In mouse cursor option ................... is a cursor for mouse wheel operations when the mouse is moving and the window is scrolling horizontally and vertically downward to the left.
A) PanSE
B) PanSW
C) PanSouth
D) PanNW

2. In mouse cursor option ................. is a cursor for mouse wheel operations when the mouse is moving and the window is scrolling vertically in an upward direction.
A) PanSE
B) PanSW
C) PanSouth
D) PanNorth

3. ..................... is a signed count of the number of rotation of the mouse wheel.
A) Alfa
B) Delta
C) Wheel rotation
D) Rotation count

4. Most of the functionally of  the text box control is simply inherited from the ................. class, which is also the a base class for the rich text box control.
A) TextBoxControl
B) RichTextBox  
C) TextBoxBase
D) TextBox

5. ................. control is generally used for editable text although it can also made read only.
A) TextBoxControl
B) RichTextBox  
C) TextBoxBase
D) TextBox

6. We can limit the amount of text entered into TextBox control by setting .................. property to a specific number of characters.
A) MaxLength
B) TotalLength
C) TextAmount
D) TextLimit

7. TextBox controls also can be used to accept password if the ................. property is used to mask characters.
A) PasswordChar
B) PasswordCharacter
C) MaskChar
D) PasswordControl

8. Each hyperlink is a object of the ................... class and is stored in a collection called links.
A) HyperLink.Link
B) LinkLabel.Link
C) Link.LinkLabel
D) Link.HyperLink

9. Which of the following is NOT the public properties of TextBox objects.
A) AutoSize
B) BackColor
C) BulletIndent
D) MaxLength

10. Which of the following is/are the public methods of TextBox objects.
i) Clear    ii) Paste   iii) LoadFile   iv) Paste
A) i, ii and iii only
B) ii, iii and iv only
C) i, ii and iv only
D) All i, ii, iii and iv

Read More »

MCQ Questions On Windows Forms In VB.Net Part-1

This set of multiple choice question on windows forms in visual basic .net includes MCQ questions on different properties, methods, procedures and events used to create windows forms in vb.net along with it's functions and keywords.  

1. ..................... property on windows forms, gets or sets the size and location of the form on the windows desktop.
A) Clientsize
B) Size
C) DesktopBounds
D) Bounds

2. Windows forms public object property, ................. gets or sets the bounding rectangle for the form.
A) Clientsize
B) Size
C) DesktopBounds
D) Bounds

3. ................... method on windows forms public object methods, gets the child control that is located at the specified co-ordinates.
A) GetChildAtPoint
B) GetNextControl
C) GetChildControl
D) GetChildPoint

4. ................ method finds the location of the specified screen point to client co-ordinates.
A) PointClient
B) GetClient
C) PointToClient
D) FocusClient

5. ................ event occurs when a key is pressed while the form has the focus.
A) Keydown
B) Keypress
C) Keyup
D) KeyEnter

6. In the new sub procedure of windows forms, the code calls a procedure named ..................., which adds and arranges the controls in the form.
A) InitializeComponent
B) AddComponet
C) NewComponet
D) SubComponent

7. .................... keyword is used to refer to the current object.
A) Current
B) Me
C) This
D) ThisForm

8. The possible values for the FormBorderStyle property is/are the following
i) Fixed3D   ii) None  iii) FixedSingle   iv) VariableDialog
A) i, ii and iii only
B) ii, iii and iv only
C) i, ii and iv only
D) All i, ii, iii and iv

9. Form's ................... property is used to specify t he initial position on the screen.
A) InitialPosition
B) StartPosition
C) StartScreen
D) InitialScreen

10. We can assign form's start position property values from the FormStartPosition enumeration, with the following values.
i) Certerpart   ii) CenterScreen   iii) Manual   iv) Location
A) i, ii and iii only
B) ii, iii and iv only
C) i, ii and iv only
D) All i, ii, iii and iv
Read More »

MCQ On VB.Net Data Types, Operators, Conditions And Loops

This set of multiple choice questions on visual basic .net data types, operators and loops includes MCQ on vb .net  keywords, variables, functions and methods along with the details of their types. 

1. ..................... datatype in .Net FCL corresponds integer data type in vb.net.
A) System.Int32
B) System.Int64
C) System.Int16
D) System.Number

2. The data data type in visual basic .net equivalent to .................. data type in .net FCL.
A) System.Date
B) System.DateTime
C) System.Time
D) System.DateFormat

3. ..................... are symbols used to perform operations; like +, which performs addition operations, -, which performs subtraction operations  and so on.
A) Keywords
B) Operators
C) Variables
D) Expressions

4. .................. are symbolic names given to values stored in memory and declared with the Dim keyword.
A) Keywords
B) Operators
C) Variables
D) Expressions

5. The keyword ........................, gives variables protected access, which means they are accessible only from within their own class.
A) Protected
B) Friend
C) Protected Friend
D) Private

6. The variables in ................... access means they are accessible only from within  their declaration context, including any nested procedures.
A) Protected
B) Friend
C) Protected Friend
D) Private

7. The ................. variable is not associated with a specific instance of a class or structure.
A) Protected
B) Shared
C) Shadows
D) Friend

8. The .................. variable are accessible from within the program  that contains their declaration, as well as anywhere else in the same assembly.
A) Protected
B) Friend
C) Protected Friend
D) Private

9. ................. is used to declare arrays; which gives upper sounds of the dimensions of an array variable.
A) bound
B) bound array
C) bound list
D) bound table

10. .............. function in vb.net is used to convert character code to character.
A) Char
B) Format
C) Convert
D) Chr

Read More »

MCQ Questions On Fundamental of Visual Basic .Net Set-2

This set of multiple choice questions on fundamental of visual basic .net includes MCQ on .Net Framework Class Library (FCL), different namespace and extensions used in vb.net along with different classes used in vb.net.

1. Using a ............................variable does not enable us to create read-only properties that are often required by a class.
A. public
B. private
C. protected
D. friend

2. A .....................................performs invisible tasks even if you write no code.
A. destructor
B. private method
C. constructor
D. function

3. The ......................................does not describe inherited member functions, inherited operators, and overridden virtual member functions.
A. Class Library Reference
B. Library
C. Objects
D. Classes


4. The ............................... group classes according to their common services.
A. objects
B. inheritance
C. Namespaces
D. programs

5. Whenever an application is created, a ............................ is added.
A. Form
B. Class
C. Property
D. Object

6. ............................ are interactive objects that you place in dialog boxes or other windows to carry out user actions.
A. Controls
B. Objects
C. Classes
D. Forms

7. The ................................. class provides static methods to start, stop, or filter Windows messages in an application.
A. Forms
B. Windows
C. Application
D. Control

8. The ........................... is a systematic class framework used for the development of system tools and utilities.
A. .Net Framework Class Library (FCL)
B. .Net tools
C. Visual Basic 2005
D. Visual Basic 6

9. The ................................... method converts the value of this instance to a double representing the OLE automation date.
A. From OA Date
B.TO OA Date
C. Today
D. Now


10. The ................................ enable us to pass data between a program and a class.
A. Functions
B. Properties
C. Procedures
D. Variables

Read More »

Solved MCQ On Fundamental Of Visual Basic.Net Set-1

Here are the collections of multiple choice questions on visual basic .net includes MCQ on loop structure supported by vb.net, different namespaces used on vb.net framework, COM and distributed COM(DCOM) technology along with about DAO, RDO, ADO and ADO.NET.

1. Which of the following Loop structure does not supported by VB.Net?
A. Do ................ Loop
B) For ................... Next
C) Do ................ While
D) For Each ............ While

2. The _____ model does not offer a model for source code reuse.
A. COM+
B. DCOM
C. COM
D. .Net
3. _____ allow custom items of information about a program element to be stored with an assembly's metadata.
A. Properties
B. Attributes
C. Methods
D. Classes

4. The corresponding .Net FCL type for Short is ___________.
A. System.Int32
B. System.Int64
C. System.Int16
D. System.Object

5. The member "clear" of the Array class that sets a range of array elements to zero, false or null reference is a _____________ method.
A. Shared
B. Method
C. Class
D. Object

6. The ___________ method converts an OLE automation date value to a DateTime Instance.
A. Today
B. TimeOfDay
C. Now
D. FromOADate

7. The function procedures are ___________ by default.
A. public
B. private
C. protected
D. inherited

8. Every optional argument in the procedure definition must specify a _________ value which must be a constant expression.
A. constant
B. default
C. integer
D. character

9. Type casting in VB.Net is implemented by means of ____________ statement.
A. Type()
B. TypeDef()
C. Btype()
D. Ctype()

10. State whether the statement true or false.
i) Function procedures are public by default.
ii) Function procedure return values whereas sub procedures cannot return a value to the calling procedure.
A. True, True
B. True, False
C) False, True
D) False, False
Read More »

Top 20 MCQ On Minimum Spanning Trees And Algorithms

This set of multiple choice question on minimum spanning trees and algorithm in data structure includes MCQ on the design of minimum spanning trees, kruskal's algorithm, prim's algorithm, dijkstra and bellman-ford algorithms.

1. Which of the following is/are the operations performed by kruskal's algorithm.
i) sort the edges of G in increasing order by length ii) keep a subgraph S of G initially empty iii) builds a tree one vertex at a time
A) i, and ii only
B) ii and iii only
C) i  and iii only
D) All i, ii and iii

2. Rather than build a subgraph one edge at a time ............................... builds a tree one vertex at a time.
A) kruskal's algorithm
B) prim's algorithm
C) dijkstra algorithm
D) bellman ford algorithm

3. .................. is known as a greedy algorithm, because it chooses at each step the cheapest edge to add to subgraph S.
A) Kruskal's algorithm
B) Prim's algorithm
C) Dijkstra algorithm
D) Bellman ford algorithm

4. The result of prim's algorithm is a total time bound of ..................
A) O(logn)
B) O(m+n logn)
C) O(mn)
D) O(m logn)

5. The ..................... process updates the costs of all the vertices V, connected to a vertex U, if we could improve the best estimate of the shortest path to V by including (U,V) in the path to V.
A) relaxation
B) improvement
C) shortening
D) Costing

6. ................. turns out that one can find the shortest paths from a given source to all points in a graph in the same time.
A) Kruskal's algorithm
B) Prim's algorithm
C) Dijkstra algorithm
D) Bellman ford algorithm

7. ................ keeps two sets of vertices; S, the set of vertices whose shortest paths from the source have already been determined and V-S, the remaining vertices.
A) Kruskal's algorithm
B) Prim's algorithm
C) Dijkstra algorithm
D) Bellman ford algorithm

8. ................. is a more generalized single source shortest path algorithm which can find t he shortest path in a graph with negative weighted edges.
A) Kruskal's algorithm
B) Prim's algorithm
C) Dijkstra algorithm
D) Bellman ford algorithm

9. A sample application of ................. algorithm is to solve critical path problem, i.e. finding the longest path through a DAG.
A) DAG application path algorithm
B) DAG shortest path algorithm
C) DAG critical path algorithm
D) Bellman ford algorithm

10. The floyd-warshall all pairs shortest path algorithm computes the shortest paths between each pair of nodes in .......................
A) O(logn)
B) O(n^2)
C) O(mn)
D) O(n^3)

11. In a directed graph, the ................. can compute  the  transitive hull in O(n^3)
A) Transitive Hull
B) Minimax Distance
C) Max Min Distance
D) Safest Path

12. .................. means, for all vertices, compute its reachability.
A) Transitive Hull
B) Minimax Distance
C) Max Min Distance
D) Safest Path

13. For a directed graph with edge lengths, the floyd warshall algorithm can compute the ................. between each pair of nodes in O(n^3).
A) Transitive Hull
B) Minimax Distance
C) Max Min Distance
D) Safest Path

14. Given a directed graph where the edges are labeled with survival probabilities, we can compute the ............... between the two nodes with floyd warshall.
A) Transitive Hull
B) Minimax Distance
C) Max Min Distance
D) Safest Path

15. ..................... describe efficient algorithms for computing G^T from G, for both the adjacency list and adjacency matrix representations of G.
A) Graph transpose problem 
B) Strongly connected components problem
C) Topological sort problem
D) Euler path problem

16. In ............... input is a directed acyclic graph (DAG)G=(V,E).
A) Graph transpose problem
B) Strongly connected components problem
C) Topological sort problem
D) Euler path problem

17. In ......................, a directed graph G is acylic if and only if a DFS of G yields no back edge.
A) Graph transpose problem 
B) Strongly connected components problem
C) Topological sort problem
D) Euler path problem

18. ................. is a most generalized single source shortest path algorithm to find the shortest path in a graph even with negative weights.
A) Kruskal's algorithm
B) Prim's algorithm
C) Dijkstra algorithm
D) Bellman ford algorithm

19. ..................... solves the problem of finding the shortest path from a point in a graph to a destination.
A) Kruskal's algorithm
B) Prim's algorithm
C) Dijkstra algorithm
D) Bellman ford algorithm

20. Dijkstra algorithm is also called the  ...................... shortest path problem.
A) multiple source
B) single source
C) single destination
D) multiple destination


Answers

1. A) i, and ii only
2. B) prim's algorithm
3. A) Kruskal's algorithm
4. B) O(m+n logn)
5. A) relaxation
6. C) Dijkstra algorithm
7. C) Dijkstra algorithm
8. D) Bellman ford algorithm
9. B) DAG shortest path algorithm
10. D) O(n^3)
11. A) Transitive Hull
12. A) Transitive Hull
13. B) Minimax Distance
14. D) Safest Path
15. A) Graph transpose problem
16. C) Topological sort problem
17. C) Topological sort problem
18. D) Bellman ford algorithm
19. C) Dijkstra algorithm
20. B) single source
Read More »