Nội dung đề thi: oon thi c++
Xem trước 25/61 câu hỏi trong đề.
Bấm Vào thi để làm bài trực tuyến, được chấm điểm và xem đáp án chi tiết.
Câu 1. Who is the creator of the C++ programming language?
- A. Dennis Ritchie
- B. Bjarne Stroustrup
- C. James Gosling
- D. Guido van Rossum
Câu 2. What type of programming language is C++?
- A. Functional Programming Language
- B. Logic Programming Language
- C. Object-Oriented Programming Language
- D. Procedural Programming Language
Câu 3. What is the importance of the "main" function in a C++ program?
- A. It is used to start and end the program execution
- B. It is used to declare variables
- C. It is used for exception handling
- D. It is used for input/output operations
Câu 4. How does C++ improve upon the features of the C language?
- A. By including classes and objects
- B. By removing the need for semi-colons
- C. By providing a graphical interface
- D. By making all variables global
Câu 5. Can you explain the differences between procedural and object-oriented programming, and where does C++ fit in?
- A. Procedural programming is based on objects while object-oriented programming is based on procedures; C++ is a procedural language
- B. Procedural programming is based on procedures while object-oriented programming is based on objects; C++ is a procedural language
- C. Procedural programming is based on procedures while object-oriented programming is based on objects; C++ is an object-oriented language
- D. Procedural programming and object-oriented programming are the same; C++ is a hybrid language
Câu 6. C++ supports both _______ and _______ programming paradigms.
- A. Object-Oriented, Functional
- B. Procedural, Logic
- C. Procedural, Object-Oriented
- D. Functional, Logic
Câu 7. The extension ".cpp" is typically used for C++ _______ files.
- A. Executable
- B. Object
- C. Source Code
- D. Header
Câu 8. In C++, the term _______ refers to the process of binding data and the functions operating on the data together in an entity.
- A. Encapsulation
- B. Inheritance
- C. Polymorphism
- D. Concurrency
Câu 9. The C++ standard library includes the _______ library, which was derived from the C standard library.
- A. Standard Template Library (STL)
- B. Input Output Stream (iostream)
- C. Boost
- D. POSIX
Câu 10. C++ uses _______ and _______ to handle memory allocation and deallocation.
- A. new, delete
- B. malloc, free
- C. int, float
- D. #include, using
Câu 11. Imagine you're working on a legacy C project and you're asked to transition it to C++. What would be your first steps and what potential challenges would you anticipate?
- A. Begin by renaming all files to .cpp, then introduce classes
- B. Begin by refactoring the entire code, then compile with a C++ compiler
- C. Begin by replacing all functions with methods, then refactor the data types
- D. Begin by analyzing the code, determining dependencies, introducing classes gradually, refactor the code progressively
Câu 12. You have a C++ application that is suffering from frequent crashes. After investigation, you suspect memory leaks. How would you go about diagnosing and fixing this issue?
- A. Use a memory profiler, identify leaks, patch the code
- B. Restart the application periodically
- C. Increase the memory available to the application
- D. Ignore it if the application is not critical
Câu 13. You're tasked with optimizing a CPU-intensive C++ application. What strategies would you consider, and why?
- A. Use a profiler to identify bottlenecks, optimize algorithms, consider parallelization
- B. Buy a faster CPU
- C. Reduce the input size
- D. Upgrade to the latest C++ version
Câu 14. What is the significance of a semicolon ';' in C++?
- A. It denotes the end of a statement
- B. It separates parameters in a function
- C. It indicates a comment
- D. It is used to access members of a structure or class
Câu 15. In C++, how is the beginning of a comment denoted?
- A. Using the symbol '#'
- B. Using the symbol '@'
- C. Using the symbols '/*' for multi-line comments and '//' for single-line comments
- D. Using the symbols '{}'
Câu 16. How do you define a variable in C++?
- A. data_type variable_name;
- B. variable_name data_type;
- C. variable_name = data_type;
- D. data_type = variable_name;
Câu 17. Can you explain the difference between '==' and '=' in C++?
- A. '==' is used for assignment, '=' is used for comparison
- B. '==' is used for comparison, '=' is used for assignment
- C. '==' and '=' are used interchangeably in C++
- D. '==' and '=' have no use in C++
Câu 18. What will happen if in a C program you assign a value to an array element whose subscript exceeds the size of array?
- A. The element will be set to 0.
- B. The program may crash if some important data gets overwritten.
- C. The compiler would report an error.
- D. The array size would appropriately grow.
Câu 19. A _______ is a group of statements that is executed as one unit in C++.
- A. Block
- B. Array
- C. Comment
- D. Variable
Câu 20. In C++, 'if', 'while', 'for' are examples of _______ statements.
- A. Control flow
- B. Assignment
- C. Iteration
- D. Concatenation
Câu 21. The _______ statement in C++ is used to handle the dynamic allocation of memory.
- A. new
- B. delete
- C. return
- D. throw
Câu 22. A C++ program always begins execution at the _______ function.
- A. main
- B. start
- C. execution
- D. init
Câu 23. You've inherited a large C++ codebase that lacks consistency in its coding style. How would you improve the readability and maintainability of the code?
- A. Implement a coding standard, refactor code for consistency, document functions and classes, use meaningful variable and function names
- B. Change all variable names to single letters for brevity
- C. Translate the code into another programming language
- D. Delete all comments to reduce code size
Câu 24. You are given a task to refactor a complex nested if-else structure in a C++ program to make it more understandable and efficient. How would you approach this task?
- A. Break down the structure into smaller functions, use switch-case statements where appropriate, use lookup tables or polymorphism for more efficiency
- B. Increase the number of nested if-else statements
- C. Use only 'if' statements, removing all 'else' statements
- D. Refactor the entire program to remove all conditional statements
Câu 25. What is the C++ statement to print text to the console?
- A. cout
- B. print "Text";
- C. console.log("Text");
- D. printf("Text");
… và còn 36 câu nữa.
Bấm Vào thi phía trên để làm toàn bộ 61 câu và xem đáp án.