Explore topic-wise MCQs in Testing Subject.

This section includes 657 Mcqs, each offering curated multiple-choice questions to sharpen your Testing Subject knowledge and support exam preparation. Choose a topic below to get started.

1.

Consider the following code snippet : var grand_Total=eval( 10*10+5 ); The output for the above statement would be :

A. 10*10+5
B. 105 as a string
C. 105 as an integer value
D. Exception is thrown
Answer» D. Exception is thrown
2.

Consider the following code snippet var tensquared = (function(x) {return x*x;}(10)); Will the above code work ?

A. Yes, perfectly
B. Error
C. Exception will be thrown
D. Memory leak
Answer» B. Error
3.

Consider the following code snippet var string2Num=parseInt( 123xyz ); The result for the above code snippet would be :

A. 123
B. 123xyz
C. Exception
D. NaN
Answer» C. Exception
4.

For the below mentioned code snippet: var o = new Object(); The equivalent statement is:

A. Var o = Object();
B. Var o;
C. Var o= new Object;
D. Object o=new Object();
Answer» D. Object o=new Object();
5.

What is the difference between the two lines given below ? !!(obj1 && obj2); (obj1 && obj2);

A. Both the lines result in a boolean value "True"
B. Both the lines result in a boolean value "False"
C. Both the lines checks just for the existence of the object alone
D. The first line results in a real boolean value whereas the second line merely checks for the existence of the objects
Answer» E.
6.

Consider the following code snippet. The state stored in d is : namespace McqsMentorConsoleApplication var c = counter(), d = counter(); c.count() d.count() c.reset() c.count() d.count()

A. 1
B. 0
C. Null
D. Undefined
Answer» B. 0
7.

Consider the following code snippet. What does the last statement return ? namespace McqsMentorConsoleApplication var c = counter(), d = counter(); function constfuncs() { var funcs = []; for(var i = 0; i < 10; i++) funcs[i] = function() { return i; }; return funcs; } var funcs = constfuncs(); funcs[5]()

A. 9
B. 0
C. 10
D. None of the mentioned
Answer» D. None of the mentioned
8.

The escape sequence f stands for

A. Floating numbers
B. Representation of functions that returns a value
C. F is not present in JavaScript
D. Form feed
Answer» E.
9.

The snippet that has to be used to check if a is not equal to null is

A. If(a!=null)
B. If (!a)
C. If(a!null)
D. If(a!==null)
Answer» E.
10.

Consider the following snippet code namespace McqsMentorConsoleApplication var string1 = "123"; var intvalue = 123; alert( string1 + intvalue ); The result would be

A. 123246
B. 246
C. 123123
D. Exception
Answer» D. Exception
11.

Consider the following statements: namespace McqsMentorConsoleApplication var text = "testing: 1, 2, 3"; // Sample text var pattern = /d+/g // Matches all instances of one or more digits In order to check if the pattern matches with the string "text", the statement is

A. Text==pattern
B. Text.equals(pattern)
C. Text.test(pattern)
D. Pattern.test(text)
Answer» E.
12.

Which works similar to element?

A.
B.
C.
D.
Answer» C.
13.

This Your text tag is used to define a

A. Link
B. Class
C. CSS sheet
D. Both a and b
Answer» B. Class
14.

How much memory will be allocated for an object of class given below? class Test { int mark1; int mark2; float avg; char name[10]; };

A. 22 Bytes
B. 24 Bytes
C. 20 Bytes
D. 18 Bytes
Answer» B. 24 Bytes
15.

If array of objects is declared as given below, which is the limitation on objects?Class_name arrayName[size];

A. The objects will have same values
B. The objects will not be initialized individually
C. The objects can never be initialized
D. The objects will have same data
Answer» C. The objects can never be initialized
16.

Consider the following code snippet:What does the min mean?

A. Minimised version
B. Miniature
C. Minimised parameters
D. Minimum value
Answer» B. Miniature
17.

What does the following code snippet mean?#log>span

A. Span child after log declaration
B. Specific span child of id greater than log
C. Span child less than log
D. Any span child of the element with id as log
Answer» E.
18.

Consider the following code snippet. What will be the role of the continue keyword in the above code snippet? namespace McqsMentorConsoleApplication while (a != 0) { if (spam>a == 1) continue; else a++; }

A. The continue keyword restarts the loop
B. The continue keyword skips the next iteration
C. The continue keyword skips the rest of the statements in that iteration
D. None of the mentioned
Answer» D. None of the mentioned
19.

Consider the following code snippet. In the snippet, firstname and surname are namespace McqsMentorConsoleApplication var book = { "main title": "JavaScript", 'sub-title': "The Definitive Guide", "for": "all audiences", author: { firstname: "David", surname: "Flanagan" } };

A. Properties
B. Property values
C. Property names
D. Objects
Answer» D. Objects
20.

Consider the below given syntax:book[datatype]=assignment_value;In the above syntax, the datatype within the square brackets must be

A. An integer
B. A String
C. An object
D. None of the mentioned
Answer» C. An object
21.

Consider the following code snippet function f() {}; The above prototype represents a

A. Function f
B. A custom constructor
C. Prototype of a function
D. Not valid
Answer» C. Prototype of a function
22.

Identify the process done in the below code snippet namespace McqsMentorConsoleApplication o = {x:1, y:{z:[false,null,""]}}; s = JSON.stringify(o); p = JSON.parse(s);

A. Object Encapsulation
B. Object Serialization
C. Object Abstraction
D. Object Encoding
Answer» C. Object Abstraction
23.

The output for the following code snippet would most appropriately be int i = 0, j = 0; var a=5 , b=1 var obj = { a : 10 } with(obj) { alert(b) }

A. 10
B. Error
C. 1
D. 5
Answer» D. 5
24.

A conditional expression is also called a namespace McqsMentorConsoleApplication var a=5 , b=1 var obj = { a : 10 } with(obj) { alert(b) }

A. Alternate to if-else
B. Immediate if
C. If-then-else statement
D. None of the mentioned
Answer» C. If-then-else statement
25.

Which is a more efficient code snippet int i = 0, j = 0; Code 1 : for(var num=10;num>=1;num--) { document.writeln(num); } Code 2 : var num=10; while(num>=1) { document.writeln(num); num++; }

A. Code 1
B. Code 2
C. Both Code 1 and Code 2
D. Cannot Compare
Answer» B. Code 2
26.

The var and function are

A. Keywords
B. Declaration statements
C. Datatypes
D. Prototypes
Answer» C. Datatypes
27.

Consider the following statement: namespace McqsMentorConsoleApplication switch(expression) { statements } In the above switch syntax, the expression is compared with the case labels using which of the following operator(s) ?

A. ==
B. Equals
C. Equal
D. ===
Answer» E.
28.

Consider the following statement: namespace McqsMentorConsoleApplication var count = 0; while (count < 10) { console.log(count); count++; } In the above code snippet, what happens?

A. The values of count is logged or stored in a particular location or storage
B. The value of count from 0 to 9 is displayed in the console
C. An error is displayed
D. An exception is thrown
Answer» C. An error is displayed
29.

Consider the following code snippet. What does the code result? namespace McqsMentorConsoleApplication function printArray(a) { var len = a.length, i = 0; if (len == 0) console.log("Empty Array"); else { do { console.log(a[i]); } while (++i < len); } }

A. Prints the numbers in the array in order
B. Prints the numbers in the array in the reverse order
C. Prints 0 to the length of the array
D. Prints "Empty Array"
Answer» B. Prints the numbers in the array in the reverse order
30.

What is tag in HTML?

A. It renders fonts as teletype text font style.
B. It renders fonts as truetype text font style.
C. It renders fonts as truncate text font style.
D. None of the Above.
Answer» B. It renders fonts as truetype text font style.
31.

Which of the following is correct to set Black color as Background of page?

A. Bgcolor = "#000000">
B.
C.
D. All of Above
Answer» B.
32.

Which of the following is correct character entities for Copyright symbol?

A.
B.
C.
D.
Answer» D.
33.

src attribute for an image specifies what?

A. Text for image
B. Url for an image
C. Alternate image
D. Both a and b
Answer» C. Alternate image
34.

In image tag alt attribute specifies what?

A. Alternative text
B. Alternative image
C. Link of image
D. None
Answer» B. Alternative image
35.

XMLHttpRequest is a

A. Object
B. Class
C. Both Object and Class
D. None of the mentioned
Answer» D. None of the mentioned
36.

tag defines a

A. Paragraph
B. Line
C. Link
D. Table
Answer» B. Line
37.

(document.getElementById( demo ).innerHTML = Hello! ; ) Function is an example of?

A. PHP
B. JavaScript
C. HTML5
D. None
Answer» C. HTML5
38.

The element (Navigation Element) defines

A. A set of graphics
B. A set of websites
C. A set of navigation pages
D. A set of navigation links
Answer» E.
39.

The HTML tag is used to

A. Draw graphics on the fly via scripting
B. Create frames on the fly via scripting
C. Draw graphics on the basis of HTML code
D. Create forms for input user information
Answer» B. Create frames on the fly via scripting
40.

The uses of tag is

A. To display movies in the page.
B. To highlight parts of the text.
C. To underline parts of the text.
D. To display graphics in the page.
Answer» C. To underline parts of the text.
41.

The HTML element is a A. Inline element B. Outline element C. Block level element D. None Answer: C . Block level element 0Shares0 0

A. Inline element
B. Outline element
C. Block level element
D. None
Answer» D. None
42.

Tags used to tell browser that how to display text enclosed (e.g. , ) are called as

A. Physical tags
B. Logical tags
C. User defined tags
D. None
Answer» B. Logical tags
43.

The element is a container for _______

A. Links
B. Webpages
C. Metadata
D. Pictures
Answer» D. Pictures
44.

tag makes the enclosed text bold. What is other tag to make text bold?

A.
B.
C.
D.
Answer» B.
45.

Using tag will

A. Start a new paragraph
B. Break the line
C. End the current paragraph
D. None of the above
Answer» B. Break the line
46.

How many nodetype named constants are available?

A. 13
B. 11
C. 12
D. 10
Answer» D. 10
47.

Consider the following code snippet namespace McqsMentorConsoleApplication function tail(o) { for (; o.next; o = o.next) ; return o; } Will the above code snippet work? If not, what will be the error?

A. No, this will throw an exception as only numerics can be used in a for loop
B. No, this will not iterate
C. Yes, this will work
Answer» D.
48.

Which among the following is correct for the code given below? class student { private: student() { } public : student( int x) { marks =x; } };

A. The object can never be created
B. The object can be created without parameters
C. Only the object with only 1 parameter can be created
D. Only the object with some parameters can be created
Answer» D. Only the object with some parameters can be created
49.

Which among the following is true for the code given below? class A { private : int marks; char name[20]; public : A(int x=100) { marks=x; } };

A. Objects can be created with one parameter or without parameter
B. Object can be created only with one parameter
C. Object can be created with more than one parameter
D. Objects can be create only without parameter
Answer» B. Object can be created only with one parameter
50.

Choose the correct option for the code given below: class A{ static int c=0; public: A(){ c++; } };

A. Constructor will make c=1 for each object created
B. Constructor will make c=0 for each object created
C. Constructor will keep number of objects created
D. Constructor will just initialize c=0 then increment by 1
Answer» D. Constructor will just initialize c=0 then increment by 1