0% found this document useful (0 votes)
121 views

Event Driven Programming

The document discusses object-oriented programming. It lists five types of programming languages and describes object-oriented programming languages. It provides six advantages of object-oriented languages including building programs from reusable modules, breaking problems into smaller objects, easy upgrades, data hiding for security, and code reuse through inheritance. The document also includes two questions. The first asks about programming language types and advantages of object-oriented languages, which is answered in the text. The second question asks to implement a program in an object-oriented language to append two arrays into a sorted array, which is demonstrated through a Java class.

Uploaded by

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

Event Driven Programming

The document discusses object-oriented programming. It lists five types of programming languages and describes object-oriented programming languages. It provides six advantages of object-oriented languages including building programs from reusable modules, breaking problems into smaller objects, easy upgrades, data hiding for security, and code reuse through inheritance. The document also includes two questions. The first asks about programming language types and advantages of object-oriented languages, which is answered in the text. The second question asks to implement a program in an object-oriented language to append two arrays into a sorted array, which is demonstrated through a Java class.

Uploaded by

Harsh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

CS-4004 Event Driven Programming

Que - 1: Enlist the types of Programming language and describe in brief. Enlist
any six advantages of Object-Oriented Programming Language.

Ans: Types of programming language are as follows:

 Procedural Programming Language


 Functional Programming Language
 Scripting Programming Language
 Logic Programming Language
 Object-Oriented Programming Language

Advantages of Object-Oriented Programming Language are as follows:

 We can build the programs from standard working modules that


communicate with one another, rather than having to start writing
the code from scratch which leads to saving of development time
and higher productivity,
 OOP language allows to break the program into the bit-sized
problems that can be solved easily (one object at a time).
 The new technology promises greater programmer productivity,
better quality of software and lesser maintenance cost.
 OOP systems can be easily upgraded from small to large systems.
 It is possible that multiple instances of objects co-exist without any
interference,
 It is very easy to partition the work in a project based on objects.
 It is possible to map the objects in problem domain to those in the
program.
 The principle of data hiding helps the programmer to build secure
programs which cannot be invaded by the code in other parts of the
program.
 By using inheritance, we can eliminate redundant code and extend
the use of existing classes.

Que - 2: Implement the below-given programs in an object-oriented language. 

1. Consider two arrays A and B which will have five integer numbers in each.
Create another array C which will have ten integer numbers from both A
and B as appended values. Show values of C in sorted order.

Ans: class FindAppend {

    static int printAppend(int arr1[], int arr2[], int m, int n)


    {
        int i = 0, j = 0;
        while (i < m && j < n) {
            if (arr1[i] < arr2[j])
                System.out.print(arr1[i++] + " ");
            else if (arr2[j] < arr1[i])
                System.out.print(arr2[j++] + " ");
            else {
                System.out.print(arr2[j++] + " ");
                i++;
            }
        }
        while (i < m)
            System.out.print(arr1[i++] + " ");
        while (j < n)
            System.out.print(arr2[j++] + " ");
 
        return 0;
    }
 
    public static void main(String args[])
    {
        int arr1[] = { 1, 2, 4, 5, 6 };
        int arr2[] = { 2, 3, 5, 7 };
        int m = arr1.length;
        int n = arr2.length;
        printAppend(arr1, arr2, m, n);
    }
}

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy