Semester Exam part1

Ace your homework & exams now with Quizwiz!

Consider the following JavaScript code snippet: var counter = 0; document.write(counter++); document.write(counter++); document.write(counter++); What will be the result of this code snippet when run in the browser? A 012 B 0++0++0++ C 000 D 123

A 012

Consider the following JavaScript statement: document.write(8 / 4 * 2 + 2 / 2); What is the output of this statement? A 5 B 2 C 3 D 1.5

A 5

What is an argument in JavaScript? A A value passed into a function from outside the function B Any method that returns a value C A named block of code that can be called D A statement that transfers program execution to a subroutine

A A value passed into a function from outside the function

Which of the following functions is created at runtime and declared without a name? A Anonymous B Closure C None of these D Prototype

A Anonymous

What is the return type of the confirm() method? A Boolean B Null C Integer D String

A Boolean

Which of the following is not a feature of JavaScript? A Compiled language B Object-oriented C Platform independent D Case-sensitive

A Compiled language

Which of the following technologies enables server-side scripting using JavaScript? A Node.js B C++ C Java D React

A Node.js

Which of the following methods let you convey information to a user and doesn't record the user's response? A alert() B confirm() C open() D prompt()

A alert()

Consider the following JavaScript function: function myFunction(x) { //your code here } Which code statement should be added to the function to return to the calling statement the value of x multiplied by 2? A return x * 2 B x = x * 2 C myFunction = x * 2 D x * 2

A return x * 2

What is the value returned by the following expression? (0 > 1) ? x : y A y B True C x D False

A y

What is Microsoft's implementation of JavaScript called? A JScript B JavaScript C ECMAScript D MScript

A. JScript

Which JavaScript operator indicates concatenation? A && B + C = D ++

B +

Which among the following operators is of highest precedence? A ? : B ++ C >> D ==

B ++

Which of the following is used to add multiline comments in JavaScript? A // B /* */ C :: D <!-- ... -->

B /* */

Consider the following code snippet: var myVar; myVar = confirm("continue?"); What is the data type of the value of myVar after execution? A Undefined B Boolean C Bit D Depends on the user's input

B Boolean

True or false: The event bubbles from the outermost to the innermost element in a page. A True B False

B False

Consider the following code snippet: var myVar1 = "25"; var myVar2 = 25; What is the difference between myVar1 and myVar2? A Nothing, they are the same B The data type C The scope D The value

B The data type

Which of the following statements is true of JavaScript keywords and/or reserved words? A You can use reserved words as names for variables. B You cannot use reserved words as names for objects. C All keywords are specific to particular versions of JavaScript. D You can use reserved words but not keywords as names for objects.

B You cannot use reserved words as names for objects.

JavaScript fits best under which category of languages? A Object-independent B Object-oriented C Object-driven D Object-based

B. Object-oriented

Question 1 :Which of the following operators is an assignment operator? This task contains the radio buttons and checkboxes for options. The shortcut keys to perform this task are A to H and alt+1 to alt+9. A % B + C += D ==

C +=

Which of the following best describes an object-oriented program? A A network of objects logically connected to one another that perform a series of tasks B A collection of objects that perform specific functions in a sequential order C A collection of individual objects that perform different functions D A sequence of statements that collectively perform a specific task

C A collection of individual objects that perform different functions

Which of the following data types is a non-primitive data type? A Null B Number C Array D String

C Array

Why should comments be included within JavaScript code blocks? A Because comments provide accessibility in browsers for the visually impaired B Because comments are required for each JavaScript code block C Because comments provide a way to indicate the intent of the code D Because comments deactivate all JavaScript code during debugging

C Because comments provide a way to indicate the intent of the code

What is casting in JavaScript? A Creating functions molded to pre-defined algorithms B Repairing corrupted user input C Changing a variable from one data type to another D Declaring all variables and creating all objects before programming procedures

C Changing a variable from one data type to another

Which of the following terms identifies the attributes that define the characteristics of an object? A Method B Value C Property D Function

C Property

Consider the following code snippet: var age = 18; var testValue = (age < 21) ? 'Teenager': 'Adult'; What is the value of testValue after execution? A 21 B 18 C Teenager D true

C Teenager

Which of the following statements declares a variable whose value can't be altered throughout the script? A var const = 5; B let x = 10; C const x = 5; D const x; x = 10

C const x = 5;

What type of a language is HTML? A Programming language B Scripting language C Markup language D Semantic language

C. Markup language

Which main characteristic of a programming language distinguishes it from a scripting language? A Programming languages are object-based, whereas scripting languages are object-oriented. B Programming languages are subsets of scripting languages and are interpreted. C Programming languages are compiled whereas scripting languages are interpreted. D Programming languages are developed by private organizations whereas scripting languages are open-source.

C. Programming languages are compiled whereas scripting languages are interpreted.

Which of the following statements is true of the undefined data type? A It defines a value that does not exist. B It assigns a string value "undefined" to the variable with data type as undefined. C It is not similar to the null data type in any aspect. D It is the value taken by the variables that don't have any value assigned to them.

D It is the value taken by the variables that don't have any value assigned to them.

Which of the following companies originally developed JavaScript? A Sun Microsystems B Microsoft Corporation C World Wide Web Consortium (W3C) D Netscape Corporation

D Netscape Corporation


Related study sets

Chapter 6: Osteoblasts, osteocytes, and osteoclasts

View Set

chapter 10 - Health Insurance Underwriting

View Set

LPI Linux Essentials 010 V1.6 - Chapter 9 Quiz

View Set

PSYCH chapter 12 (question samples)

View Set

Fallibroome: A2 Product Design: Scrum

View Set

ATI Nutrition Exam Dynamic Quizzes Questions

View Set

PMK-EE E7 LEADERSHIP AND CHARACTER EXAM

View Set