1/32
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.
Linux commands: Print current working directory
pwd
Linux commands: What does “pwd” do?
Shows where you are like /home/sam
Linux commands: List files and folders here
ls
Linux commands: Change directories
cd
Linux commands: How would I move into another folder?
cd filename
Linux commands: Go to a path from the top
absolute path
Linux commands: Go to a path from where you are
relative path
Linux commands: Make a new directory
mkdir
Linux commands: How would I make a new directory?
mkdir newfoldername
Linux commands: What is the difference between touch and vim?
touch = make an empty file. vim = open an editor to write in a file.
Linux commands: Create a new empty file
touch
Linux commands: Open an editor
vim
Linux commands: Copy files
cp
Linux commands: How would I copy a file?c
cp originalname newname
Linux commands: Move or rename files
mv
Linux commands: How would I move my file?
mv filename newfoldername/
Linux commands: How would I rename a file?
mv originalname newname
Linux commands: Compile C++
g++
Linux commands: Execute C++
./
Linux commands: Create a typescript
script
Linux commands: End a typescript
exit
Valid/Invalid C++:
void f(int &n);
f(5);
Invalid. A reference needs a variable and 5 isn’t a box.
Valid/Invalid C++:
void f(int n);
f(5);
Valid. A copy can take any value.
Valid/Invalid C++:
void f(const int &n);
f(5);
Valid. const & can accept a plain value.
Valid/Invalid C++:
void show(int a, b);
Invalid. Every parameter needs its own type. int a, int b
Valid/Invalid C++:
voidf()
{
return 5;
}
Invalid. A void function cannot return a value.
Valid/Invalid C++:
WHERE F IS VOID
int x = f();
Inavlid. There is no value to store because void functions do not return values.
Valid/Invalid C++:
WHERE THIS IS A FUNCTION PROTOTYPE
int sq(int);
Valid. A parameter name is optional in a prototype.
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.
Valid/Invalid C++:
int a[3] = {1, 2, 3};
Valid.
Valid/Invalid C++:
int a[3] = {1, 2, 3, 4};
Invalid. Too many values for the size.
Valid/Invalid C++;
int a[] = {1, 2, 3};
Valid. The size is worked out from the list.