Search Header Logo
JavaScript and jQuery basics

JavaScript and jQuery basics

Assessment

Presentation

Computers, Professional Development, Education

1st Grade - Professional Development

Practice Problem

Hard

Created by

Kaamil Jasani

Used 24+ times

FREE Resource

4 Slides • 20 Questions

1

JavaScript and jQuery basics

Slide image

2

Multiple Select

Which of the following declare and assign a variable correctly in JavaScript? (Choose 2)

1

var x = 5;

2

value = var 10;

3

variable = "Hello World";

4

let name = "John";

3

Multiple Select

By accessing the DOM, which of the following can JavaScript do? (Choose 3)

1

Change all the elements on the page

2

Add or remove HTML elements and attributes

3

Read or write files on the user's system

4

Permanently modify the website's files

5

Change all the CSS on the page

4

Multiple Choice

Which of the following will create an object?

1

{ }

2

[ ]

3

< >

4

( )

5

Multiple Choice

Which of the following will create an array?

1

{ }

2

[ ]

3

< >

4

( )

6

Multiple Choice

Which of the following invokes a function?

1

{ }

2

[ ]

3

< >

4

( )

7

Multiple Choice

In JavaScript, all variables must be identified with unique names.

1

True

2

False

8

Variables in JavaScript

  • The "identifier" or name of a variable in JavaScript will uniquely identify it

  • This means that when you create a variable, you need to make sure the name is unique in the current scope or you may end up overwriting the original variable

9

Multiple Select

Which of the following will create a function in JavaScript? (Choose 3)

1

function(parameters) { ... }

2

function name(parameters) { ... }

3

name(parameters) { ... }

4

function { (parameters) ... }

5

(parameters) => { ... }

10

Multiple Choice

What does DOM stand for?

1

Document Ordered Model

2

Data Object Model

3

Document Object Matter

4

Document Object Model

11

Multiple Choice

What is the file type of external JavaScript files?

1

.java

2

.js

3

.script

4

.jsp

12

Multiple Select

Which of the following values are "truthy"?

1

"false"

2

0

3

null

4

{} (empty object)

13

Converting values to booleans

  • Values in JavaScript are either "truthy" or "falsy"

  • This just means that when converted into a boolean, they will be coverted to true or false, respectively.

  • Some "truthy" values are: Any object, any function, numbers that are not 0, any non-empty string

  • Some "falsy" values are: null, undefined, 0, "" (the empty string)

  • This can, in some cases, be used to check if a value was set correctly or if a variable exists

14

Multiple Select

Which of the following rules must variable names (identifiers) obey? (Choose 2)

1

Identifiers must not contain numbers

2

Identifiers must not start with a number

3

Identifiers can only contain letters, digits, _ and $

4

Identifiers must start with a letter

15

Multiple Choice

What is the name of the variable in the following JavaScript code?

function greet() {

let name = "John";

console.log("Hello " + name);

}

1

greet

2

John

3

name

4

log

16

Multiple Choice

What does AJAX stand for?

1

Asynchronous JavaScript and XML

2

Asynchronous JSON and XML

3

Automated JavaScript and XML

4

Automated JSON and XML

17

Multiple Choice

What does JSON stand for?

1

JavaScript Ordered Notation

2

JavaScript Object Notation

3

JavaScript Object Network

4

JavaScript Ordered Network

18

Multiple Select

jQuery can select elements based on which of the following? (Choose 4)

1

Classes

2

Attributes

3

Type

4

Location

5

Relationship

19

Multiple Select

Which of these are advantages of using jQuery? (Choose 3)

1

Consistent and cross-browser way of working with the DOM

2

Simplified code for accessing the DOM

3

Faster performance when modifying the DOM

4

Quicker loading times

5

Using plugins to extend website functionality

20

Multiple Choice

Which of the following is a shortcut to access jQuery?

1

_

2

$

3

jQ

4

&

21

Multiple Choice

When using jQuery's methods which modify elements, you can only select one element at a time

1

True

2

False

22

Multiple Choice

What will the selector ":even" select in jQuery?

1

Every element of type "even"

2

Every element in an even position within its parent

3

Every element that contains an even number

4

Every other element

23

Special selectors in jQuery

  • :even will select any elements that are in an even position within their parent (useful for tables)

  • :parent will select any element that is a parent (i.e. has some element within it)

  • :hidden will select any element that is hidden (usually with jQuery's hide method)

  • :focus will select the element that currently has focus (usually useful for input elements, buttons and links)

  • There are many more, you can find them in jQuery's documentation

24

Multiple Choice

What does the following jQuery code do?

$(function() {

...

}

1

Runs the given function when the user tries to leave the page

2

Runs the given function immediately, but with jQuery

3

Adds the given function to jQuery

4

Runs the given function before the page has loaded

5

Runs the given function when the page is fully loaded

JavaScript and jQuery basics

Slide image

Show answer

Auto Play

Slide 1 / 24

SLIDE