Alpingi.com

Freshers Jobs | AMCAT | Fresherworld | JEE | NEET | GATE & CAT

AMCAT coupon code --> ALP100 | Freshersworld Discount Code --> AFF1451AGI
TechMario UpdatesAMCAT Discount Code (ALP100) - get flat 100 off TechMario UpdatesFreshersworld Coupon Code (AFF1451AGI) - - get flat 100 off TechMario UpdatesGovt Jobs- सरकारी नौकरियों के लिए यहां क्लिक करें

AMCAT Abstraction Questions with Solution – Computer programming

AMCAT Abstraction Questions (Computer Programming): AMCAT is known as the benchmark of IT standards. Good AMCAT score aids in getting the best job offers. To clear the AMCAT exam, Quantitative abilities, Logical Reasoning and English language are mandatory modules. For engineering candidates, especially for IT branches like Computer Science, Electronics and communication, Electronics and electricals,etc., computer programming is a mandatory module. Here we will be looking into AMCAT Abstraction Questions in Computer Programming section.

AMCAT Abstraction Questions with Solution 2018

AMCAT Abstraction Questions

Object Oriented Programming (OOP), is an important topic of Computer Programming syllabus and Abstraction comes under OOP. Most likely, 2 questions come in AMCAT Computer Programming section from abstraction topic. It takes an average of 1 minute to answer the question. The level of questions ranges from easy to average.

Overview of Abstraction

In object-oriented programming, abstraction is one of the major concepts (along with encapsulation and inheritance). Through the process of abstraction, a programmer hides all, but the relevant data about an object in order to reduce complexity and increase efficiency. In the same way that abstraction sometimes works in art, the object that remains is a representation of the original, with unwanted detail omitted. The resulting object itself can be referred to as an abstraction, meaning a named entity made up of selected attributes and behavior specific to a particular usage of the originating entity. Abstraction is related to both encapsulation and data hiding.

Check out the following example for illustration of Abstraction usage.
A Car has Engine, wheels and many other parts. When we write all the properties of the Car, Engine, and wheel in a single class, it would look this way:


public class Car {
int price;
    String name;
    String color;
    int engineCapacity;
    int engineHorsePower;
    
    String wheelName;
    int wheelPrice;
    
    void move(){
    //move forward  
    }    void rotate(){
      //Wheels method
    }
    
    void internalCombustion(){
      //Engine Method
    }
    
}

In the above example, the attributes of wheel and engine are added to the Car type. As per the programming, this will not create any kind of issues. But when it comes to maintenance of the application, this becomes more complex.

Advantages of Abstraction:

  1. By using abstraction, we can separate the things that can be grouped to another type.
  2. Frequently changing properties and methods can be grouped to a separate type so that the main type need not undergo changes. This adds strength to the OOAD principle -“Code should be open for Extension but closed for Modification“.
  3. Simplifies the representation of the domain models.

Applying the abstraction with composition, the above example can be modified as given below:

public class Car {
    Engine engine = new Engine();
    Wheel wheel = new Wheel();
    int price;
    String name;
    String color;
    void move(){
    //move forward  
    }
}
public class Engine {
  int engineCapacity;
  int engineHorsePower;
  void internalCombustion(){
    //Engine Method
  }
}
public class Wheel {
  String wheelName;
  int wheelPrice;
  void rotate(){
    //Wheels method
  }
}

You can see that the attributes and methods related to the Engine and Wheel are moved to the respective classes.
AMCAT Abstraction Questions

Engine and Wheel are referred from the Car type. When ever an instance of Car is created, both Engine and Wheel will be available for the Car and when there are changes to these Types(Engine and Wheel), changes will only be confined to these classes and will not affect the Car class.

 

Download AMCAT Abstraction Questions

AMCAT Abstraction Sample Questions pdf

Exercises on Abstraction problems

Question 1
How many instances of an abstract class can be created?
A.1
B.5
C.13
D.0
Answer: Option D

Question 2
Which of the following is an abstract data type?
A.int
B. double
C. string
D. Class
Answer: Option D

Question 3
Which of the following concepts of OOPS means exposing only necessary information to client?
A. Abstraction
B. Encapsulation
C .Data hiding
D. Data binding
Answer: Option D

Question 4
Which of the following cannot be inherited?
A. Friend
B. Static
C. Destructor
D. None of the above
Answer: Option B

Question 5
Which type of inheritance needs a virtual function:
A. Multi level inheritance
B. Multiple inheritance
C. Hybrid inheritance
D. All the above
Answer: Option D

Question 6
A virtual function that has no definition within the base class is called?
A. Pure virtual function
B. Pure static function
C. Pure Const function
D. Virtual Function
Answer: Option A

Download AMCAT Encapsulation questions pdf

AMCAT Polymorphism Questions with solution

Sample Questions of Data Structure-Computer Programming

Leave a Reply

Your email address will not be published. Required fields are marked *

alpingi © 2018