Podcast
Questions and Answers
What is the main design method used in procedural programming?
What is the main design method used in procedural programming?
What is a significant difficulty associated with procedural programming?
What is a significant difficulty associated with procedural programming?
What aspect of object-oriented programming addresses issues found in procedural programming?
What aspect of object-oriented programming addresses issues found in procedural programming?
How do modules function in procedural programming?
How do modules function in procedural programming?
Signup and view all the answers
What can happen to sub procedures when changes are made to the main procedure in a procedural programming context?
What can happen to sub procedures when changes are made to the main procedure in a procedural programming context?
Signup and view all the answers
What character signifies the end of a line in a text stream in C++?
What character signifies the end of a line in a text stream in C++?
Signup and view all the answers
Which programming languages are primarily known for being object-oriented?
Which programming languages are primarily known for being object-oriented?
Signup and view all the answers
What is the primary way in which object-oriented programming enhances security compared to procedural-oriented programming?
What is the primary way in which object-oriented programming enhances security compared to procedural-oriented programming?
Signup and view all the answers
In C++, what do streams refer to?
In C++, what do streams refer to?
Signup and view all the answers
Which of the following statements is correct regarding global and local data in programming?
Which of the following statements is correct regarding global and local data in programming?
Signup and view all the answers
Which type of stream contains raw binary data values interpreted according to their memory representation?
Which type of stream contains raw binary data values interpreted according to their memory representation?
Signup and view all the answers
What is the purpose of the 'cin.get()' function in C++?
What is the purpose of the 'cin.get()' function in C++?
Signup and view all the answers
What differentiates functions in procedural-oriented programming from objects in object-oriented programming?
What differentiates functions in procedural-oriented programming from objects in object-oriented programming?
Signup and view all the answers
What is a fundamental disadvantage of procedural programming languages?
What is a fundamental disadvantage of procedural programming languages?
Signup and view all the answers
Which statement best describes object-oriented programming?
Which statement best describes object-oriented programming?
Signup and view all the answers
How does object-oriented programming improve code maintainability?
How does object-oriented programming improve code maintainability?
Signup and view all the answers
What does the term 'class' indicate in object-oriented programming?
What does the term 'class' indicate in object-oriented programming?
Signup and view all the answers
Which of the following is NOT a key characteristic of object-oriented programming?
Which of the following is NOT a key characteristic of object-oriented programming?
Signup and view all the answers
Which aspect of object-oriented programming contributes to its flexibility?
Which aspect of object-oriented programming contributes to its flexibility?
Signup and view all the answers
In object-oriented programming, what is primarily meant by 'inheritance'?
In object-oriented programming, what is primarily meant by 'inheritance'?
Signup and view all the answers
What is the relationship between an object and a class in object-oriented programming?
What is the relationship between an object and a class in object-oriented programming?
Signup and view all the answers
What is a key characteristic of procedural programming languages?
What is a key characteristic of procedural programming languages?
Signup and view all the answers
Which of the following is NOT a feature of procedure-oriented programming?
Which of the following is NOT a feature of procedure-oriented programming?
Signup and view all the answers
In a procedure-oriented programming language, how is a function typically defined?
In a procedure-oriented programming language, how is a function typically defined?
Signup and view all the answers
Which of the following programming languages is an example of a procedure-oriented programming language?
Which of the following programming languages is an example of a procedure-oriented programming language?
Signup and view all the answers
What is the main purpose of the main program in procedural programming?
What is the main purpose of the main program in procedural programming?
Signup and view all the answers
What does the term 'top-down approach' refer to in the context of procedure-oriented programming?
What does the term 'top-down approach' refer to in the context of procedure-oriented programming?
Signup and view all the answers
Which of the following best describes the nature of data in procedural programming languages?
Which of the following best describes the nature of data in procedural programming languages?
Signup and view all the answers
Which of the following function call examples follows the proper syntax for procedural programming?
Which of the following function call examples follows the proper syntax for procedural programming?
Signup and view all the answers
Study Notes
Course Information
- Course Title: Object Oriented Design and Programming
- Course Code: 18CSC202J
- Unit: 1
- Prepared by: CINTEL Team
- Date: 8/24/2022
Procedural vs Object Oriented Programming
- Procedural Programming: A program is a list of instructions. Larger programs are divided into smaller programs called functions. Each function has a clearly defined purpose and a clearly defined interface to the other functions in the program.
- Procedural language data is usually global and shared by all the functions. Procedural language designs are commonly Top-Down. Languages like C, COBOL, and FORTRAN use this approach.
- Object-Oriented Programming: Objects of the program interact by sending messages to each other, and data security is enhanced because data can only be accessed through its instances. Object-oriented programming is meant to address difficulties in procedural programming with regards to software maintaining which leads to time-consuming processes.
C Function Aspects
- Function Declaration: Return-type function-name(argument list); Eg: int add(int a, int b);
- Function Definition: Return-type function-name(argument list){body of function;} Eg: int add(int a, int b){int c; c=a+b; return c;}
- Function Call: Function-name(argument list); Eg: add(5,10);
Features of Procedure Oriented Programming
- Smaller programs are used
- Larger programs are divided into smaller programs known as functions.
- Each function has a clearly defined purpose
- Each function has a clearly defined interface to the other functions
- Data is global and shared by almost all the functions
- Top-Down approach used in program design
Examples of Procedure Oriented Programming Languages
- COBOL
- FORTRAN
- C
Sample COBOL Program
- Shows program structure with IDENTIFICATION, ENVIRONMENT, and DATA divisions. The WORKING-STORAGE section defines variables (e.g., A, B, ANS) to store numerical values.
- The PROCEDURE DIVISION describes the steps in the program: main processing, adding the variables, displaying results, and terminating.
Disadvantages of Procedural Programming
- Unrestricted access: Functions have unrestricted access to global data.
- Real-world modeling: Unrelated functions and data do not effectively model real-world objects, which typically have attributes (data) and behavior (functions).
Object-Oriented Concepts
- Objects in a program interact by sending messages to each other. This improves data security, as data can only be accessed through its instances.
- Every object has its own memory.
- Computation is performed through objects communicating with each other.
- Every object is an instance of a class. A class simply groups similar objects.
- A class is the repository for behavior associated with an object, meaning all objects from the same class perform the same actions.
- Classes are organized in a tree structure known as the inheritance hierarchy.
- Memory and behavior associated with instances of a class are automatically available to any class associated with a descendant in this tree structure.
Studying That Suits You
Use AI to generate personalized quizzes and flashcards to suit your learning preferences.
Related Documents
Description
This quiz explores key concepts in procedural and object-oriented programming, including design methods, challenges, and the roles of modules and data streams in C++. Test your understanding of the differences between these programming paradigms and their implications for security and data handling.