MCQOPTIONS
Saved Bookmarks
This section includes 8 Mcqs, each offering curated multiple-choice questions to sharpen your Technical MCQs knowledge and support exam preparation. Choose a topic below to get started.
| 1. |
Which is an equivalent code to invoke a function m of class o that expects two arguments x and y? |
| A. | o(x,y); |
| B. | o.m(x) && o.m(y); |
| C. | m(x,y); |
| D. | o.m(x,y); |
| E. | |
| Answer» E. | |
| 2. |
const pt1 = {}; const ob1 = Object.create(pt1); console.log( Object.getPrototypeOf(ob1) === pt1 );9.A linkage of series of prototype objects is called as : |
| A. | prototype stack |
| B. | prototype chain |
| C. | prototype class |
| D. | prototypes |
| Answer» C. prototype class | |
| 3. |
const ob1 = { a: 5, b: 10, c: 15 }; const ob2 = Object.assign({c: 8, d: 3}, ob1); console.log(ob2.c, ob2.d);8.What will be the output of the following JavaScript code? |
| A. | true |
| B. | false |
| C. | errot |
| D. | 0 |
| Answer» B. false | |
| 4. |
var obj = new Fun();obj.constructor === Fun6.If X is the superclass and Y is the subclass, then subclass inheriting the superclass can be represented as _________ |
| A. | Y=inherit(X); |
| B. | Y=X.inherit(); |
| C. | Y.prototype=inherit(X); |
| D. | Y.prototype=inherit(X.prototype); |
| Answer» D. Y.prototype=inherit(X.prototype); | |
| 5. |
var json= '{ "sId":2001,"sName":"John" }';//line 2console.log(student.sId+" "+student.sName);5.What will be the output of the following JavaScript code? |
| A. | true |
| B. | false |
| C. | 0 |
| D. | 1 |
| Answer» C. 0 | |
| 6. |
function Ticket(from,to,pName){ this.from=from; this.to=to; this.pName= pName; } var ticket=new Ticket( "Udaipur","Pune","Raj" ); 4.Consider the below code:Choose the appropriate statement to be inserted at line 2, in order to create a JavaScript object named student? |
| A. | var student=json.parse(json); |
| B. | var student=JSON.stringify(json); |
| C. | var student=JSON.parse(json); |
| D. | var student=json.stringify(json); |
| Answer» D. var student=json.stringify(json); | |
| 7. |
function Ticket(from,to,pName){ this.from=from; this.to=to; this.pName= pName; } var ticket=new Ticket( "Udaipur","Pune","Raj" ); 3.Identify the correct syntax to create a JavaScript object for Employee with property empid, empName? |
| A. | var employee=new Object(); employee.empid=20; employee.empName="John"; |
| B. | var employee ={id:2001,empName:"John"}; |
| C. | var employee=Employee(); employee.empid=20; employee.empName="John"; |
| D. | Both A and C |
| Answer» B. var employee ={id:2001,empName:"John"}; | |
| 8. |
class Rect { constructor(h, w) { this.height = h; this.width = w; } get foo() { return this.foo(); } foo() { return this.height * this.width; }}const sq = new Rect(5, 20);console.log(sq.foo()); 2.Choose the correct syntax in order to access property of the object created? |
| A. | ticket.from & ticket[to] |
| B. | ticket[to] & ticket[from] |
| C. | ticket {to} & ticket.to |
| D. | ticket[to] & ticket{from} |
| Answer» B. ticket[to] & ticket[from] | |