Psuedocode, html, css and javascript and normalisation Flashcards

You may prefer our related Brainscape-certified 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
Q

Branching in javascript

A

if (document.getElementById(‘express’).checked) {
expressCost = 5
}

26
Q

How to output by changing the contents of an HTML element eg

A

document.getElementById(‘name’).innerHTML = “Bob”;

27
Q

How to output using an alert box

A

alert(“Hello world”);

28
Q

How to output by writing directly to the page

A

document.write(“Hey Bob”)

29
Q

Example of defining a class in html

A

.example { // defining
background-color: green; a class
border: 1px solid black;
}

30
Q

Example of using a class in html

A

<div class = ‘example’>

<p> This paragraph will have a green background and a black
border </p>

</div>

31
Q

How to change background colour

A

background-colour

32
Q

How to change border colour

A

border-colour

33
Q

How to change border style

A

border-style

34
Q

how to change border width

A

border-width

35
Q

How to change colour (with named and hex colours)

A

color

36
Q

How to change the family of the font

A

font-family

37
Q

How to change the size of the font

A

font-size

38
Q

How to change the style of the font

A

font-style

39
Q

How to change the height

A

height

40
Q

How to change the width

A

width

41
Q

How to use classes

A

To identify multiple elements

42
Q

How to use identifiers

A

To identify one element

43
Q

Example of using an identifier

A
44
Q

How to get value using get element

A

document.getElementById(“num1”).value;

45
Q

Whenever an external style sheet is used, where is the link added to

A

The header

46
Q

What is the link when you use an external style sheet

A

<link></link>

47
Q

Styling body

A

body
{
margin: 0px;
}

48
Q

document.getElementById(‘name’).innerHTML = “Bob”; or

A

chosenElement=document.getElementById(“example”);
chosenElement.innerHTML = “Hello World”;

49
Q
A