This quiz works best with JavaScript enabled. Home > English Grammar > Grammar > Syntax > Syntax And Logic Errors – Quiz 1 🏠 Homepage 📘 Download PDF Books 📕 Premium PDF Books Syntax And Logic Errors Quiz 1 (43 MCQs) Quiz Instructions Select an option to see the correct answer instantly. 1. Which line contains a syntax error? A) Print("Hello"). B) Sprint("Hello"). C) Print("HELLO"). D) Print("hello"). Show Answer Correct Answer: B) Sprint("Hello"). 2. A program may never contain both syntax and logic errors A) True. B) False. C) All the above. D) None of the above. Show Answer Correct Answer: B) False. 3. What is the purpose of testing? A) To identify errors. B) To identify issues that may occur when a customer uses the program. C) To test the security of the program. D) All of the above. Show Answer Correct Answer: D) All of the above. 4. Which type of errors are easier to identify A) Syntax Error. B) Logic Error. C) All the above. D) None of the above. Show Answer Correct Answer: A) Syntax Error. 5. Syntax errors are always spotted when the program is compiled or interpreted. A) True. B) False. C) All the above. D) None of the above. Show Answer Correct Answer: A) True. 6. What is the correct way to check if the user input is between 1 and 3 in the while statement? A) Choice > 1 and choice < 3. B) Choice >= 1 and choice <= 3. C) Choice < 1 or choice > 3. D) Choice <= 1 or choice >= 3. Show Answer Correct Answer: B) Choice >= 1 and choice <= 3. 7. What is the purpose of the line 'choice = input('enter choice')' in the program? A) To initialize the choice variable. B) To prompt the user for a choice. C) To print the menu commands. D) To validate the user input. Show Answer Correct Answer: B) To prompt the user for a choice. 8. What type of error is the misspelling of 'print' as 'PRNT' in the program? A) Logic Error. B) Syntax Error. C) Semantic Error. D) Runtime Error. Show Answer Correct Answer: B) Syntax Error. 9. These types of errors can only be detected by the programmer themselves A) Syntax Error. B) Logic Error. C) All the above. D) None of the above. Show Answer Correct Answer: B) Logic Error. 10. What is the purpose of using strings for validation in the program? A) To make the program more complex. B) To make the program more efficient. C) To make the program run faster. D) To make the validation more robust. Show Answer Correct Answer: D) To make the validation more robust. 11. What is the main issue with the while loop's condition in the program? A) It doesn't run the program. B) It doesn't prompt the user. C) It accepts any input. D) It only accepts numbers. Show Answer Correct Answer: C) It accepts any input. 12. Print(Hello", name) A) Syntax Error. B) Logic Error. C) All the above. D) None of the above. Show Answer Correct Answer: A) Syntax Error. 13. A program won't run if there is a logic error. A) False. B) True. C) All the above. D) None of the above. Show Answer Correct Answer: A) False. 14. Using incorrect comparison operators such as < or > is an example of what type of error A) Syntax Error. B) Logic Error. C) All the above. D) None of the above. Show Answer Correct Answer: B) Logic Error. 15. What is the purpose of the line 'choice = 0' in the program? A) To validate the input. B) To initialize the choice variable. C) To print the menu commands. D) To save the game. Show Answer Correct Answer: B) To initialize the choice variable. 16. What is the flaw in the while loop that allows any value between 1 and 3 to be accepted as valid input? A) The use of 'and' instead of 'or'. B) The use of 'not' instead of 'and'. C) The absence of a while loop. D) The use of 'or' instead of 'and'. Show Answer Correct Answer: A) The use of 'and' instead of 'or'. 17. Modern IDEs are able to spot syntax errors as the programmer types. A) True. B) False. C) All the above. D) None of the above. Show Answer Correct Answer: A) True. 18. What type of error is the program experiencing when it doesn't present the user with the ability to enter a choice? A) Syntax Error. B) Semantic Error. C) Logic Error. D) Runtime Error. Show Answer Correct Answer: C) Logic Error. 19. Which statement best describes a logic error A) An error in a program caused by hardware failure. B) An error in the program caused by mis-spelt instructions. C) An error that produces incorrect outputs but not crash. D) An error that causes it to crash. Show Answer Correct Answer: C) An error that produces incorrect outputs but not crash. 20. Print("In 5 years time, you will be", age * 5) A) Syntax Error. B) Logic Error. C) All the above. D) None of the above. Show Answer Correct Answer: B) Logic Error. 21. If i in range(0, 2): A) Syntax Error. B) Logic Error. C) All the above. D) None of the above. Show Answer Correct Answer: B) Logic Error. 22. Logic errors are detected by the programming IDE being used. A) False. B) True. C) All the above. D) None of the above. Show Answer Correct Answer: A) False. 23. Which of these expressions will generate a logic error when the expected output is 10 A) Answer = (2 + 3) * 2. B) Answer = 2 + 3 * 2. C) Answer = 2 + 3 x 2. D) Answer = {2 + 3} * 2. Show Answer Correct Answer: B) Answer = 2 + 3 * 2. 24. What is the final step to make the program completely robust in terms of user input validation? A) Add a while loop. B) Change the inequality operators. C) Only accept values 1, 2, or 3. D) Accept any value between 1 and 3. Show Answer Correct Answer: C) Only accept values 1, 2, or 3. 25. What is a null value test on data entry? A) Data that is not entered in order to test how the program responds. B) Data that has a value of zero. C) Data that does not have a value such as a name or phone number. D) Data that is incorrect. Show Answer Correct Answer: A) Data that is not entered in order to test how the program responds. 26. Once a logical condition in an IF statement is TRUE, all other statements are are ignored A) True. B) False. C) All the above. D) None of the above. Show Answer Correct Answer: A) True. 27. What is the significance of the program running without errors at the end? A) It means there are no logic errors. B) It means the program is robust. C) It means there are no syntax errors. D) It means the program is perfect. Show Answer Correct Answer: A) It means there are no logic errors. 28. These types of errors are generally detected by the IDE A) Syntax Error. B) Logic Error. C) All the above. D) None of the above. Show Answer Correct Answer: A) Syntax Error. 29. What is the main issue with the program's validation of user input? A) It accepts invalid input. B) It doesn't run the program. C) It doesn't recognize the variable choice. D) It doesn't prompt the user to enter a choice. Show Answer Correct Answer: A) It accepts invalid input. 30. Syntax errors are caused by incorrectly typed source code. A) True. B) False. C) All the above. D) None of the above. Show Answer Correct Answer: A) True. 31. Using incorrectly named programming functions is an example of what type of error A) Syntax Error. B) Logic Error. C) All the above. D) None of the above. Show Answer Correct Answer: A) Syntax Error. 32. Go to:https://apclassroom.collegeboard.org/d/81ryd5zt11?sui=8, 1I will be checking if you watched the entire video.Select the statement that does NOT contain a syntax error. A) System.out.printl("Hello World");. B) System.out.println("Hello World");. C) System.out.println("Hello World"). D) System.out.println("hello world");. Show Answer Correct Answer: D) System.out.println("hello world");. 33. A program will compile if there is a syntax error. A) True. B) False. C) All the above. D) None of the above. Show Answer Correct Answer: B) False. 34. Which statement contains a syntax error A) Print("Hello"). B) PRINT("Hello"). C) Print("HELLO"). D) Print("hello"). Show Answer Correct Answer: B) PRINT("Hello"). 35. What is iterative testing? A) Testing completed after an error is found. B) Random tests on a computer program. C) Test completed as the program is being coded. D) Test which are planned. Show Answer Correct Answer: C) Test completed as the program is being coded. 36. What type of error is the use of 'and' instead of 'or' in the while statement? A) Syntax Error. B) Logic Error. C) Runtime Error. D) Semantic Error. Show Answer Correct Answer: B) Logic Error. 37. If there is a logic error in the code, the program will NOT run. A) True. B) False. C) All the above. D) None of the above. Show Answer Correct Answer: B) False. 38. Testing while coding a program is called? A) Coder Testing. B) Iterative Testing. C) Development Testing. D) Terminal Testing. Show Answer Correct Answer: B) Iterative Testing. 39. What is the purpose of the while loop in the program? A) To save the game. B) To validate the input. C) To play a new game. D) To print the menu commands. Show Answer Correct Answer: B) To validate the input. 40. A program will still run even with this type of error A) Syntax Error. B) Logic Error. C) All the above. D) None of the above. Show Answer Correct Answer: B) Logic Error. 41. If num < 5:print("The number is larger than 5") A) Syntax Error. B) Logic Error. C) All the above. D) None of the above. Show Answer Correct Answer: B) Logic Error. 42. What type of input is accepted by the program even though it should be considered invalid? A) Character input. B) No input. C) Negative number input. D) Symbol input. Show Answer Correct Answer: A) Character input. 43. Modern IDEs can spot syntax errors are you type your code A) True. B) False. C) All the above. D) None of the above. Show Answer Correct Answer: A) True. Related QuizzesGrammar QuizzesEnglish Grammar QuizzesSubordination QuizSyntactic Transformations QuizSyntax QuizWord Order Adjectives QuizWord Order And Adverbs QuizWord Order Sentences Quiz 🏠 Back to Homepage 📘 Download PDF Books 📕 Premium PDF Books