Send a link to your students to track their progress
277 Terms
1
New cards
a)
Which tag does JavaScript go inside when you wish to write it in line with ?
a)
2
New cards
a) Class
Assuming my code does not have any syntax errors in it, what scope is a variable labeled 'this.myVar'?
a) Class
b) Local
c) Global
d) Limited within the
3
New cards
a) extends
What notation does JavaScript use to inherit from one class to another?
a) extends
b) inherits
c) implements
d) :
4
New cards
a) call ‘super()’;
If I have a class (in JavaScript) that inherits from another one, in order to call the constructor in the parent I must:
a) call ‘super()’;
b) not do anything as it will do it automatically
c) call ‘Parent()’
d) must initialize an instance of parent ans assign it to ‘this’
5
New cards
true
(T/F) If I dynamically add an HTML element to page, I do not have to initialize everything at first as I can change the properties of that object once it has been added.
6
New cards
D
If I have the following code in JavaScript
(and assume mySection is a pointer to an HTML object).
for(var i =0; i < 5; i ++)
{
mySection.innerHTML += "# ";
mySection.innerHTML += "\\n";
}
What will my output be?
7
New cards
true
(T/F) JavaScript is client-side by default.
8
New cards
false
(T/F) JavaScript is server-side by default.
9
New cards
c) hard-typed language
Which of the following statements are not true about JavaScript?
a) will run in-line with HTML
b) can modify other components using the document object model (DOM) of HTML
c) hard-typed language
d) requires the use of tags
e) none of the above
10
New cards
b) will erase the existing web-page
document.write(); will write text to the page, however, it also
a) redirect the text output to another page
b) will erase the existing web-page
c) won’t be formatted properly
d) has no drawbacks, it will work as intended
11
New cards
a) document.write();
You can use this method to write text to the page but it will erase the existing web-page, if the page has finished loading.
What method is this?
a) document.write();
b) document.getElementById();
c) document.note();
d) document.writeText();
12
New cards
b) document.getElementById();
It is a better idea to use this method when writing text to a page.
What method is this?
a) document.write();
b) document.getElementById();
c) document.note();
d) document.writeText();
13
New cards
a) the title will change to “Hello World”
Given the code, what will happen if the following is written to the console?
var myTitle = document.getElementById(“title”);
myTitle.innerHTML = “Hello World”;
a) the title will change to “Hello World”
b) a new small text “Hello world” will appear under the title
c) another title “Hello World” will appear above the title
d) nothing will happen
14
New cards
b) console.log();
Which of the following will output to the console?
a) console.warn();
b) console.log();
c) console.error();
d) console.write();
15
New cards
d) console.warn();
Which of the following will output a warning?
a) console.yell()
b) console.log();
c) console.error();
d) console.warn();
16
New cards
b) console.error();
Which of the follow will output an error?
a) console.warn();
b) console.error();
c) console.fault();
d) console.log();
17
New cards
b) current scope
The following declared variable will declare x as 10 in the ______________.
var x = 10;
a) global scope
b) current scope
c) class scope
d) local scope
18
New cards
true
(T/F) The method document.write(); can only be used while the page is loading up unless you wish to destroy the page.
19
New cards
true
(T/F) JavaScript will always do floating point division.
20
New cards
false
(T/F) JavaScript will only sometimes do floating point division.
21
New cards
true
(T/F) OpenGL will only accept float.
22
New cards
false
(T/F) OpenGL will only accept double.
23
New cards
b) 64
By default, all decimal numbers in JavaScript are ________________ bit.
a) 24
b) 64
c) 8
d) 16
24
New cards
c) global
All variables declared outside of a function of class will automatically have ______________ scope.
a) local
b) class
c) global
d) functional
25
New cards
canvas context, instance of main, canvas variable
The only global variables you are allowed to have are
(select multiple)
* canvas context * instance of main * class functions * canvas variable
26
New cards
document.body.appendChild(this.myImg);
From the code given, which statement allows an object to be dynamically added to the HTML?
27
New cards
a) floating-point division
What kind of math is ALWAYS done in JavaScript?
a) floating-point division
b) double-point division
c) floating-point multiplication
d) none of the above
28
New cards
true
(T/F) The default numeric type for JavaScript is float.
29
New cards
you need a global function for a callback, from the global callback we can call the class function
Explain the process of invoking a call back. Assume we want to have all the functionality inside a class. What is the extra piece of work we have to do?
30
New cards
c) canvas
HTML 5 introduced an HTML element called ____________. This element can be used to draw and render images.
a) painting
b) drawer
c) canvas
d) whiteboard
31
New cards
2D, 3D
What are the two contexts in which a programmer can draw images?
32
New cards
fragment and vertex shader, charset, any/all CSS or JavaScript imports, inline functions or classes
The HTML head section contains:
(select multiple)
* fragment and vertex shader * charset * HTML canvas element * any/all CSS or JavaScript imports * global functions or classes * inline functions or classes
33
New cards
b) body
The _________________ section of the HTML file will contain the content seen in the webpage.
a) footer
b) body
c) header
d) title
34
New cards
b) code that is not inside a function or a class
JavaScript will begin execution when it encounters _____________________________.
a) any kind of code
b) code that is not inside a function or a class
c) code that is inside a function or a class
d) none of the above, JavaScript will begin execution regardless
35
New cards
d) all of the above
JavaScript has ________________ variable scope.
a) global
b) local
c) class
d) all of the above
36
New cards
d) all of the above
In this class, the only 3 global variables used are
a) instance of the main class
b) canvas object
c) canvas context
d) all of the above
37
New cards
true
(T/F) If a function returns void, it does not have a return statement or it has a return statement with no value.
38
New cards
b) script HTML tag
In basic JavaScript syntax, things such as writing to the console and function declaration must be written between
a) footer HTML tag
b) script HTML tag
c) body HTML tag
d) none of the above
39
New cards
true
(T/F) You cannot overload the constructor in JavaScript.
40
New cards
false
(T/F) You can overload the constructor in JavaScript.
41
New cards
b) constructor()
What is the correct way to declare class functions?
a) class function constructor()
b) constructor()
c) function constructor()
d) class Main::constructor()
42
New cards
parameterized constructor
You cannot overload the constructor in JavaScript but you can have a ___________________ instead of a default.
43
New cards
true
(T/F) All class variables are public.
44
New cards
false
(T/F) All class variables are private.
45
New cards
a) after
Callbacks must be assigned ___________ the class has been initialized.
a) after
b) before
46
New cards
true
(T/F) JavaScript can also iterate through collections, similar to a for-each loop e.g. for(let x in jsArray){…}.
47
New cards
IDs
You can assign different ___________ to HTML elements.