C and C++ Coding Flashcards
7 cards from real Online Coding Lessons practice questions. Tap to flip, then mark Knew It or Still Learning โ missed cards come back until you master them.
Read the first 7 C and C++ Coding flashcards as text
In C, what does a function declared with a 'void' return type indicate?
Answer: It returns no value
A void return type means the function does not return any value.
Which C++ concept lets two functions share a name but differ by parameter list?
Answer: Overloading
Function overloading allows multiple functions with the same name but different signatures.
What does the bitwise AND operator & produce for the operands 6 & 3 in C?
Answer: 2
Binary 110 AND 011 equals 010, which is 2.
In C++, what does the 'auto' keyword do in a variable declaration?
Answer: Deduces the type from the initializer
auto lets the compiler infer the variable's type from its initializer expression.
What is the purpose of the 'break' statement inside a C switch block?
Answer: Exit the switch to prevent fall-through
break exits the switch so execution does not fall through into later cases.
In C++, what does passing an argument by reference (using &) avoid compared to passing by value?
Answer: Copying the argument
Passing by reference avoids making a copy, operating directly on the original object.
Which loop in C is guaranteed to execute its body at least once?
Answer: do-while loop
A do-while loop checks its condition after the body, so it runs at least once.