Nguồn: Click here
  1. What is the difference between a variable and a constant in C?

    A variable is a storage location that can hold different values at different times, while a constant is a fixed value that cannot be changed.

  2. What is the difference between a global variable and a local variable in C? 

    A global variable is a variable that is declared outside of any function and can be accessed by any function in the program. A local variable is a variable that is declared inside a function and can only be accessed within that function.

  3. What is the difference between a #define and a const in C?  

    #define is a preprocessor directive that is used to define a constant value, while const is a keyword that is used to define a variable as a constant.

  4. What is the difference between a while loop and a for loop in C? 

    A while loop repeatedly executes a block of code as long as a given condition is true, while a for loop is used to execute a block of code a specific number of times.

  5. What is the difference between a switch statement and an if-else statement in C?

    A switch statement is used to execute a block of code based on the value of a single expression, while an if-else statement is used to execute a block of code based on the evaluation of one or more conditions.

  6. What is the difference between a pointer and an array in C?

    A pointer is a variable that stores the memory address of another variable, while an array is a collection of variables of the same type.

  7. What is the difference between call by value and call by reference in C?

    In call by value, a copy of the value of a variable is passed to a function, while in call by reference, the memory address of a variable is passed to a function.

  8. What is the difference between a struct and a union in C?

    A struct is a collection of variables of different types, while a union is a collection of variables of the same type.

  9. What is the difference between the ++ and -- operators in C?

    The ++ operator increments the value of a variable by 1, while the -- operator decrements the value of a variable by 1.

  10. What is the difference between the = and == operators in C?

    The = operator is used to assign a value to a variable, while the == operator is used to compare the values of two variables.

  11. What is the difference between the & and && operators in C?

    The & operator is a bitwise operator used to perform a bitwise AND operation, while the && operator is a logical operator used to perform a logical AND operation.

  12. What is the difference between the | and || operators in C?

    The | operator is a bitwise operator used to perform a bitwise OR operation, while the || operator is a logical operator used to perform a logical OR operation.

  13. What is the difference between the * and -> operators in C?

    The * operator is used to dereference a pointer, while the -> operator is used to access a member of a struct through a pointer.

  14. What is the difference between the sizeof and strlen functions in C?

    The sizeof function returns the size of a variable or data type in bytes, while the strlen function returns the length of a string in characters.

  15. What is the difference between the malloc and calloc functions in C?

    The malloc function is used to allocate memory on the heap, while the calloc function is used to allocate

  16. What is the difference between C and C++?

    C is a procedural programming language, while C++ is a combination of both procedural and object-oriented programming languages.

  17. What is the purpose of the main() function in C?

    The main() function is the entry point of a C program, where the execution of the program begins.

  18. How do you define a variable in C?

    Variables in C are defined using the keyword int, float, double, char, or void followed by the variable name.

  19. What is the difference between #include and #define in C?

    The #include directive is used to include header files in a program, while the #define directive is used to define constants and macros.

  20. What is the difference between call by value and call by reference in C?

    Call by value passes a copy of the value of the variable to the function, while call by reference passes the memory address of the variable to the function.

  21. What is the difference between a while loop and a do-while loop in C?

    A while loop checks the condition before executing the loop, while a do-while loop executes the loop first and then checks the condition.

  22. What is the difference between a for loop and a while loop in C?

    A for loop has a built-in counter that increments or decrements after each iteration, while a while loop does not.

  23. What is the purpose of the break statement in C?

    The break statement is used to exit a loop or a switch statement.

  24. What is the purpose of the continue statement in C?

    The continue statement is used to skip the current iteration of a loop and move on to the next iteration.

  25. What is the difference between single quotes and double quotes in C?

    Single quotes are used to define a single character, while double quotes are used to define a string of characters.

  26. What is the difference between the == operator and the = operator in C?

    The == operator is used for comparison, while the = operator is used for assignment.

  27. What is the purpose of the sizeof operator in C?

    The sizeof operator is used to determine the size of a variable or data type in bytes.

  28. What is the purpose of the ternary operator in C?

    The ternary operator is used as a shorthand way of writing an if-else statement.

  29. What is the purpose of the switch statement in C?

    The switch statement is used to execute a block of code based on the value of a variable or expression.

  30. What is the purpose of the goto statement in C?

    The goto statement is used to transfer control to another part of the program.

  31. What is the difference between an array and a pointer in C?

    An array is a collection of variables of the same data type, while a pointer is a variable that holds the memory address of another variable.

  32. What is the purpose of the malloc() function in C?

    The malloc() function is used to dynamically allocate memory at runtime.

  33. What is the purpose of the free() function in C?

    The free() function is used to release memory that was dynamically allocated using the malloc() function.

  34. What is the purpose of the return statement in C?

    The return statement is used to exit a function and return a value to the calling function.