Вы находитесь на странице: 1из 9

.

HSBC

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

Test- 2
Name:

Emp ID:

Duration: 60 Min.

Date:10.08.2012
Max Marks: 30

1.

<script type="text/javascript">
x = 4+"4";
document.write(x);
</script>
What is output?
a)44
b)8
c)4
d)Error output

2.
<script type="text/javascript" language="javascript">
var x ="This is a test";
var result = x.split(" ");
document.write(result);
</script>
a)This
b)This is a test
c) This,is,a,test
d)This is
3.
<script type="text/javascript" language="javascript">
document.write(navigator.appCodeName);
</script>
a)get code name of the browser of a vistor
1 of 9

HSBC internal

HSBC

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

b)set code name of the browser of a vistor


c)None of the above

4. Inside which HTML element do we put the JavaScript?

a) <js>
b) <scripting>
c) <script>
d) <javascript>

5.What is the correct JavaScript syntax to write "Hello World"?


a) response.write("Hello World")
b) ("Hello World")
c) document.write("Hello World")
d) "Hello World"
6.Where is the correct place to insert a JavaScript?
a) The <head> section
b) The <body> section
c) Both the <head> section and the <body> section are correct

7.What is the correct syntax for referring to an external script called


"xxx.js"?
a) <script type="text/javascript" href="xxx.js">
2 of 9

HSBC internal

HSBC

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

b) <script type="text/javascript" src="xxx.js">

c) <script type="text/javascript" name="xxx.js">


8.How do you write "Hello World" in an alert box?
a) alertBox="Hello World"
b) alert("Hello World")
c) alertBox("Hello World")
d) msgBox("Hello World")
9.How do you create a function?
a) function myFunction()
b) function=myFunction()
c) function:myFunction()
10. How do you call a function named "myFunction"?
a) myFunction()
b) call myFunction()
c) call function myFunction

11. How do you write a conditional statement for executing some code if
"i" is equal to 5?
a) if i==5 then
b) if (i==5)
c) if i=5
3 of 9

HSBC internal

HSBC

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

d) if i=5 then

12. How do you write a conditional statement for executing some code if
"i" is NOT equal to 5?
a) if (i != 5)
b) if <>5
c) if (i <> 5)
d) if =! 5 then
13.Whay is mean by this keyword in javascript?
a) It refers current object
b) It refers previous object
c) It is variable which contains value
d) None of the above
14.In JavaScript,window.prompt() method return true or false value?
a) False
b) True
c) None of above

15. _________ keyword is used to declare variables in javascript.


a) Var
b) Dim
c) String
16)
<script type="text/javascript" language="javascript">
qpt=((45%2)==0)? "hello" : "bye";
4 of 9

HSBC internal

HSBC

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

document.write(qpt);
</script>
a) hello
b) bye

c) Error in string handling


d) None of the above
17. How do you create a new object in JavaScript?
a) var obj = {};
b) var obj = Object();
c) var obj=new {};
d) None of the above

18) In Javascript, What does isNaN function do ?


a) Return true if the argument is not a number.
b) Return false if the argument is not a number.
c) Return true if the argument is a number.
d) None of the above
19) If x=103 & y=9 then x%=y , what is the value of x after executing x
%=y?
a) 4
b) 3
c) 2
5 of 9

HSBC internal

HSBC

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

d) 5

20)How to assign a function to a variable with the JavaScript Function


contructor ?
a) var f=Function("x","y","return x+y");
b) var f=Function(x,y){ return x+y;}
c) var f= new Function("x", "y", "return x + y");
21) In JavaScript, Window.alert() is used to allow user to enter something
a) True
b) False
c) None of above
22) Is javaScript case sensitive ?
a) Yes
b) No
23) What are the following looping structures are available in javascripts?
a) for,forecach
b) foreach,whileloop
c) do-while loop,foreach
d) for , while loop
24) Which of these is not a method of the Math object?
a) atan()
b) atan2()
c) eval()
d) acos()
25)Javascript is a ________ typed language.
a) tightly
6 of 9

HSBC internal

HSBC

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

b) loosely

26) <script type="text/javascript" language="javascript">


var qpt= new Array();
qpt[0] = "WebDevelopment";
qpt[1]="ApplicationDevelopment"
qpt[2]="Testing"
qpt[3] = "QualityPointTechnologies";
document.write(qpt[0,1,2,3]);
</script>
a) Error
b) QualityPointTechnologies
c) WebDevelopment
d) WebDevelopmnet,ApplicationDevelopment,Testing,QualityPointTechnologies

27) Choose the server-side JavaScript object:


a) FileUpLoad
b) Function
c) File
d) Date

28) parseFloat(9+10)=?
a) 19
7 of 9

HSBC internal

HSBC

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

b) 910
c) None

29) <script type="text/javascript">


x=4+"4";
document.write(x);
</script>
Output------?
a) 44
b) 8
c) 4
d) Error output

30) <script type="text/javascript" language="javascript">


var qpt = "Qualiyt Point Technologies";
8 of 9

HSBC internal

HSBC

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

var result = qpt.split(" ");


document.write(result);
</script>
a) Quality
b) Q,u,a,l,i,t,y,P,o,i,n,t,T,e,c,h,n,o,l,o,g,i,e,s
c) Qualiyt,Point,Technologies
d) QualityPointTechnologies

9 of 9

HSBC internal

Вам также может понравиться