Q3. What are programming paradigms? Give names of some popular programming paradigms.
Ans. By paradigm one means a way of thinking or doing things.
Paradigm means organizing principle of a program. It is an approach to programming.
A few popular programming paradigms are procedural programming, modular programming, structural programming, etc.
Q2. Write a short note on programming in two major types of languages.
Ans. The two major types of programming languages are:
- Low Level Language
- High Level Language
- Low Level Languages
Low Level languages (that is, machine languages and assembly languages) are machine-oriented and require extensive knowledge of computer circuitry.
Machine language, in which instructions are written in binary code (using 1 and 0), is the only language the computer can execute directly.
Assembly language, in which instructions are written using symbolic names for machine operations (for example, READ, ADD, STORE etc) and operands, makes programming less tedious than machine language programming. However, assembly program is then converted into machine language using assembler software.
- High Level Languages
High Level Languages, (HLLs), on other hand, offer English like keywords, constructs for sequence, selection (decision) and iteration (looping) and use of variables and constants. Thus it is very easy to program with such languages compared to low level languages. The programs written in HLLs are converted into machine language using complier or interpreter a s a computer can work with machine language only.
Q24. What is polymorphism? Give an example illustrating polymorphism.
Ans. Polymorphism is the ability for a message or data to be processed in more than one form.
For example, if you give 5+7, it results into 12, the sum of 5 and 7. And if you give ‘A’+’BC’, it results into ‘ABC’, the concatenated strings. The same operation symbol ‘+’ is able to distinguish between the two operations (su Read More …
Q23. What are object-based languages? Give an example of object-based language.
Ans. In object based languages object represents an entity that can store data and has its interface through functions.
For example: C++.
Q22. What do you mean by transitive nature of inheritance?
Ans. The transitive nature of inheritance states that if a class A inherits properties from its base class B then all its subclasses will also be inheriting the properties of base class of A that is, B.
Q21. How does inheritance support ‘reusability’?
Ans. Inheritance support reusability by allowing the addition of additional features to an existing class without modifying it.
Q20. What is modularity? What benefits does it offer?
Ans. Modularity is the property of a system that has been decomposed into a set of cohesive and loosely coupled modules.
Following are the benefits offered by modularity:
- It reduces program’s complexity to some degree.
- It creates a number of well-defined, documented boundaries within the program.
Q19. What is a baseclass? What is a subclass? What is the relationship between a baseclass and subclass?
Ans. A baseclass is a class whose properties are inherited by other classes (its subclasses).
A subclass is class which inherits properties from its base class.
A sub class has nearly all the properties of base class but the reverse of it is not true.
Q18. Why are classes called Abstract Data Type?
Ans. Since the classes use the concept of data abstraction, they are known as Abstract Data Type (ADT). Data Types because these can be used to create objects of its own type.
Q17. How are the terms abstraction and encapsulation related?
Ans. Abstraction and encapsulation related as encapsulation is a way to implement data abstraction.