Generelt og felles Flashcards

1
Q

Hva er en String?

A

En klump med tekst.

Eksempel: 
'Dette er en tekststring'
'tekstring' 
"Dette er også en tekststring"
"10" (Selvom det er et tall)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Hva er Boolean?

A

En verdi som enten er true eller false
Verdien har to utfall og er binær
true / false

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

Hva er Integer?

A

Integer i Ruby er et heltall. Dvs at det ikke har desimaltegn eller desimaler

Eksempel: 
10 
1
2
69
16

Ikke:
129.82
37,5

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

Hva er Float?

A

Float er et tall i ruby som har desimaler
Desimaltegnet er .

Eksempel:

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

Hva er en funksjon?

A

En funksjon er en maskin som tar materiale inn - og spytter noe ut.

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

Hva er en array?

A

En liste med objekter. Skrives innen slike [ ]

Eksempel i Ruby:
collection = []
collection = [“Thomas”, “Kalle”, “Anders”]

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

Hva er en hash?

A

En hash er en samling med data som har key og value og ligger innenfor { }

Eksempel:
person = {name: “Thomas”, age: 44, weight: 85.5}
=> {:name=>”Thomas”, :age=>44, :weight=>85.5}

\:Name = key
"Thomas" = value.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Hva er en funksjon?

A

En funksjon er en maskin som gjør noe med en input og gir en output.

// 
En del av kode som kan kalles på ved et navn
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Hva er en method?

Hva skiller det fra en funksjon?

A

En method er en funksjon som er direkte tilknyttet et objekt.

Skiller seg bare fra funksjon ved at:

  • En method er avhengig av classen den tilhører
  • En method kan operere på data innefor classen.

Classen er definitionen - method er en del av class definisjonen.

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

Hva er NaN?

A

“Not a number”

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

Hva er en operatør?

A
Tegnet mellom navn og verdi. 
= 
\+
- 
* 
=== 
% 

etc.

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

Skal variabler ha stor forbokstav?

A

nei

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

Hva er en loop?

A

En loop er en funksjon som gjentar seg selv til en bestemt definert betingelse eller begrensning er oppnådd.

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

Hvor skal bootstrap CDN-filen legges?

A

Øverst i head i html-filen

eventuelt eventuelt i layout.haml dersom hammel benyttes

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

Hva er kommandoen for å legge in Rspec for et prosjekt?

A

$ rspec –init

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

I hvilken fil skal følgende være å finne?

  • -format documentation
  • -color
  • -require spec_helper
A

.rspec

filen er skjult

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

hva heter filen som har følgende innhold?
//
source ‘https://rubygems.org’

gem ‘rspec’

//

A

Gemfil

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

Hvilket ord kan “specs” erstattes med?

A

Tester

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

Hva er partials?

A

Et system som gjør at du kan legge inn samme innhold på flere av nettsiden i samme mappe. Til for eksempel
header og footer.

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

Hvis du skal bruke partials, hvilket tegn på fil innenfor partialsmappen starte med?

A

_ understrek.
For eksempel
_footer.html.haml
_header.html.haml

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

Hvor skal CSS-referansen i HTML?

A

=> I head
HAML
%link{:href => “mystyle.css”, :rel => “stylesheet”, :type => “text/css”}/

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

Hva gjør følgende CSS kommando ?
h {
color: blue;
}

A

Gir klassen h en blå farge.

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

Hva er hurtigtasten for å starte inspector?

A

Command+Shift+C

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

Hva er kommandoen i terminal for å starte middleman?

A

$ middleman server

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Q
Hva skjer egentlig her? 
# countdown.rb

x = gets.chomp.to_i

while x >= 0
puts x
x -= 1

A

Initially the program evaluates the line x >= 0.

This evaluates to true (unless you entered a negative number) and so the program enters the loop, executing puts x and the line after that, x = x - 1. Then the program returns to the top, now with the newly updated value of x and evaluates the x >= 0 again. This process repeats until the value of x is no longer greater than or equal to 0. It then exits the loop and continues with the rest of the program. You can see why it’s called a loop. It loops over the logic within itself repeatedly.

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

Hva skriver du i terminal for å starte GUI hvor du kan gjøre Rubykommandoer?

A

$ irb

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

Ruby:
Hva gjør disse kommandoene? Er det noen forskjell?

$ collection = Array.new
$ collection = []

A

Begge lager en ny, tom array som heter “collection”.

Nei, ingen forskjell.

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

Ruby:
$ collection = [“Thomas”, “Kalle”, “Anders”]
Hva gjør følgende kommando?
$collection.shift

A

Den sletter objectet som er lagret først - i dette tilfellet, Thomas.

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

Hva slags dataobject er dette når det står alene?

:name

A

Symbol

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

Ruby:

Bør du bruke singel- ‘ ‘ eller dobbelquotes “ “ når du skriver kommandoer i Ruby? Eller spiller det ingen rolle?

A

Bruk dobbel
$ puts “Hello #{name}”
$ puts ‘Hello #{name}’

Andre linje i denne kommandoen vil ikke fungere

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

Hva kalles prosenttegnet i formelen under?
Forklar hva handlingen gjør og hvorfor det blir som det blir.

12 % 5 = 2

A
% = Modulus.
Deler venstre (a) på høyre og returnerer det som er igjen. 

12 % 5 = 2

5 går 2 ganger i 12 og da er det 2 igjen ( 12 - 10)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
32
Q
Hva er forskjellen på:
==	
og 
=== 
?
A

a == a
== // Sjekker om det er det samme på begge sider.
Hvis, ja true. Hvis ikke, false.
=== // brukes for å teste likhet når det er innenfor en when eller case-statement

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
33
Q
\+=
-=
*=
/=
%= 

Hva har disse operatørene til felels?

A

Alle kommandoene gjør en handling OG legger det til i totalen

a+=  // legger til a, i a og oppdaterer a med ny totalsum
a-=  // trekker fra a i a, og oppdaterer a med ny totalsum
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
34
Q

Hva gjør denne operatøren?
||

a = "projects"
b = "parts"

Hva returneres her?
$ a || b

A

= > projects

Eksempel:
if first expression is not nil or false, return it
if first expression is nil or false, return the second expression

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

Skal en class ha stor eller liten forbokstav?

A

Stor!

$ class Dick

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

Ruby:

$ class House
$    end

$ house = House.new // Hva gjør denne kommandoen?

A

Skaper en ny instance av House classen og lagrer den i en local variabel med navn house.

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

Ruby - i kommandoen under, hva er constructor method?

class House  
  def initialize(color, windows)
    @color = color
    @windows = windows
  end
end
A

initialize

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

Hva er MVC en forkortelse for, og hva kan det beskrive som i korte trekk? De 4 deler er?

A
  • Model View Controller
  • En modell for utvikling av web-applikasjoner bestående av 4 deler:
    View - Controller - Model - Database
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
39
Q

hva er en URI?

A

En URI kan bli klassifisert som en lokator (URL) eller et navn (URN) eller begge deler (URI)

https://upload.wikimedia.org/wikipedia/commons/thumb/f/ff/URI_Venn_Diagram.svg/250px-URI_Venn_Diagram.svg.png

40
Q

Hva er en ERD?

A

Entity relationship diagram -

Et skjema / tabel som viser hvordan ulike tabeller i en database henger sammen og har forbindelser med hverandre

41
Q

Hva er de tre basis-elementene i en ERD?

A

Entities, Atributes og relationships.

Entities are the “things” for which we want to store information.
An entity is a person, place, thing or event.

Attributes are the data we want to collect for an entity.

Relationships describe the relations between the entities.

42
Q

Hva er params?

A

Params er et key/value par assigned til en variabel som kalles params - den kommer fra browser gjennom get, query, post form eller del av en URL

43
Q

Kan Params brukes til å vise / skjule innhold på en web-side?

44
Q

Hva gjør denne kommandoen?

$ rake -T

A

Viser en slags oversikt over tilgjengelige rake-kommandoer

45
Q

Hva er acceptence test?

A

En test som sjekker hele stacken. Etterligner en bruker som kliceker på stedet og gjennomfører handlinger

46
Q

Hva er en integrasjons test?

A

Test som sjekker to eller flere deler med code og sjekker om det fungerer sammen.

47
Q

Hva gjør følgende kommando?

$ rake db:migrate

A

Kjører migration som ikke har blitt kjørt enda.

48
Q

Hva er en unit test?

A

Tester en del av koden for å se om det kan fungere for seg selv.

49
Q

Hva er capybara?

A

Et test framework for acceptencetest i.

50
Q

Hva er en gem?

A

En gem package er en module/bibliotek som du kan installere, små plugins.

51
Q

Hva er rake?

A

Rake er verktøy - task runner som brukes med ruby. Verktøy fordi det kommer med biblioteker som kan brukes for å gjøre “vanlige” oppgaver som å bygge databaser og gjøre tester.

52
Q

Ruby on rails:

Hva er routes?

A

Routes er det som styrer hvordan URLen oppfører seg.

Gjøres via config/routes.rb

53
Q

Hvordan kommentere ut med knapper?

A

cmd + option + 7

som jeg har satt selv

54
Q

Hva heter det når man har lagt til en forkortelse for “Git” i terminal?

55
Q

Hva menes med å holde koden DRY?

A

Don’t repeat yourself

56
Q

Hva er Rails console ?

$ rails console

A

Tilsvarer IRB med ruby filen loaded

57
Q

Hva gjør følgende kommando?

$ c.methods.grep /messages/

A

Viser alle methoder som inneholder ordet messages

58
Q

What is MVP?

A

Minimum viable product

Et minimun av produktet som kun den nøkkelfunksjonaliteten som muliggjør at produktet kan brukes og ingen annen funksjonalitet

59
Q

What do this command do?

$ bundle exec rails generate cucumber:install

A

This will generate Cucumber configuration files and set up the database for Cucumber tests.

60
Q

In ruby on rails, what part of the MCV contains the “smart” domain objects such as Account, Product, Person, Post?

61
Q

In RoR, what part of the MCV handles the incoming requests such as Save New Account, Update Product, Show Post?

A

The controller

62
Q

Hva er et API ?

A

Application programming interface - er et grensesnitt i en programvare som gjør at spesifikke deler av denne kan aktiveres («kjøres») fra en annen programvare.

63
Q

RoR:

In which folder do you find the subfolder named ‘view’?

64
Q

What are the three layers of the Three-Tier Architecture?

A

Presentation
Data
Logic

65
Q

RoR:

What use do the gem Devise have?

A

Create user autentication.

66
Q

What info does the coveralls give us about our application?

A

Shows which parts of the code which is and is not covered by test suite.

67
Q

What is continious integration?

A

The process of automating the build and testing of code every time a team member commits changes to version control.

You can detect errors quickly, and locate them more easily.

68
Q

What is continious deployment?

A

Continuous Deployment (CD) is the process that takes validated Features from Continuous Integration and deploys them into the production environment, where they are tested and readied for release.

69
Q

RoR:

Why should you use the bootstrap Gem instead of CDN when in comes to bootstrap?

A

Short: It’s faster and offline support.

  • The vendor assets is being stored localy to your rails app meaning whenever we request something to the vendor’s assets it will be much faster since it is stored localy compare to cdn which is requesting via the internet.
  • When we access the rails app offline the gems installed to the app is also available rather than cdn that can’t give requests and response when offline
70
Q

Whats the purpose of .gitignore?

A

It’s a list of files you want git to ignore in your work directory.

.gitignore itself is vissible on github, but the files listed here will not be uploaded to github.

71
Q

What’s do the gem ‘launchy’ help us with?

A

Debugger - helps us launch when testing to get a visual of exactly how the page looks.

72
Q

What do the dotenv gem help us with?

A

Let’s you load info from .env into “ENV” in a development file.

For example: Spotify API keys

73
Q

What does the following command do?

$ rails server

A

The rails server command launches a web server named Puma which comes bundled with Rails. You’ll use this any time you want to access your application through a web browser.

74
Q

Pull requests:

Is it preferable to do one large PR og several PRs with less changes?

A

Several small ones are easier to review.

75
Q

Why should you go:
$ git pull upstream developbranch //
before you create a new branch to work on a feature?

A

To make sure that your base when you start working on a new feature is the same as in the main branch

76
Q

Hva er TypeScript?

A

Et slags utvidelse av JavaScript som giver mulighed for at angive typer i koden og definere klasser, interfaces og moduler. Compiler genererer Typescript til JavaScript.

77
Q

How do the “any” type in Typescript work?

A

Allowing you to opt-in and opt-out of type-checking during compilation.

Eksempel:
let notSure: any = 4;
notSure = “maybe a string instead”;
notSure = false; // okay, definitely a boolean

78
Q

Hva gjør NgModule?

A

NgModules configure the injector and the compiler and help organize related things together.

An NgModule is a class marked by the @NgModule decorator

79
Q

Hva står Ng for i NgModule ?

80
Q

Angular:

Hva gjør Components ?

A

Angular 4 components are simply classes that are designated as a component with the help of a component decorator.

Every component has a defined template which can communicate with the code defined in the component class.

81
Q

Angular:

Hva skal du skrive for å starte server og hva er adressen?

A

$ ng serve

http://localhost:4200

82
Q

Hva heter root-modulen i Angular, og hvor finnes den?

A

AppModule

src/app/app.module.ts

83
Q

Er Angular Modules og JavaScript modules beslektet?

84
Q

Angular:

How do add a component to a view?

A

$ ng generate component navnpåkomponent

85
Q

When should you edit the db/schema.rb ?

A

Never - If you do there is trouble. They are not designed to be edited, they just represent the current state of the database.

86
Q

For web applications we use acceptance tests/ feature specs. What do we use for testing APIs ?

A

Request Specs

87
Q

Ionic is a web framework for what?

A

Mobile (web) applications

88
Q
  • Setup
  • Exercise
  • Verify
  • Teardown
    is the 4 stages for… ?
89
Q

Angular:

Where in the file structure is the component file located?

A

src/app/application.component.ts

90
Q

Hva er CRUD et akronym for?

A
Create - read - update - delete
// 
Describes user interface levels of most applications
91
Q
Naming methods (urls)
Should you use nouns or verbs?
A
nouns are good - verbs bad 
//
92
Q

Hva er kommandoen for å få preview i Ionic ?

A

$ ionic serve –lab

93
Q

RoR:
Hva er dette et eksempel på?

get ‘books/:id’ => ‘books#show’

94
Q

What does the following command do in Ionic?

$ ionic g page calculator

A

generates a new page in ionic named calculator (and a folder)

95
Q

i terminal: IRB
hva gjør følgende kommando?
$ ruby twitter.rb

A

kjører twitter.rb-filen (fint uten å måtte gå gjennom IRN

96
Q

ROR

Hva er en module?

A

Modules are a way of grouping together methods, classes, and constants. Modules give us two major benefits:

Modules provide a namespace and prevent name clashes.
Modules implement the mixin facility.

module Human
attr_accessor :name, :height, :weight

   def run
      puts self.name + " runs"
   end
end
**********