Computer Knowledge
Programming Languages and Compilers
2,284 Questions
Programming languages and compilers involve the rules, syntax, and semantics used to write and execute software programs. Key areas include scripting languages, object oriented concepts, and parsing algorithms like top down parsers. Practice these computer science questions to build proficiency for technical and computer knowledge exams.
Object oriented languagesScripting languagesCompilers and parsersProgramming syntax
Programming Languages and Compilers Questions
What is the difference between a compiler and an interpreter?
-
A compiler translates the entire program into machine code before executing it, while an interpreter executes the program line by line.
-
A compiler generates an intermediate code that is then executed by the operating system, while an interpreter directly executes the source code.
-
A compiler is used for high-level languages, while an interpreter is used for low-level languages.
-
A compiler is typically slower than an interpreter, but the resulting code is more efficient.
A
Correct answer
Explanation
A compiler translates the entire program into machine code before executing it, while an interpreter reads and executes the program line by line.
What is the purpose of a programming language syntax in a programming language?
-
To define the rules and conventions for writing a program in a specific programming language.
-
To allow a program to be parsed and interpreted by a compiler or interpreter.
-
To improve the readability and understandability of a program.
-
All of the above.
D
Correct answer
Explanation
A programming language syntax is a set of rules and conventions for writing a program in a specific programming language. It allows a program to be parsed and interpreted by a compiler or interpreter. It also improves the readability and understandability of a program.
In the interactive storytelling platform "Ink", authors create branching narratives where readers' choices influence the story's outcome. What is the name of the programming language used in Ink?
-
C++
-
Java
-
Python
-
InkScript
D
Correct answer
Explanation
InkScript is the programming language specifically designed for creating interactive stories in the Ink platform.
Which of the following is NOT a type of finite automaton?
-
Deterministic Finite Automaton (DFA)
-
Non-Deterministic Finite Automaton (NFA)
-
Pushdown Automaton (PDA)
-
Linear Bounded Automaton (LBA)
C
Correct answer
Explanation
Pushdown Automata are not finite automata, as they have a stack memory that allows them to remember previous states.
Which of the following is NOT a type of context-free grammar?
-
Chomsky Normal Form (CNF)
-
Greibach Normal Form (GNF)
-
Regular Grammar
-
Context-Sensitive Grammar
C
Correct answer
Explanation
Regular grammars are not context-free grammars, as they have productions that can only generate strings of a certain length.
Which of the following is NOT a type of Turing machine?
-
Deterministic Turing Machine (DTM)
-
Non-Deterministic Turing Machine (NTM)
-
Universal Turing Machine (UTM)
-
Linear Bounded Automaton (LBA)
D
Correct answer
Explanation
Linear Bounded Automata are not Turing machines, as they have a limited amount of memory.
Which of the following is NOT a type of language?
-
Regular Language
-
Context-Free Language
-
Context-Sensitive Language
-
Recursively Enumerable Language
D
Correct answer
Explanation
Recursively Enumerable Languages are not a type of language in the Chomsky Hierarchy.
Which of the following is NOT a type of parsing?
-
Top-Down Parsing
-
Bottom-Up Parsing
-
Left-to-Right Parsing
-
Right-to-Left Parsing
C
Correct answer
Explanation
Left-to-Right Parsing is not a type of parsing, as it is not a complete parsing strategy.
Which of the following is NOT a type of language technology?
-
Machine Translation
-
Speech Recognition
-
Natural Language Processing
-
Optical Character Recognition
D
Correct answer
Explanation
Optical Character Recognition (OCR) is a technology that converts scanned images of printed or handwritten text into machine-encoded text, making it searchable and editable. It is not a language technology as it does not involve the understanding or processing of language.
Which programming language is commonly used for creating generative art?
-
Python
-
Java
-
C++
-
Processing
D
Correct answer
Explanation
Processing is a programming language and development environment that is specifically designed for creating visual arts. It is widely used for creating generative art due to its ease of use and powerful graphics library.
Which of the following is NOT a common method used for software translation?
-
Machine translation.
-
Human translation.
-
Crowdsourced translation.
-
Automated translation.
D
Correct answer
Explanation
Automated translation is not a common method used for software translation, as it often produces inaccurate and unnatural translations that require significant manual editing.
Which of the following is NOT a common method used for software translation?
-
Machine translation.
-
Human translation.
-
Crowdsourced translation.
-
Automated translation.
D
Correct answer
Explanation
Automated translation is not a common method used for software translation, as it often produces inaccurate and unnatural translations that require significant manual editing.
Which of the following is NOT a common method used for software translation?
-
Machine translation.
-
Human translation.
-
Crowdsourced translation.
-
Automated translation.
D
Correct answer
Explanation
Automated translation is not a common method used for software translation, as it often produces inaccurate and unnatural translations that require significant manual editing.
Which of the following is a popular programming language for data analysis and machine learning?
A
Correct answer
Explanation
Python is a widely used programming language for data analysis and machine learning due to its simplicity, rich libraries, and extensive community support.
Which of the following is a widely used programming language for developing mobile applications?
C
Correct answer
Explanation
Swift is a modern and powerful programming language developed by Apple specifically for iOS, iPadOS, macOS, tvOS, and watchOS application development.