Programming Foundantions 1 - Final Exam

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/32

flashcard set

Earn XP

Description and Tags

This set focuses on what can be studied through recall for the exam.. Some questions here too. With a focus on linux commands, functions, arrays, stream/input files, constructor classes, pointers, and overall object orientation.

33 Terms

1
New cards

Linux commands: Print current working directory

pwd

2
New cards

Linux commands: What does “pwd” do?

Shows where you are like /home/sam

3
New cards

Linux commands: List files and folders here

ls

4
New cards

Linux commands: Change directories

cd

5
New cards

Linux commands: How would I move into another folder?

cd filename

6
New cards

Linux commands: Go to a path from the top

absolute path

7
New cards

Linux commands: Go to a path from where you are

relative path

8
New cards

Linux commands: Make a new directory

mkdir

9
New cards

Linux commands: How would I make a new directory?

mkdir newfoldername

10
New cards

Linux commands: What is the difference between touch and vim?

touch = make an empty file. vim = open an editor to write in a file.

11
New cards

Linux commands: Create a new empty file

touch

12
New cards

Linux commands: Open an editor

vim

13
New cards

Linux commands: Copy files

cp

14
New cards

Linux commands: How would I copy a file?c

cp originalname newname

15
New cards

Linux commands: Move or rename files

mv

16
New cards

Linux commands: How would I move my file?

mv filename newfoldername/

17
New cards

Linux commands: How would I rename a file?

mv originalname newname

18
New cards

Linux commands: Compile C++

g++

19
New cards

Linux commands: Execute C++

./

20
New cards

Linux commands: Create a typescript

script

21
New cards

Linux commands: End a typescript

exit

22
New cards

Valid/Invalid C++:

void f(int &n);

f(5);

Invalid. A reference needs a variable and 5 isn’t a box.

23
New cards

Valid/Invalid C++:

void f(int n);

f(5);

Valid. A copy can take any value.

24
New cards

Valid/Invalid C++:

void f(const int &n);

f(5);

Valid. const & can accept a plain value.

25
New cards

Valid/Invalid C++:

void show(int a, b);

Invalid. Every parameter needs its own type. int a, int b

26
New cards

Valid/Invalid C++:

voidf()

{

return 5;

}

Invalid. A void function cannot return a value.

27
New cards

Valid/Invalid C++:

WHERE F IS VOID


int x = f();

Inavlid. There is no value to store because void functions do not return values.

28
New cards

Valid/Invalid C++:

WHERE THIS IS A FUNCTION PROTOTYPE


int sq(int);

Valid. A parameter name is optional in a prototype.

29
New cards

Valid/Invalid C++:

int sq(int x)

{

return x * x;

}


sq();

Invalid. The argument is missing when the function is called. IE the parentheses empty.

30
New cards

Valid/Invalid C++:

int a[3] = {1, 2, 3};

Valid.

31
New cards

Valid/Invalid C++:

int a[3] = {1, 2, 3, 4};

Invalid. Too many values for the size.

32
New cards

Valid/Invalid C++;

int a[] = {1, 2, 3};

Valid. The size is worked out from the list.

33
New cards