Table Of Contents
Quantum Notes on Object Oriented Programming/System Design can help you succeed in the Aktu Btech programme. To perform well on your examinations, access essential insights and commonly asked questions. Today, give your academic career a boost! Unit-4 C++ Basics & Functions
Dudes 🤔.. You want more useful details regarding this subject. Please keep in mind this as well. Important Questions For Object Oriented Programming/System Design: *Aktu Quantum *B.tech-Syllabus *Circulars *B.tech AKTU RESULT * Btech 3rd Year * Aktu Solved Question Paper
Q1. Write short note on C++ and its applications.
Ans.
- 1. C++ is an object-oriented programming language developed by Bjarne Stroustrup.
- 2. C++ is a cross-platform language that can be used to create high performance applications.
- 3. C++is a versatile language for handling very large programs.
- 4. It is suitable for variety of programming task including development of editors, compilers, and different complex real-life application systems.
Applications of C++ :
- 1. Since C++ allows us to create hierarchy-related objects, we can build special object oriented libraries which can be used later by many programmers.
- 2. While C++ is able to map the real-world problem properly, the C part of C++ gives the language the ability to get close to the machine-level details.
- 3. C++ programs are easily maintainable and expandable. When a new feature needs to be implemented, it is very easy to add to the existing structure of an object.
Q2. Write a C++ program to calculate the value of sin (x) and cos (x).
Ans.
Q3. Explain typecasting in C++
Ans. Typecasting :
- 1. Converting an expression of a given type into another type is known as typecasting.
- 2. Following are the types of typecasting:
- a. Implicit conversion:
- i. Implicit conversions do not require any operator.
- ii. They are automatically performed when a value is copied to a compatible type.
- iii. For example:
- b. Explicit conversion:
- i. Many conversions, especially those that imply a different interpretation of the value, require an explicit conversion.
- ii. For example:
- c. Dynamic cast:
- i. dynamic_cast can be used only with pointers and references to objects.
- ii. Its purpose is to ensure that the result of the type conversion is a valid complete object of the requested class.
- d. Static cast:
- i. static_cast can perform conversions between pointers to related classes, not only from the derived class to its base, but also from a base class to its derived.
- e. reinterpret_cast:
- i. reinterpret_cast converts any pointer type to any other pointer type, even of unrelated classes.
- ii. The operation result is a simple binary copy of the value from one pointer to the other.
- f. const_cast: This type of casting manipulates the constness of an object, either to be set or to be removed.
- g. Typeid:
- i. typeid allows to check the type of an expression typeid (expression).
- ii. This operator returns a reference to a constant object of type type_info that is defined in the standard header file <typeinfo>.
Q4. Write a program in C++ to count display the frequency of vowels in a given sentence of at least 35 characters long.
Ans.
Q5. Differentiate between identifiers and keywords.
Ans.
S. No. | Identifiers | Keywords |
1. | Identifiers are the names defined by the programmer to the basic elements of a program. | Keywords are the reserved words whose meaning is known by the compiler. |
2. | It is used to identify the name of the variable. | It is used to specify the type of entity. |
3. | It can consist of letters, digits, and underscore. | It contains only letters. |
4. | It can use both lowercase and uppercase letters. | It uses only lowercase letters. |
5. | No special character can be used except the underscore. | It cannot contain any special character. |
6. | The starting letter of identifiers can be lowercase, uppercase or underscore. | It can be started only with the lowercase letter. |
7. | It can be classified as internal and external identifier. | It cannot be further classified. |
8. | Examples are test, result, sum, power, etc. | Examples are ‘for, ‘if, ‘else’, “break’, etc. |
Q6. What are the advantages and disadvantages of inline function ?
Ans. A. Advantages:
- 1. Function call overhead doesn’t occur.
- 2. It also saves the overhead of push/pop variables on the stack when function is called.
- 3. It also saves overhead of a return call from a function.
- 4. When you inline a function, you may enable compiler to perform context specific optimization on the body of function. Such optimizations are not possible for normal function calls. Other optimizations can be obtained by considering the flows of calling context and the called context.
- 5. Inline function may be useful (if it is small) for embedded systems because inline can yield less code than the function call preamble and return.
B. Disadvantages:
- 1. The added variables from the inlined function consume additional registers.
- 2. If you use too many inline functions then the size of the binary executable file will be large, because of the duplication of same code.
- 3. Too much inlining can also reduce your instruction cache hit rate, thus reducing the speed of instruction fetch from that of cache memory to that of primary memory.
- 4. Inline function may increase compile time overhead if someone changes the code inside the inline function then all the calling location has to be recompiled because compiler would require to replace all the code once again to reflect the changes, otherwise it will continue with old functionality.
- 5. Inline functions may not be useful for many embedded systems. Because in embedded systems code size is more important than speed.
Important Question with solutions | AKTU Quantums | Syllabus | Short Questions
Object Oriented Programming/System Design Btech Quantum PDF, Syllabus, Important Questions
Label | Link |
---|---|
Subject Syllabus | Syllabus |
Short Questions | Short-question |
Question paper – 2021-22 | 2021-22 |
Object Oriented Programming/System Design Quantum PDF | AKTU Quantum PDF:
Quantum Series | Links |
Quantum -2022-23 | 2022-23 |
AKTU Important Links | Btech Syllabus
Link Name | Links |
---|---|
Btech AKTU Circulars | Links |
Btech AKTU Syllabus | Links |
Btech AKTU Student Dashboard | Student Dashboard |
AKTU RESULT (One VIew) | Student Result |