EmSAT Computer Science 2 — Questions and Answers
Question 1: What is the difference between a compiler and an interpreter?
- They are the same thing
- A compiler translates the entire program at once, while an interpreter translates and executes line by line (Correct answer)
- A compiler is faster during execution than an interpreter in all cases
- An interpreter can only work with Python
Correct answer: A compiler translates the entire program at once, while an interpreter translates and executes line by line
A compiler translates the entire source code into machine code before execution, while an interpreter translates and executes code one statement at a time during runtime.
Question 2: What does the Boolean expression (TRUE AND FALSE) OR TRUE evaluate to?
- FALSE
- TRUE (Correct answer)
- NULL
- ERROR
Correct answer: TRUE
(TRUE AND FALSE) = FALSE; FALSE OR TRUE = TRUE. The OR operator returns TRUE if at least one operand is TRUE.
Question 3: What is a variable in programming?
- A fixed value that cannot change
- A named storage location in memory that holds a value which can be modified (Correct answer)
- A type of loop
- A mathematical formula
Correct answer: A named storage location in memory that holds a value which can be modified
A variable is a named reference to a memory location that stores data which can be read and modified during program execution.
Question 4: Which network topology connects all devices to a single central hub?
- Ring topology
- Star topology (Correct answer)
- Bus topology
- Mesh topology
Correct answer: Star topology
In a star topology, all devices connect to a central hub or switch. If the central device fails, the entire network is affected, but individual device failures do not affect others.
Question 5: What is the function of RAM in a computer?
- Permanent data storage
- Temporary storage for data and instructions currently being processed (Correct answer)
- Processing mathematical calculations
- Connecting to the internet
Correct answer: Temporary storage for data and instructions currently being processed
RAM (Random Access Memory) provides fast, temporary storage for data and instructions that the CPU is actively using. Its contents are lost when power is turned off (volatile memory).
Question 6: What does HTML stand for and what is its primary purpose?
- High-Tech Machine Learning; artificial intelligence
- HyperText Markup Language; structuring and presenting content on web pages (Correct answer)
- High Transfer Mail Link; sending emails
- Home Tool Management Library; managing files
Correct answer: HyperText Markup Language; structuring and presenting content on web pages
HTML (HyperText Markup Language) is the standard markup language used to structure and present content on the World Wide Web, defining the layout and elements of web pages.
What is the difference between a compiler and an interpreter?