0% found this document useful (0 votes)
2 views5 pages

Programming

The document discusses programming paradigms, defining them as fundamental styles for structuring code and solving computational problems. It compares structured programming, which focuses on sequential execution and modular design, with object-oriented programming, which organizes code around objects and classes. Additionally, it provides a code example for creating a Student class in C++ with attributes and methods for setting and displaying student details.

Uploaded by

supriya302205
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views5 pages

Programming

The document discusses programming paradigms, defining them as fundamental styles for structuring code and solving computational problems. It compares structured programming, which focuses on sequential execution and modular design, with object-oriented programming, which organizes code around objects and classes. Additionally, it provides a code example for creating a Student class in C++ with attributes and methods for setting and displaying student details.

Uploaded by

supriya302205
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

NETAJI SUBHASH ENGINEERING COLLEGE

Techno city ,Garia,Kolkata -700152

NAME - SUPRIYA RAJ


UNIVERSITY ROLL-10900323115
CLASS ROLL-114
SECTION- B
DEPARTMENT -ECE
SUBJECT -OOPS
Que 1.(a) What is a Programming Paradigm?
Definition and Core Concepts
A programming paradigmis a
fundamental style or approach to programming that
provides a framework for structuring and organizing
code. It defines the methodology, principles, and
patterns used to solve computational problems.
Paradigms shape how developers
think about problems and design
solutions, influencing code structure,
data handling, and program flow.
Structured Programming Language
Characteristics and Features

Sequential Execution Modular Design Focus on Logic


Programsexecute inatop-down Codeis divided into functions and Emphasizesalgorithms and step-
manner with clear control flow procedures that can be reused, by-step procedures to solve
using sequences, selections, and making programs more problems with data and functions
iterations maintainable and organized kept separate

Examples include C, Pascal, and FORTRAN, which prioritize procedural approaches and structured control flow mechanisms.
Que 1(b)
Detailed Comparison: Structured vs Object-
Oriented Programming
Structured Programming Object-Oriented Programming
Programs divided into functions and procedures Programs organized aroundobjects and classes
Data and functions are separate entities Top- Data and methods are encapsulated together
down approach to problem-solving Less code Bottom-up approach to software design
reusability across projects Suitable for smaller, High code reusability through inheritance
less complex applications Examples: C, Pascal, Ideal for large, complex, maintainable systems
BASIC Examples: C++, Java, Python
Que 2.
Creating the Student Class: Attributes and
Methods
#include #include using namespace std;

class Student {
private:
string name;
int rollNumber;
string phoneNumber;
string address;
public:
void setDetails(string n, int r, string p, string a) {
name = n;
rollNumber = r;
phoneNumber = p;
address = a;
} void displayDetails() {
cout << "Name: " << name << endl;
cout << "Roll Number: " << rollNumber << endl;
cout << "Phone Number: " << phoneNumber << endl;
cout << "Address: " << address << endl << endl;
}
}; int main() {
Student student1, student2;

[Link]("Sameer", 101, "9876543210",


"123 MG Road, Delhi");
[Link]("Ravi", 102, "9123456789",
"456 Park Street, Mumbai");

cout << "Student 1 Details:" << endl;

[Link]();

cout << "Student 2 Details:" << endl;


[Link]();

return 0;
}

You might also like