ProjectFirstPart - itzjac/cpplearning GitHub Wiki

  • array boundaries

  • conditional statements, if, nested , "C++ interprets positive numbers as true and negative numbers as false" Wrong!

  • game logic problem with memory. Suppose you have a game where the monster population fluctates, and you constantly want to minimize the amount of memory your program is using. Which technique do you use? Dynamic memory

  • Code analysis, how many times the loop executes

    for (int i = 1; x > 0; ) { switch( x ) { case 1: x++; break: case 2: x *= x; break; case 3: x += x; break; case 4: x = -1; break; default: x=0; } }

  • Code analysis with while

    int x = 2; while ( x < 7 ) { x++; if (x == 4 ) x =7; else x += 2; }

  • Legal function declaration

  • Code analysis undefined behavior compounded operation int x; x+= 3;

  • Code analysis, variable scope in functions

  • Arrays and pointer arithmetic

  • Code analysis, statement about errors in a program (memory leak for instance)

  • Code analysis, sizeof operator applied on arrays

  • Code analysis, describe algorithm of a function (copying array, comparing array, etc)

  • Code analysis, simple loop program and result of arithmetic problems

  • C++ operation (ternary operation, extration, insertion, etc)

  • Code analysis, legal code? const pointer, const pointer to const variable

  • True or False, function signature, you can overload a function by differing the return type? NO

  • random numbers and ranges [-17, 6]

  • Code analysis, undefined behavior

  • Code analysis, output of a program with undefined behavior on cout

  • Code analysis, memory leak?

  • continue, break, return instruction inside loops

  • Code analysis, function by reference

  • Code analysis, arrays const char* s[4] = { {"abcd"},... };

  • Code analysis, unary operator and cout. the output of the following program is "x: 10, i: 11"

    int main() { int x, i; i = 10; x = i++; std::cout << "x: " << x; std::cout << "i: " << i << std::endl; return 0; }

  • Code analysis, boolean expression evaluation