Computer Science Programming & Software Development 1 — Questions and Answers
Question 1: Which programming paradigm focuses on objects and their interactions?
- Functional programming
- Object-oriented programming (OOP) (Correct answer)
- Procedural programming
- Declarative programming
Correct answer: Object-oriented programming (OOP)
Object-oriented programming (OOP) is a paradigm centered around the concept of 'objects,' which are instances of classes. These objects encapsulate data (attributes) and behavior (methods) and interact with each other to perform tasks. Key principles like encapsulation, inheritance, and polymorphism define this approach, making it suitable for designing complex, modular systems.
Question 2: Which data type is used to store a sequence of characters in most programming languages?
- Integer
- Boolean
- String (Correct answer)
- Float
Correct answer: String
A string is a fundamental data type used to represent a sequence of characters, such as letters, numbers, and symbols. In most programming languages, strings are immutable and are enclosed in quotation marks. They are essential for handling text-based data, from user input to file content.
Question 3: What is the main purpose of a compiler?
- To execute code line by line
- To convert source code into machine code (Correct answer)
- To debug programs
- To optimize memory usage
Correct answer: To convert source code into machine code
A compiler is a program that translates source code written in a high-level programming language (like C++ or Java) into machine code or an intermediate code. This machine code is a low-level language that a computer's processor can directly understand and execute. The compilation process typically involves lexical analysis, parsing, semantic analysis, and code generation.
Question 4: Which software development methodology emphasizes short iterative cycles and adaptability?
- Waterfall model
- Agile development (Correct answer)
- V-model
- RAD model
Correct answer: Agile development
Agile development is an iterative and incremental approach to software development that emphasizes flexibility, collaboration, and rapid delivery. It breaks projects into short cycles called sprints, allowing teams to adapt to changing requirements and deliver working software frequently. This contrasts with traditional linear models like Waterfall, which are less adaptable.
Question 5: Which of the following best describes an API (Application Programming Interface)?
- A type of programming language
- A set of functions and protocols for communication (Correct answer)
- A software testing tool
- A database management system
Correct answer: A set of functions and protocols for communication
An API, or Application Programming Interface, defines a set of rules, routines, and protocols that allow different software applications to communicate and interact with each other. It specifies how software components should interact, enabling developers to build complex applications by leveraging existing functionalities without needing to understand their internal implementation. APIs are crucial for integrating services and building interconnected systems.
Question 6: What is the purpose of version control in software development?
- To delete unnecessary code
- To track and manage changes in software projects (Correct answer)
- To increase code execution speed
- To compile programs faster
Correct answer: To track and manage changes in software projects
Version control systems (VCS) are tools that help software development teams manage changes to source code and other project files over time. They record every modification, allowing developers to revert to previous versions, compare changes, and merge contributions from multiple team members efficiently. This prevents conflicts, facilitates collaboration, and maintains a complete history of the project.
Which programming paradigm focuses on objects and their interactions?