1/128
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
|---|
No study sessions yet.
Front
Back
"What is the datatype of z after executing: double x = 1
y = 2; auto z = x + y;"
"Which of the following are preprocessing directives?"
"#include
"What is the final value of c in this code: int a = 1
b = 2; int c = a + b++; int d = a + ++b;"
"In C++ must functions be defined within classes?"
"False - Functions can be defined outside of classes as standalone functions."
"Which is an example of a function declaration/prototype/header?"
"int my_function(int
"What is the final value of y in: int x = 2
y; y = x++ + x + x;"
"What library must you include to use cin and cout?"
"
"What are makefiles used for?"
"Makefiles can include commands to compile a program from source code files
"What is a JOB in Jenkins?"
"A task or set of instructions that you want to automate in the Jenkins continuous integration system."
"What is GitHub?"
"A place for you to upload and maintain programming code
"What is the 'target' in a makefile?"
"A rule that contains some instructions
"What are the three different types of version control systems?"
"Local
"In a makefile with CC = g++ and OBJS = eval.o main.o
what is 'myprogram' in: $(CC) -o myprogram $(OBJS)?"
"Can you use conditionals in makefiles?"
"True - Makefiles support conditional statements for build logic."
"What is one benefit of separate compilation?"
"The ability to compile a program modularly and not have to recompile the entire program any time a change is made."
"In a makefile for compiling dtime.cpp and timedemo.cpp
what should fill blanks d) and e) in: timedemo.o : d)_ timedemo.h g++ -c e)_?"
"What happens when you commit something in git?"
"All content marked to be synchronized is committed as a snapshot to the primary git repo."
"Which is NOT a benefit of version control systems?"
"Immediate access to data - This is not typically listed as a primary benefit of version control."
"In a makefile
what should fill blanks a) and b) in: timedemo : a)_ b)_ g++ -c dtime.o timedemo.o -o timedemo?"
"What is the default filename the make utility looks for when you type 'make' without parameters?"
"Makefile - This is the default filename that make searches for."
"In C++ are you only allowed to have one constructor (no constructor overloading)?"
"False - C++ supports constructor overloading
"For file I/O with ifstream
what goes in blank 1) in: int a
"Where does a clause end in C++ (public
private
"What must you end your class or struct definition with?"
"A semi-colon - Class and struct definitions must end with a semicolon."
"For file I/O reading values a
b
"Can structs have constructors and destructors in C++?"
"True (the statement 'structs cannot have constructors and destructors' is False) - In C++
"If writing an implementation file for class 'Myclass' defined in 'myclass.h'
what should be included?"
"What is a stream in C++?"
"A stream represents some kind of input/output
"What is the default access modifier of a class in C++?"
"Private - Class members are private by default in C++."
"What is a destructor used for in C++?"
"To release memory allocated in the heap for one or more variables in the struct/class
"What part of memory is a pointer pointing to when using 'new'?"
"Heap - Dynamic memory allocation with 'new' allocates memory on the heap."
"What will line 15 print: double stuff[100]; double *p; p = stuff; for (i=0;i<100;i++) stuff[i] = i; cout << *(p + 5) << endl;?"
"5 - Pointer arithmetic: p points to stuff[0]
"Is a reference type exactly like a pointer except for the way you use it in the code?"
"False - References and pointers have fundamental differences beyond syntax (references cannot be null
"What happens with: int y = 22; int &x; x = y; cout << x << endl;?"
"You get a compile error because you have to initialize a reference variable when you declare it."
"If line 12 prints address 0x168 for &stuff
what will line 13 print for p (where p = stuff)?"
"What is printed on line 4: int y = 22; int &x = y; x = 25; cout << y << endl;?"
"25 - Since x is a reference to y
"Is a pointer a data type?"
"True - Pointer is a data type that stores memory addresses."
"What does it mean to dereference a pointer?"
"To go to the address the pointer is storing and work with data at that address
"Given structtype1 s1 and structtype1 * sptr = &s1
which statement initializes member1 of s1 to 22?"
"Given structtype1 s1 and structtype1 * sptr = &s1
which statement initializes member2 of s1 to 22 using the pointer?"
"What is preprocessing in C++?"
"The preprocessing phase handles directives like #include and #define before actual compilation begins."
"What is the purpose of the #include directive?"
"To include the contents of another file (typically header files) into the current file during preprocessing."
"What does 'using namespace' do?"
"It allows you to use names from a namespace without prefixing them with the namespace name."
"What is the difference between b++ and ++b?"
"b++ (post-increment) returns the current value then increments; ++b (pre-increment) increments first then returns the new value."
"What is auto keyword in C++?"
"auto allows the compiler to automatically deduce the type of a variable from its initializer."
"What is the purpose of function prototypes?"
"Function prototypes declare the function signature before its implementation
"What library provides file stream functionality?"
"
"What is separate compilation?"
"A technique where different parts of a program are compiled independently into object files
"What is an object file?"
"A compiled but not yet linked file (typically .o extension) containing machine code that needs to be linked with other object files."
"What is the purpose of the -c flag in g++?"
"The -c flag tells g++ to compile to object code without linking."
"What is the purpose of the -o flag in g++?"
"The -o flag specifies the name of the output file (executable or object file)."
"What does CC typically represent in a makefile?"
"CC is a variable that typically stores the compiler command (e.g.
"What does OBJS typically represent in a makefile?"
"OBJS is a variable that typically stores a list of object files needed for linking."
"What is the purpose of git add?"
"git add stages changes to be included in the next commit."
"What is the purpose of git push?"
"git push uploads local repository content to a remote repository."
"What is the purpose of git pull?"
"git pull fetches and merges changes from a remote repository to the local repository."
"What is a local version control system?"
"A VCS that maintains versions in a local database on a single computer."
"What is a central version control system?"
"A VCS with a single central server that stores all versions
"What is a distributed version control system?"
"A VCS where every user has a complete copy of the repository history on their local machine."
"What is ifstream used for?"
"ifstream (input file stream) is used for reading from files."
"What is ofstream used for?"
"ofstream (output file stream) is used for writing to files."
"What is the open() method used for in file streams?"
"The open() method opens a file and associates it with a stream object."
"What is the close() method used for in file streams?"
"The close() method closes the file associated with a stream
"What is the >> operator used for with streams?"
"The >> (extraction operator) reads formatted input from a stream."
"What is the << operator used for with streams?"
"The << (insertion operator) writes formatted output to a stream."
"What are the three access modifiers in C++?"
"public
"What does public access modifier mean?"
"public members are accessible from anywhere the object is accessible."
"What does private access modifier mean?"
"private members are only accessible within the class itself."
"What does protected access modifier mean?"
"protected members are accessible within the class and by derived classes."
"What is the default access modifier for struct members?"
"public - Struct members are public by default."
"What is constructor overloading?"
"Having multiple constructors with different parameter lists in the same class."
"What is a default constructor?"
"A constructor that takes no arguments
"What is a parameterized constructor?"
"A constructor that takes one or more parameters to initialize object data."
"When is a destructor called?"
"A destructor is called when an object goes out of scope or is explicitly deleted."
"What is the syntax for declaring a destructor?"
"~ClassName() - The destructor has the same name as the class with a tilde (~) prefix."
"What does 'new' operator do in C++?"
"'new' allocates memory dynamically on the heap and returns a pointer to the allocated memory."
"What does 'delete' operator do in C++?"
"'delete' deallocates memory previously allocated with 'new'
"What is a memory leak?"
"Memory that is allocated but never freed
"What is the difference between stack and heap memory?"
"Stack memory is automatically managed with fixed size; heap memory is manually managed and can grow dynamically."
"What is pointer arithmetic?"
"Operations on pointers (like p+1
"What does NULL or nullptr represent?"
"A special pointer value indicating that the pointer doesn't point to any valid memory location."
"What is the address-of operator in C++?"
"The & operator
"What is the dereference operator in C++?"
"The * operator
"What is the arrow operator in C++?"
"The -> operator
"What is the difference between array[i] and *(array+i)?"
"They are equivalent - both access the element at index i in the array."
"What happens if you dereference an uninitialized pointer?"
"Undefined behavior - likely a segmentation fault or garbage values."
"What happens if you delete the same pointer twice?"
"Undefined behavior - this is called double-free and can cause program crashes."
"Can you change what a reference refers to after initialization?"
"No - once a reference is initialized
"Can you change what a pointer points to after initialization?"
"Yes - pointers can be reassigned to point to different memory locations."
"Can a reference be null?"
"No - references must always refer to a valid object."
"Can a pointer be null?"
"Yes - pointers can have the value NULL or nullptr."
"What is pass-by-value?"
"Passing a copy of the argument to the function; changes don't affect the original."
"What is pass-by-reference?"
"Passing a reference to the argument; changes affect the original variable."
"What is pass-by-pointer?"
"Passing a pointer to the argument; allows indirect modification of the original."
"What is the purpose of const with pointers?"
"const can make the pointer constant
"What does 'const int* ptr' mean?"
"Pointer to constant int - the int value cannot be changed through ptr
"What does 'int* const ptr' mean?"
"Constant pointer to int - ptr always points to the same location
"What does 'const int* const ptr' mean?"
"Constant pointer to constant int - neither the pointer nor the pointed-to value can be changed."
"What is encapsulation?"
"Bundling data and methods that operate on that data within a single unit (class)