Chủ Nhật, 10 tháng 6, 2012

Trắc nghiệm kiến thức cơ bản về JavaScript/VBScript

Trong bài này, chúng ta sẽ đến với một bài trắc nghiệm tổng hợp về ngôn ngữ kịch bản JavaScript/VBScript. Với mỗi lựa chọn, các bạn hãy giải thích tại sao các bạn lại lựa chọn đáp án đó. 

JAVASCRIPT

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

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

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

a. "Hello World"
b. document.write("Hello World")
c. ("Hello World")
d. response.write("Hello World")

3. Where is the correct place to insert a JavaScript?

a. The <head> section
b. Both the <head> section and the section are correct
c. The <body> section
d. The <Title> Section

4. What is the correct syntax for referring to an external script called "xxx.js"?

a. <script type="text/javascript" src="xxx.js">
b. <script type="text/javascript" name="xxx.js">
c. <script type="text/javascript" href="xxx.js">

5. The external JavaScript file must contain the <script> tag

a. False
b. True

6. How do you write "Hello World" in an alert box?

a. alert("Hello World")
b. alertBox="Hello World"
c. alertBox("Hello World")
d. msgBox("Hello World")

7. How do you create a function?

a. function:myFunction()
b. function myFunction()
c. function=myFunction()

8. How do you call a function named "myFunction"?

a. call function myFunction
b. call myFunction()
c. myFunction()

9. 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)
d. if i==5 then

10. How do you write a conditional statement for executing some code if "i" is NOT equal to 5?

a. if <>5
b. if (i <> 5)
c. if (i != 5)
d. if =! 5 then

11. How does a "while" loop start?

a. while (i<=10;i++)
b. while (i<=10)
c. while i=1 to 10

12. How does a "for" loop start?

a. for i = 1 to 5
b. for (i <= 5; i++)
c. for (i = 0; i <= 5)
d. for (i = 0; i <= 5; i++)

13. How can you add a comment in a JavaScript?

a. //This is a comment
b. 'This is a comment
c. <!--This is a comment-->

14. What is the correct JavaScript syntax to insert a comment that has more than one line?

a. <!--This comment has more than one line-->
b. /*This comment has more than one line*/
c. //This comment has more than one line//

15. What is the correct way to write a JavaScript array?

a. var txt = new Array("tim","kim","jim")
b. var txt = new Array(1:"tim",2:"kim",3:"jim")
c. var txt = new Array="tim","kim","jim"
d. var txt = new Array:1=("tim")2=("kim")3=("jim")

16. How do you round the number 7.25, to the nearest integer?

a. Math.round(7.25)
b. round(7.25)
c. Math.rnd(7.25)
d. rnd(7.25)

17. How do you find the number with the highest value of x and y?

a. top(x,y)
b. ceil(x,y)
c. Math.max(x,y)
d. Math.ceil(x,y)

18. How do you put a message in the browser's status bar?

a. status("put your message here")
b. window.status = "put your message here"
c. statusbar = "put your message here"
d. window.status("put your message here")

19. How can you find a client's browser name?

a. browser.name
b. client.navName
c. navigator.appName

20. Which of the following is NOT done with JavaScript ?

a. Form Validation
b. RGB Colors
c. Browser Detection
d. RGB Value

21. It is usually advisable to keep as much JavaScript as possible in which section ?

a. Head
b. Layer
c. Body
d. Title

22. JavaScript lines end with what ?

a. comma
b. semicolon
c. colon
d. Bracket

23. Which of the following is NOT a type of popup box ?

a. Alert
b. Confirm
c. Radio
d. Text

24. The most common way to assign a value to a variable is by using what ?

Equals sign
Name It
CSS
HTML

25. a++; is the same as which of the following ?

a. a=a+2;
b. a=a+3;
c. a=a+1;
d. a=a+4;

26. To keep the browser from performing a script as soon as it is loaded you need to write the script as a what ?

a. function
b. delay
c. performance
d. Flexibility

27. Actions that can be detected by javascript are called ?

a. HTML
b. Events
c. Array
d. ArrayList

28. A variable that your webpage can store on or retrieve from the users computer is known as ?

a. Applet
b. Java
c. Cookie
d. Session

29. In JavaScript, capital letters are different from lowercase letters ?

a. Not on windows platforms
b. Yes
c. No
d. Not on Linux Platform

30. Which is detected when the mouse moves over a link ?

a. overMouse event
b. onMouseOver event
c. onRollOver event
d. OnMouseOut event

31. How do you read the first character in a string ?

a. stringName.charAt(0);
b. stringName.substring(1);
c. stringName.charAt(1); 
d. stringName.charAt(2);

32. Which has no syntax error ?

a. alert("hello "+3+" times);
b. alert("hello "+3 times);
c. alert("hello +3+ times");
d. alert("hello "+3 +" times);

33. Which method will open a new window ?

a. popUp(PageURL,WindowName,settings);
b. window.launch(PageURL,WindowName,settings);
c. window.close(PageURL,WindowName,settings);
d. window.open(PageURL,WindowName,settings);

34. Which method is used to search for a substring ? 

a. stringVariable.substring(subString)
b. stringVariable.find(subString)
c. stringVariable.indexOf(subString)
d. stringVariable.indexOf(charAt(0))

35. Which best describe void?

a. method
b. function
c. statement 
d. operator

VBSCRIPT

1. What language is VBScript based on ?

a. VBScript, Microsoft's Visual Basic Scripting Edition, is a scaled down version of Visual Basic.
b. Jscript and Javascript.
c. HTML
d. XML

2. Why is a scripting language called a scripting language ?

a. Scripting languages, like JavaScript and VBScript, are designed as an extension to XML.
b. Scripting languages, like JavaScript and VBScript, are designed as an extension to XHTML.
c. Scripting languages, like JavaScript and VBScript, are designed as an extension to HTML.
d. Scripting languages, like JavaScript and VBScript, are designed as an extension to DHTML.

3. There are two methods for declaring variables in VBScript

a. option explicit and option explicit.
b. explicitly and implicitly
c. using VB and Java
d. using javascript and perl variable

4. What does the Option Explicit directive do ?

a. It forces you to declare all of your variables.
b. It forces you to call the method.
c. It forces you to declare all of your static variables
d. It forces you to declare all of your global variables

5. How to disply values to the user ?

a. Using Request.form
b. Using Response.write
c. Using Request.Querystring
d. Using Request.Servarvariables

6. How to take request from the user ?

a. Using Response.write
b. Using Request.Querystring
c. Using Request.Servarvariables
d. Using Request.form

7. How to take request using get bmethod ?

a. A.Using Request.form
b. Using Response.write
c. Using Request.Querystring
d. Using Request.Servarvariables

8. How to take request using post method ?

a. Using Request.form
b. Using Response.write
c. Using Request.Querystring
d. Using Request.Servarvariables

9. VBScript is a

a. Programming language
b. Scripting language.
c. Server Language
d. None of these

10. VBScript is developed by

a. Netscape
b. Opera.
c. Sun
d. Misrosoft

11. What two VBScript commands can be used to make decisions ?

a. if..then..else
b. select..case
c. A and B are correct.
d. None of these.

12. Which of these VBScript commands can be used to to iterate through loops ?

a. For...Next.
b. While.....wend
c. if....then...else
d. A and B are correct

13. A scripting language is a

a. lightweight programming language
b. script.
c. A and B are correct.
d. None of these

14. The command used in VBScript for writing some text on a page is

a. document.write().
b. Msgbox
c. A and B are correct.
d. None of these

15. Where to Put the VBScript code

a. Head section.
b. Body Section.
c. Both body and head section.
d. None of these.

16. Two kinds of procedures in VBScript

a. Top procedure and bottom procedure
b. The Sub procedure and the Function procedure.
c. A and B are correct
d. None of these

17. Which of these are string functions available in VBScript.

a. Chr
b. InStr
c. LCase
d. All of the above

18. Which of these are conversion functions available in VBScript

a. CByte
b. CDbl
c. Cint
d. All of the above

19. Which of these are math functions available in VBScript

a. Abs
b. Array
c. All of the above
d. None of these

20. Which of these are Time and Date Functions available in VBScript

a. DateSerial
b. DateDifference
c. A and B are correct.
d. DateValue

Editor: Vương L.Kiều (Baomathethong.blogspot.com)
Copyrighted Content: N/A

Không có nhận xét nào:

Đăng nhận xét