Engineering C++ - Quiz
  • 1. When is buffer overflow possible to have in your C++ code?
A) When the programs does not return a value
B) When the program generates the wrong output
C) When the length of some input data is not correctly checked
D) When the program doesn’t compile
  • 2. An attacker enters a long string into the date field. The input overwrites parts of the running program and executes commands on the server. What type of attack just took place?
A) Buffer Overflow Attack
B) SQL Injection Attack
C) Phishing Attack
D) Cross Site Scripting Attack
  • 3. In a buffer overflow attack…
A) The program doesn’t compile
B) The program doesn’t return a value
C) The program generates the wrong input
D) The input takes more space than allocated
  • 4. How do you avoid a buffer Overflow?
A) Use functions that take a lesser length
B) Use functions that take a maximal length
C) Use SQL script
D) Use PHP script
  • 5. If you don’t secure your code what can happen?
A) Someone can inject code directly into your system
B) Someone can leave helpful comments
C) Someone can fix your code
D) Someone can add code to your program
  • 6. In a buffer overflow attack, the input takes _____ ______ than allocated for the variable.
A) more space
B) int and strings
C) double numbers
D) real numbers
  • 7. Which of the following is the correct operator to compare two variables?
A) =
B) equal
C) :=
D) ==
  • 8. What is an undeclared variable?
A) Source Code
B) A variable that ends with a semicolon
C) Programs do not return a value
D) A variable that you didn’t declare
  • 9. What is PC-Lint?
A) An Source Code Tool
B) A Static Analysis Tool for C/C++
C) An IDE
D) A C/C++ Compiler
  • 10. When an input is carefully crafted, it lets the attacker do what?
A) Run new codes of his or her choice
B) Run commands of his or her choice
C) Run new choices of his or her choice
D) Run comments of his or her choice
  • 11. Which is another name for buffer overflow?
A) Buffer Over the Top
B) Buffer Overrun
C) Buffer Overdraft
D) Buffer Overkill
  • 12. Buffer overflow can be triggered by what?
A) Memory
B) Outputs
C) Tags
D) Inputs
  • 13. Which is not a type of Loop?
A) If-Else
B) While
C) For
D) Do-While
  • 14. PC-Lint is for what language?
A) C#
B) Java
C) C++
D) .Net
  • 15. A Do While loop is useful for…
A) 1 choice
B) reversed
C) multiple choices
D) to loop once
  • 16. What accounts for most security breaches?
A) Inheritance
B) Buffer Overflow
C) Virus
D) SQL Injections
  • 17. To avoid buffer overflow you should avoid what?
A) vscanf() and stmcat()
B) stmcpy() and smcatt()
C) strcpy() and strcat()
D) spinf() and typdef()
  • 18. Which of these are not types of Buffer Overflow?
A) Format String
B) Heap Overflow
C) Stack Overflow
D) Buffer Overturn
  • 19. What is the only function all C++ programs must contain?
A) program()
B) system()
C) main()
D) start()
  • 20. What punctuation ends most lines of C++ code?
A) ;(semi-colon)
B) ‘(single quote)
C) :(colon)
D) .(dot)
Created with That Quiz — the site for test creation and grading in math and other subjects.