Important Jee Main Solutions

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 66

1 JavaScript Code can be called by using

a) RMI

b) Triggering Event

c) Preprocessor

d) Function/Method *

2 Which of the following is not considered as an error in JavaScript?

a) Syntax error

b) Missing of semicolons

c) Division by zero *

d) All of the mentioned

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)*

4The statement a===b refers to

a) Both a and b are equal in value, type and reference address

b) Both a and b are equal in value

c) Both a and b are equal in value and type *

d) There is no such statement

var string1 = "123";

var intvalue = 123;

alert( string1 + intvalue );


The result would be

a) 123246

b) 246

c) 123123 *

d) Exception

The JavaScript’s syntax calling ( or executing ) a function or method is called

a) Primary expression

b) Functional expression

c) Invocation expression *

d) Property Access Expression

What kind of an expression is "new Point(2,3)"?

a) Primary Expression

b) Object Creation Expression *

c) Invocation Expression

d) Constructor Calling Expression

Among the following, which one is a ternary operator?

a) +

b) :

c) –

d) ?: *

9
JavaScript is a _______________ language

a) Object-Oriented

b) High-level

c) Assembly-language

d) Object-Based *

10

The output for the following code snippet would most appropriately be

var a=5 , b=1

var obj = { a : 10 }

with(obj)

alert(b)

a) 10

b) Error

c) 1 *

d) 5

11

A conditional expression is also called a

a) Alternate to if-else

b) Immediate if *

c) If-then-else statement

d) None of the mentioned


12

A statement block is a

a) conditional block

b) block that contains a single statement

c) Both conditional block and single statement

d) block that combines multiple statements into a single compound statement *

13

When an empty statement is encountered, a JavaScript interpreter

a) Ignores the statement *

b) Prompts to complete the statement

c) Throws an error

d) Throws an exception

14

The “var” and “function” are

a) Keywords

b) Declaration statements *

c) Datatypes

d) Prototypes

15

he function definitions in JavaScript begins with

a) Identifier and Parantheses *


b) Return type and Identifier

c) Return type, Function keyword, Identifier and Parantheses

d) Identifier and Return type

16

When does the function name become optional in JavaScript?

a) When the function is defined as a looping statement

b) When the function is defined as expressions *

c) When the function is predefined

d) All of the mentioned

17

What will happen if a return statement does not have an associated expression?

a) It returns the value 0

b) It will throw an exception

c) It returns the undefined value *

d) None of the mentioned

18

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

19

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

20

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

21
Why so JavaScript and Java have similar name?

A. JavaScript is a stripped-down version of Java

B. JavaScript's syntax is loosely based on Java's *

C. They both originated on the island of Java

D. none of the above

22

Which of the following syntax is correct to refer an external script called “formValidation.js”?

A. <script href = “formValidation.js”>

B. <script source = “formValidation.js”>

C. <script name = “formValidation.js”>

D. <script src = “formValidation.js”> *

23

Which of the following is correct to write “Hello World ” on the web page?

A. System.out.println(“Hello World”)

B. print(“Hello World”)

C. document.write(“Hello World”) *

D. response.write(“Hello World”)

24

Which attribute needs to be changed to make elements invisible?

A. Visibility *

B. Visible

C. Invisibility

D. Invisible
25

The script tag must be placed in

A.

head

B.

head and body *

C.

title and head

D.

all of the mentioned


Ans=onmouseover

ANS=onclick
ANS=onmousedown

ANS=document.getElementById(“url”)value=window.location.href;
ANS=A

ANS=getElementByTagName(“li”)
ANS=innerHTML

ANS=D,B
ANS=B

ANS=document.value.credentials.username.innerHTML;

What is Microsoft Internet Explorer?

A A File Manager

B The Internet

C An Icon
D A Web Browser *

2 HTML tags are used to describe document ___________.

A None of these

B Content

C Definition

D Language

3 HTML Document can contain ______________.

A Attributes

B Plain Text

C Tags

D All of these *

Page Designed in HTML is called as ________.

A Front Page

B Yellow Page

C Server Page

D Web Page *

HTML is platform independent.

A False

B True *
C NONE

D BOTH

HTML program can be read and rendered by _________.

A Compiler

B Web Browser *

C Server

D Interpreter

HTML tags are surrounded by __________ brackets.

A Squart

B Round

C Angle *

D Curly

HTML document contain 1 root tag called __________.

A HTML *

B BODY

C TITLE

D HEAD
9

Which attribute specifies a unique alphanumeric identifier to be associated with an element?

a) class

b) id*

c) article

d) html

10

The _____________ attribute specifies an inline style associated with an element, which determines the
rendering of the affected element.

a) dir

b) style *

c) class

d) none of the mentioned

11

Which attribute is used to provide an advisory text about an element or its contents.

a) tooltip

b) dir

c) title *

d) none of the mentioned

12

Which of the following is the attribute that specifies additional horizontal space, in pixels, to be reserved
on either side of an embedded item like an iframe, applet, image, and so on?

a) height

b) hspace *
c) hidefocus

d) datasrc

13

Choose the correct tag for largest heading in HTML.

a) h6

b) heading

c) h1 *

d) head

================================================================

CSS QUESTIONS

1 What is css stands for

a) Color Style Sheets

b) Cascade Sheets Style

c) Cascade Style Sheet

d) Cascading Style Sheets *

In css what does h1 can be called as

a) Selector *

b) Attribute

c) Value

d) Tag
3

In css what does “color:red” can be called as

a) Selector

b) Rule

c) Declaration *

d) None of the above

Which of the following attributes is used to specify elements to bind style rules to?

a) id

b) class

c) tag

d) all of the mentioned *

In css what does “font-size” can be called as

a) Selector

b) Rule

c) Property

d) Property-Name*

selectors, which are used to specify a group of elements

a) id

b) class *
c) tag

d) both (b) and (c)

implementation that introduced text, list, box, margin, border, color, and background properties.

a) css *

b) html

c) ajax

d) php

Is it the best way to include H1 heading only one time in the web page. State true or false.

a) True *

b) False

9 Which of the following function adjust the brightness of an element’s color, for use by the filter
property?

a) contrast()

b) dark()

c) light()

d) brightness() *

10

Which of the following function converts an element’s color to a shade of gray, for use by the filter
property?

a) shade()

b) grayscale() *

c) black()

d) brightness()
11 If we want define style for an unique element, then which css selector will we use ?

A. Id *

B. text

C. class

D. name

12

If we want to use a nice looking green dotted border around an image, which css property will we use?

A. border-color

B. border-decoration

C. border-style *

D. border-line

13

Which element is used in the <HEAD> section on an HTML, if we want to use an external style sheet file
to decorate the page ?

A. <src>

B. <link> *

C. <style>

D. <css>
ANS=yes,no,no,no

ANS=A
ANS=innerHTML,innerHTML,value,toLowerCase();

ANS=SmpleStudent=HTmlStudent

Samplecourse=HTML
Samplecourse.grade=90;
ANS=100,20,40,60

ANS=line 2=undefined

Line04=String
Line 06=Array

Line08=number
ANS=B

ANS=YES
NO
ANS=vardate=new Date();var month=date.getMonth();date.setmonth(month+value);
ANS=[],push,j++,sum[i];
ANS=1=String

2=number

3=Boolean

4=undefine
ANS=101

101

101

ANS=2017,January,1;

ANS=&&,==;
ANS=if(age<5//age>=65);

ANS=if(age>=5//age<18)
ANS=switch(day)

ANS=case”wednesday”
ANS=case”wendnesday”

ANS=for,break,continue
ANS=if(a>=0)
ANS=esleif(b%2==0)AANAA

ANS=esleif(a>=0)

ANS=else{
ANS=var i=star

ANS=i<0
ANS=++i

ANS=switch(month)
ANS=break;

ANS=break;
ANS=no,no

ANS=TRUE,false,true,true

ANS=promt,alert,confire
ANS=try

ANS=catch()
ANS=B

ANS=3,5

ANS=E,B
ANS=yes,yes,yes,yes

ANS=yes,no,no,yes
ANS=n=10

C=55

A=25

D=5

1 JavaScript is …

A. subjective

B. objective

C. evil

D. object based *

var obj1 = {}; var obj2 = {}; What is the value of (obj1 === obj2)

A. true

B. false *

What does the following expression return? 1 + 5 + ” bottles of milk”;

A. “15 bottles of milk”

B. “6 bottles of milk” *
C. undefined. An exception is thrown

D. “5 bottles of milk”

How do you create an object in JavaScript?

A. var obj = {};

B. function Foo() {} var obj = new Foo();

C. All of these work. *

D. var obj = new Object();

Primitive types are passed by :

A. Value *

B. Pointer

C. Reference

Which is not a primitive data type in JavaScript?

A. boolean

B. number

C. string

D. character *

Which of these is a correct method to create a new array?

A. var myArray = ();

B. var myArray = []; *


C. var myArray = new Array[];

D. var myArray = {};

To what type are values converted internally when evaluating a conditional statement?

A. positive

B. negative

C. integer

d. boolean *

Which of these is not a logical operator?

A. !

B. & *

C. &&

D. ||

10

Which of the following invokes a user-defined object constructor function?

A. var x = new myConstructor(); *

B. var x = create myConstructor();

C. myConstructor x = create myConstructor();

D. myConstructor x = new myConstructor();

11
Which is the correct way to write a JavaScript array?

A. var names = {0: “Tim”, 1: “Kim”, 2: “Jim”};

B. var names = {1: “Tim”, 2:”Kim”, 3:”Jim”};

C. var names = [“Tim”,”Kim”,”Jim”]; *

D. var names = array(“Tim”, “Kim”, “Jim”);

12

How do you define a function called “fName” ?

A. function fName: { }

B. func fName = function () {}

C. function fName() { } *

D. new fName = { }

13

How do you check what the type of a value in variable x is?

A. gettype(x);

B. x.__type;

C. Object.type(x);

D. typeof(x); *

14

Which of the following declares a variable with a value of string type?

A. var string myVar = “This is a string”;

B. var myVar = “This is a string”; *

C. string myVar = “This is a string”;

D. None of the above


15

What is the value of the array myArr after execution of the following code: var myArr = [1,2,3,4,5];
myArr.shift();

A. [1,2,3,4,5]

B. []

C. [2,3,4,5] *

D. [1,2,3,4]

16

In JavaScript, to call a function directly, you use:

A. function_expression -> ( arguments_if_any )

B. function_expression { arguments_if_any }

C. arguments_if_any ( function_expression )

D. function_expression ( arguments_if_any ) *

17

What is the value of x? function foo(y) { var z = 10; z = 7; }; var x = foo(“bar”);

A. undefined *

B. 7

C. 10

D. “bar”
18

What is the value of x.length after running this code? x = [“foo”]; x.quux = “Hello”; x[1] = “bar”;

A. Error on last line: index out of bounds

B. Error on middle line: cannot add properties to Array

C. 2 *

D. 1

19

Whats the output of the below : for(var i = 0; i < 10;i++){ setTimeout(function(){console.log(i) }, 10)}

A. 0 1 2 3 4 5 6 7 8 9

B. 10 10 10 10 10 10 10 10 10 10 *

C. 10 10 10 10 10 10 10 10 10

D. Error

20

What will we see in the console after the following code run: var a = ‘Bolt’; function f() { if (!a) { var a =
‘Nut’; } console.log(a); } f(); console.log(a);

A. ‘Nut’ and ‘Nut’

B. ‘Bolt’ and ‘Bolt’

C. ‘Nut’ then ‘Bolt’ *

D. ‘Bolt’ then ‘Nut’

21

What’s the correct syntax for creating a Date object for January 10, 1998?

A. new Date(1, 10, 1998);

B. new Date(0, 10, 1998);


C. new Date(1998, 0, 10); *

D. new Date(1998, 1, 10);

22

A statement block is a

a) conditional block

b) block that contains a single statement

c) Both conditional block and single statement

d) block that combines multiple statements into a single compound statement *

23

Consider the following statements

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
24

Consider the following code snippet

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);

What does the above code result?

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”

25

Consider the following code snippet


for(var p in o)

console.log(o[p]);

The above code is equivalent to which code?

a) for (var i = 0;i < a.length;i++) *

console.log(a[i]);

b) for (int i = 0;i < a.length;i++)

console.log(a[i]);

c) for (var i = 0;i <= a.length;i++)

console.log(a[i]);

d) for (var i = 1;i < a.length;i++)

console.log(a[i]);

26

Consider the following code snippet

while (a != 0)

if (a == 1)

continue;

else

a++;

What will be the role of the continue keyword in the above code snippet?

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

27

The function definitions in JavaScript begins with

a) Identifier and Parantheses *

b) Return type and Identifier

c) Return type, Function keyword, Identifier and Parantheses

d) Identifier and Return type

28

Consider the following code snippet

function hypotenuse(a, b)

function square(x)

return x*x;

return Math.sqrt(square(a) + square(b));

What does the above code result?

a) Sum of square of a and b *

b) Square of sum of a and b

c) Sum of a and b square

d) None of the mentioned


29

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

30

The one-liner code that concatenates all strings passed into a function is

a) function concatenate()

return String.prototype.concat('', arguments);

b) function concatenate()

return String.prototype.apply('', arguments);

c) function concatenate()

return String.concat.apply('', arguments);

d) function concatenate() *

{
return String.prototype.concat.apply('', arguments);

31

Consider the following code snippet :

var scope = "global scope";

function checkscope() {

var scope = "local scope";

function f()

return scope;

return f;

What is the function of the above code snippet?

a) Returns value null

b) Returns exception

c) Returns the value in scope *

d) None of the mentioned

32

The URL property belongs to which of the following object?

a) Document *

b) Element
c) Location

d) All of the mentioned

33

What does the location property represent?

a) Current DOM object *

b) Current URL

c) Both DOM object and URL

d) None of the mentioned

34

How does Java Script store dates in objects of Date type?

A. The number of days since 1st, 1900

B. The number of seconds since January 1st, 1970

C. The number of milliseconds since January 1st, 1970 *

D. The number of picoseconds since January 1st, 1970

35

function() {

var a = 10;

if(a > 5) {

a = 7;

alert(a);
}

When executed, what value will be alerted to the screen?

A7*

B 10

C null

D undefined

36

var a = 5;

function first() {

a = 6;

function second() {

alert(a);

Assuming I call these functions in order, what value gets alerted?

A0

B5

C6 *

D null

37
Variable can hold ________ value at a time

None of these

Multiple

Double

Single *

38

Integer Variable is declared using following syntax in JavaScript.

A Integer num;

B var num; *

C int num;

D integer num;

39

We can declare ___________ at a time. Select most appropriate option.

A One Variable Only

B None of these

C One or more Variables *

D More than One Variables


40

<!DOCTYPE html>

<html>

<body>

<script>

var num1 = 1;

var num2 = 1;

var num3 = "1" + num1 + num2;

document.write(num1 + "<br>");

document.write(num2 + "<br>");

document.write(num3 + "<br>");

</script>

</body>

</html>

Guess output of the following code.

113

1 1 12

None of these *

1 1 111

41

<html>
<body>

<script>

var name = "John Doe";

var name = 123;

document.write(name + "<br>");

</script>

</body>

</html>

Is it possible to change the type of value after re-assignment.

s it possible to change the type of value after re-assignment.

Yes !! It is possible. *

It can be possible if variable is assigned with interger value.

No

D NONE OF THE ABOVE

42

<script type="text/javascript">

function message() {

var name = "Pritesh";

alert(name);
}

</script>

Variable declared above is example of ___________ Variable.

A Global

B Local *

43

<script type="text/javascript">

var name;

name = "Suhas";

</script>

<script type="text/javascript">

document.write(name);

</script>

What will be the output of the following ?

A None of these

B Nothing will be printed

C Error

D Suhas

44

What is the purpose of a return statement in a function?

A Returns the value and continues executing rest of the statements, if any

B Returns the value and stops the program

C Returns the value and stops executing the function

D Stops executing the function and returns the value *


45

The type that specifies what kind of event occured is

A event type *

B even target

C both event type and even target

D none of the mentioned

46

In general, event handler is nothing but

A function *

B interface

C event

D handler

47

When is the mouseover event fired?

A When mouse is moved over a new element *

B When mouse is clicked

C When mouse is both moved and clicked

D None of the mentioned


48

You can redirect the webpage in JavaScript by using ………………… method.

A) window.reload

B) window.location *

C) page.location

D) url.newlocation

49

A ………………… mostly used to take users choice on any option and displays a dialog box with two buttons
Ok and Cancel.

A) Alert dialog box

B) Information dialog box

C) Prompt dialog box

D) Conformation dialog box *

50
<script language="javascript">

function x()

document.write(2+5+"8");

</script>

a) 258

b) Error

c) 7

d) 78 *

You might also like