WorksheetsStructured and Object-Oriented Programming Quiz
Total questions: 30
Worksheet time: 15mins
What is the main purpose of a programming paradigm?
To define the syntax of a programming language
To organize different ways or styles of solving problems using a programming language
To determine the speed of a programming language
To categorize programming languages based on their popularity
Which programming paradigm involves sets of detailed instructions to instruct how to execute?
Declarative programming paradigm
Imperative programming paradigm
Functional programming paradigm
Logic programming paradigm
Which of the following is an example of a procedural programming language?
Python
C
Erlang
SQL
What is the primary concept of Object-Oriented Programming (OOP)?
Data aggregation (grouping related variables)
Objects (instances) that combine data and behavior
Top-down approach
Direct memory access
Which programming paradigm divides the program into small modules called functions?
Bottom-up approach
Top-down approach
Encapsulation
Code reusability
What is the unit used in Structured Programming?
Class
Struct
Object
Module
How is data hiding achieved in Object-Oriented Programming (OOP)?
By using public access specifiers
By separating functions and structs
By using private/protected access specifiers
By direct memory access
Which programming paradigm is associated with encapsulation?
Structured Programming
Object-Oriented Programming
Top-down approach
Data aggregation
Which domain uses C for Unreal Engine, Unity, and most AAA game engines like Frostbite and CryEngine?
Game Engines & AAA Games
Web Browsers
Databases
Multimedia & Codecs
What is the primary function of a compiler in programming?
To execute the program directly without translation
To translate the C program into machine-language code
To debug runtime errors in the program
To store the program in memory
What is a syntax error in programming?
An error that occurs during program execution
An error that occurs when a statement violates the rules of the language
An error caused by insufficient memory allocation
An error that occurs due to incorrect output
What are compile-time errors?
Errors that occur during program execution
Errors that occur when the program is being compiled
Errors caused by incorrect user input
Errors that occur due to hardware failure
Which file extension is typically used for a compiled C program?
.exe
.c
.o
.txt
What is the primary difference in how a compiler and an interpreter translate source code?
A compiler translates the entire source code at once, while an interpreter translates it line-by-line.
A compiler translates line-by-line, while an interpreter translates the entire source code at once.
Both a compiler and an interpreter translate the entire source code at once.
Both a compiler and an interpreter translate line-by-line.
Which of the following is true about the execution speed of a compiler compared to an interpreter?
A compiler is faster because it runs directly as machine code.
An interpreter is faster because it translates the code all at once.
A compiler is slower because it translates line-by-line.
An interpreter is faster because it generates a standalone executable.
What is a key advantage of using an interpreter over a compiler in terms of debugging?
An interpreter stops exactly at the error line, making debugging easier.
An interpreter shows all errors at once, making debugging easier.
An interpreter generates a standalone executable for debugging.
An interpreter requires recompilation for debugging.
Which of the following programming languages is typically associated with compilers?
C++
Python
JavaScript
Ruby
What is the portability difference between a compiler and an interpreter?
A compiler requires recompilation for different platforms, while an interpreter is highly portable.
A compiler is highly portable, while an interpreter requires recompilation for different platforms.
Both a compiler and an interpreter are highly portable.
Neither a compiler nor an interpreter is portable.
Which of the following best describes Python as a programming language?
Python is a general-purpose, procedural programming language.
Python is an interpreted, high-level, general-purpose programming language.
Python is a compiled, low-level programming language.
Python is a language specifically designed for hardware programming.
What is the main difference in execution speed between Python and C?
Python executes faster than C because it is interpreted.
C executes faster than Python because it is compiled.
Both Python and C execute at the same speed.
Python executes faster than C because it is high-level.
Why is Python considered easier to write code in compared to C?
Python has a simpler syntax and requires fewer lines of code.
Python requires variable declaration, making it easier to debug.
Python is a compiled language, making it faster to write code.
Python has stricter rules for syntax, making it easier to follow.
What is the key difference in variable declaration between Python and C?
Python requires variable types to be declared, while C does not.
C requires variable types to be declared, while Python does not.
Both Python and C require variable types to be declared.
Neither Python nor C requires variable types to be declared.
How does error debugging differ between Python and C?
Python compiles the entire source code before showing errors, while C shows errors instantly.
Python shows errors instantly during execution, while C compiles the entire source code before showing errors.
Both Python and C show errors instantly during execution.
Both Python and C compile the entire source code before showing errors.
Which programming language has a syntax that is easier to learn, write, and read?
Python
C
Java
Assembly Language
What does Python use for memory management?
Manual memory management
Automatic garbage collector
Pointers
Curly braces
Which programming language is generally used for hardware-related applications?
Python
C
JavaScript
Ruby
Which programming language has a larger library of built-in functions?
Python
C
Assembly Language
Fortran
What is a key difference between Python and C in implementing data structures?
Python requires explicit implementation of functions for data structures.
C provides built-in insert and append functions for data structures.
Python gives ease of implementing data structures with built-in functions.
Both Python and C require manual implementation of data structures.
Which programming language supports pointers?
Python
C
Java
HTML
What is the purpose of curly braces in C?
To define a block of code
To manage memory
To implement pointers
To create built-in functions
