Psuedocode, html, css and javascript and normalisation Flashcards

1
Q

Describe a class diagram for a class called House with attributes for square footage and number of rooms.

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Write the pseudocode for a fully encapsulated House class. You do not have to write code for the get and set methods.

A

class House

private squareFootage
private rooms

public procedure new (givenSquareFootage, givenRooms)
squareFootage = givenSquareFootage;
rooms = givenRooms;
endProcedure

endClass

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Write pseudocode to create a House object.

A

myHouse = new House (5000, 10)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Psuedocode example for superclass

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Psuedocode example for subclass

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What must the subclass constructor always contain

A

A ‘super’ call and be the first statement in the subclass constructor

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Example of a setter method

A

public procedure setName(newName)
name = newName
endProcedure

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Example of a getter method

A

public function getName()
return name
endFunction

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Are attributes + or -

A
  • -to indicate private access modifier
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Are methods + or -

A

+ to indicate public access modifier

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

How to read one line from a file

A

myFile = openRead(“test.txt”)
line = myFile.readLine()
myFile.close()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is the issue with reading lines

A

Cannot go to a specific line to read it the code will read the first line

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Printing all lines from a file

A

myFile = openRead(“sample.txt”)
while NOT myFile.endOfFile()
print(myFile.readLine())
endwhile
myFile.close()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Writing one line to a file

A

myFile = openWrite(“sample.txt”)
myFile.writeLine(“Hello World”)
myFile.close()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

First normal form

A

each record (row) is unique i.e. it has a primary key
Each data item cannot be broken down any further (is atomic) e.g. addresses should be broken up
Each field (column) has an unique name
No fields (columns) that represent a group of data

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Second normal form

A

Non-key fields must depend on every part of the primary key. If the primary key is not composite, this condition will be met

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

What is a composite primary key

A

When 2 fields together are used as the primary key

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

Third normal form

A

Non-key fields depend only on the primary key, could not have branch name which depends on branch ID if branch ID was not the primary key

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

How to use image tag html

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

How to use link tag html

A

<a> PMT </a>

21
Q

How to declare a variable in javascript

A

var name=”Sophie”

22
Q

How to declare an array in javascript

A

var cars=[“Saab”,”Volvo”,”BMW”];

23
Q

How to write a for loop in javascript

A

for (var i = 0; i < 5 ; i++) {
text += “Hello” + “<br></br>”;
}

24
Q

How to write a while loop javascript

A

while (i < 10) {
text += “<br></br>The number is “ + i;
i++;

25
Branching in javascript
if (document.getElementById('express').checked) { expressCost = 5 }
26
How to output by changing the contents of an HTML element eg
document.getElementById('name').innerHTML = "Bob";
27
How to output using an alert box
alert("Hello world");
28
How to output by writing directly to the page
document.write("Hey Bob")
29
Example of defining a class in html
.example { // defining background-color: green; a class border: 1px solid black; }
30
Example of using a class in html

This paragraph will have a green background and a black border

31
How to change background colour
background-colour
32
How to change border colour
border-colour
33
How to change border style
border-style
34
how to change border width
border-width
35
How to change colour (with named and hex colours)
color
36
How to change the family of the font
font-family
37
How to change the size of the font
font-size
38
How to change the style of the font
font-style
39
How to change the height
height
40
How to change the width
width
41
How to use classes
To identify multiple elements
42
How to use identifiers
To identify one element
43
Example of using an identifier
44
How to get value using get element
document.getElementById("num1").value;
45
Whenever an external style sheet is used, where is the link added to
The header
46
What is the link when you use an external style sheet
47
Styling body
body { margin: 0px; }
48
document.getElementById('name').innerHTML = "Bob"; or
chosenElement=document.getElementById("example"); chosenElement.innerHTML = "Hello World";
49