This quiz works best with JavaScript enabled. Home > Grammar > Syntax > Syntax And Logic Errors – Quiz 1 🏠 Homepage 📘 Download PDF Books 📕 Premium PDF Books Syntax And Logic Errors Quiz 1 (25 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) Runtime Error. B) Logic Error. C) Syntax Error. D) Semantic Error. Show Answer Correct Answer: C) 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 efficient. B) To make the program more complex. C) To make the validation more robust. D) To make the program run faster. Show Answer Correct Answer: C) 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 only accepts numbers. C) It doesn't prompt the user. D) It accepts any input. Show Answer Correct Answer: D) 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) Runtime Error. B) Semantic Error. C) Syntax Error. D) Logic Error. Show Answer Correct Answer: D) 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) * 2. D) Answer = 2 + 3 x 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 does not have a value such as a name or phone number. B) Data that is not entered in order to test how the program responds. C) Data that has a value of zero. D) Data that is incorrect. Show Answer Correct Answer: B) Data that is not entered in order to test how the program responds. Next →Related QuizzesGrammar QuizzesSyntax And Logic Errors Quiz 2Subordination QuizSyntactic Transformations QuizSyntax QuizWord Order Adjectives QuizWord Order And Adverbs QuizWord Order Sentences Quiz 🏠 Back to Homepage 📘 Download PDF Books 📕 Premium PDF Books