Unit1 Assignment

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

Theory Question:

1. Describe with example, the different ways of assigning values to structure members.
2. Distinguish between: Structure and Array
3. Distinguish between: Structure and Union
4. Explain (1) Array of Structure (2) Array within Structure
5. Explain nested structure (structure within structure) with example.
6. Explain with example how a structure is passed as function argument.

Programming Assignment:

1. Define a structure data type called time_struct containing three members integer
hour, integer minute, integer second.
a. Write a C program that would assign values to the individual members and
display the time in the format 16:40:51
b. Write a C program that a function is used to input values to the members
and another function to display the same.
2. Define a structure that describes a student having members Roll_no, Name,
Mark1, Mark2, Mark3. Write a program for five students to print the total marks
and average of marks for each student.
Procedural Oriented
Programming Object-Oriented Programming

In procedural programming, the In object-oriented programming, the


program is divided into small parts program is divided into small parts
called functions. called objects.

Procedural programming follows Object-oriented programming


a top-down approach. follows a bottom-up approach.

Object-oriented programming has


There is no access specifier in
access specifiers like private, public,
procedural programming.
protected, etc.

Adding new data and functions is not Adding new data and function is
easy. easy.

Procedural programming does not Object-oriented programming


have any proper way of hiding data provides data hiding so it is more
so it is less secure. secure.

In procedural programming, Overloading is possible in object-


overloading is not possible. oriented programming.

In procedural programming, there is In object-oriented programming, the


no concept of data hiding and concept of data hiding and
inheritance. inheritance is used.

In procedural programming, the In object-oriented programming,


function is more important than the data is more important than
data. function.

Procedural programming is based on Object-oriented programming is


the unreal world. based on the real world.

Object-oriented programming is
Procedural programming is used for
used for designing large and
designing medium-sized programs.
complex programs.

Procedural programming uses the Object-oriented programming uses


concept of procedure abstraction. the concept of data abstraction.
Procedural Oriented
Programming Object-Oriented Programming

Code reusability absent in procedural Code reusability present in object-


programming, oriented programming.

Examples: C, FORTRAN, Pascal, Examples: C++, Java, Python, C#,


Basic, etc. etc.

You might also like