CD
Unit-5Advanced topics Q1) What do you mean by type system?A1) Type System ● A form is a set of values and operations on those values. ● A language’s type system defines which operations are valid for a type. ● The purpose of type checking is to ensure that operations are used on thevariable/expressions of the right forms. ● Languages can be divided into three categories with respect to the type: ○ Untyped■ No form testing needs to be performed■ Assembly languages○ Statically typed■ All type testing is done at compile time■ Algol family of languages■ Often, called strongly typed○ Dynamically typed ■ Form testing is performed at run time■ Often functional languages like Lisp, Scheme etc. ● Static typing○ Catches the most common compilation time programming errors○ Avoids overhead run-time○ In certain cases, it may be restrictive○ Rapid prototyping can be challenging ● Most code is written using languages of static types, ● In fact, large/critical system developers demand that code be strongly type-checked at compile time even though language is not heavily typed (use of Lint for C code, code compliance checkers) ● A type system is a set of rules to assign type expressions to different components of a programme. ● Various compilers for the same language can use different types of systems. Q2) What is the difference between imperative and non-imperative language ?A2) Difference between imperative and non-imperative language The key difference between imperative and non-imperative programming is that, while the non-imperative, functional or logical language informs the programme what it wants to do, as opposed to how to do it, the imperative language focuses on how the programme can execute its tasks. "Imperative computer science programming "is a paradigm of programming which describes computation in terms of statements that alter the state of a programme. The sequence of commands for the machine to execute is specified by imperative programmes. In comparison to the declarative, which specifies what the programme should do without defining how to do so in terms of sequences of action to be taken. In practical and logical programming, the non-imperative language of programming will be easier. A pure functional language like Haskell has changes in the state that are only interpreted as state-transforming functions. Logical programming, as in the functional programming language, consists of logical statements and programmes implemented by looking for evidence of the argument. Procedural language, on the other hand, is an imperative language in which the software is based on one or more procedures (subroutines or functions). In structured programming and modular programming, imperative programming can also be used. Q3) What do you mean by object oriented programming?A3) Object Oriented Programming A framework of the programming language in which data and their related processing ("methods") are defined as "objects." self-contained entities. Today's traditional, object-oriented programming (OOP) languages, provide a structured set of rules for object creation and management. The data is stored in a traditional relational database or, if the data has a complex structure, in an object database. See O-R mapping and the database for objects. In object-oriented programming, there are three key characteristics that make them distinct from non-OOP languages: encapsulation, heritage, and polymorphism. Encapsulation Enforces ModularityEncapsulation refers to the development of self-contained modules that bind the data to processing functions. These types of user-defined data are called "classes," and an example of a class is a "object." For example, a class could be Manager in a payroll system, and two instances (two objects) of the Manager class could be Pat and Jan. Encapsulation guarantees good modularity of code, which keeps routines distinct and less prone to conflict with each other. Inheritance Passes "Knowledge" DownIn hierarchies, classes are created, and inheritance enables the hierarchy to be passed down to the structure and techniques in one class. That means that when adding functions to complex systems, less programming is needed. If a step is introduced at the bottom of a hierarchy, it is only important to include the processing and data associated with that particular step. All else is inherited. The ability to reuse existing objects is considered to be a major benefit of object technology Polymorphism Takes any ShapeObject-oriented programming enables procedures to be generated regarding objects whose exact form is not known before runtime. For example, depending on the programme mode, a screen cursor will alter its shape from an arrow to a line. In response to mouse movement, the routine to move the cursor on screen will be written for "cursor," and polymorphism allows the cursor to take on whatever shape is required at runtime. It also makes it simple to incorporate new shapes. Q4) Write short notes on data abstraction ?A4) Data Abstraction Data Abstractions contribute to successful design of programmes● They assist with encapsulation (information hiding)● They help reduce the complexity of interfaces with software● They make more modifiable systems. To choose good data abstractions, you need some research.● Adequacy: have you included all the tasks that users need?● To maximise effectiveness, switch between implementations One of the most important and significant features of object-oriented programming is data abstraction. Abstraction means revealing only important data and concealing the information. Data abstraction refers to supplying the outside world with only basic knowledge about the data, covering the specifics of the context or implementation. The abstraction of data enables a programme to ignore the details of how a type of data is represented. Abstraction refers to the act of representing essential characteristics without including the details or explanations of the background. Classes use the abstraction method and are specified as a list of abstract attributes to operate on these attributes, such as distance, cost, size, etc., and functions. They put all the essential properties of an entity that are needed to be generated in a nutshell. Therefore, as they hold data, the attributes are called data members. As member functions, the functions that act on certain members of the data are named. While classifying a class, both data members and member functions are expressed in the code. But, while using an object (that is an instance of a class) the built-in data types and the members in the class get ignored which is known as data abstraction. It is a programming design technique that depends on the separation of an interface to that of implementation. So you have to keep the interface independent of the execution when designing your component, because if you change the underlying execution, the interface will remain intact. Q5) What do you mean by abstract classes ?A5) Abstract Classes The abstract classes become classes containing at least one pure virtual function. The pure virtual function must be redefined by classes inheriting abstract classes; otherwise, the derived classes would also become abstract. It is not possible to instantiate abstract groups.
0 matching results found