Error Types in Compilation (Lexical, Syntax, Semantic) MCQs

30 min Score: 0 Attempted: 0/30 Subscribe
1. What is a lexical error?





2. Which compiler phase primarily detects lexical errors?





3. Which of the following is an example of a lexical error?





4. What is a syntax error?





5. Which compiler phase detects syntax errors?





6. Which of the following is a common syntax error?





7. What is a semantic error?





8. Which phase detects semantic errors?





9. Which of the following is an example of a semantic error?





10. Which error occurs when a variable is used without being declared?





11. What type of error is “unrecognized symbol @”?





12. Which error type is caused by violating language grammar rules?





13. Type mismatches (e.g., assigning a string to an integer variable) are examples of:





14. Which error type is usually detected first during compilation?





15. Missing closing brace } is an example of:





16. Using an operator incorrectly on incompatible types is a:





17. What error occurs when a program contains illegal characters like # in variable names?





18. Which error type can cause compilation to fail immediately?





19. Using a function with wrong number of arguments is a:





20. Missing keyword in a statement (e.g., return in a function) is an example of:





21. What is the main difference between syntax and semantic errors?





22. Which error type is typically hardest for compilers to detect automatically?





23. Division by zero detected at compile-time is an example of:





24. Unclosed string literal "Hello is a:





25. Which type of error is using while (x > 0) {} without initializing x?





26. Misspelled reserved words like pront instead of print is a:





27. An incorrect if statement structure like if x > 5 print(x) is a:





28. Using a variable of type integer in a string concatenation without conversion is a:





29. Which error type involves the compiler checking the “meaning” of a statement?





30. Using a reserved keyword as an identifier is a:





Leave a Comment

All copyrights Reserved by MCQsAnswers.com - Powered By T4Tutorials