0% found this document useful (0 votes)
4 views5 pages

C++ OOP Concepts and Programming Basics

The document contains a series of questions related to C++ programming, covering topics such as Object-Oriented Programming (OOP), operators, control structures, and class functionalities. It includes explanations of concepts like the dot operator, copy constructors, friend functions, and the differences between text and binary files. Additionally, it addresses advantages and disadvantages of various programming constructs and provides examples for clarity.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views5 pages

C++ OOP Concepts and Programming Basics

The document contains a series of questions related to C++ programming, covering topics such as Object-Oriented Programming (OOP), operators, control structures, and class functionalities. It includes explanations of concepts like the dot operator, copy constructors, friend functions, and the differences between text and binary files. Additionally, it addresses advantages and disadvantages of various programming constructs and provides examples for clarity.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

CPP QUE’S

UNIT I

CH- 1

Q.3] Applications of OOP’s.

Q.4] Advantages and Disadvantages of OOP’s.

Q.5] Explain the Token - keywords in C++.

CH- 2

Q.4] What is programming constant. Explain in breif.

Q.5] Explain the type cast operator.

Q.6] Write precedence of operators.

CH- 3

Q.2] What is Switch code? Explain with example.

Q.3] What are Features & Limitations of Switch code?

Q.6] Difference between For loop & While loop.

Q.8] Difference between array & string.

CH- 4

Q.1] What is Dot operator? Explain with example.

The dot operator (.) is a fundamental operator in C++ used to access


members (data variables or member functions) of objects. It's also used for
calling member functions of objects.

Syntax:

object_name.member_name
object_name: The name of the object (instance of a class) you want to access
members of.

member_name: The name of the member (data variable or member function)


you want to access.

Accessing a Data Member, Calling a Member Function

The dot operator has high precedence in C++ expressions.

You can chain the dot operator to access nested members within objects
(e.g., object.member1.member2).

The dot operator is essential for working with objects and interacting with their
data and behavior in C++.

Q.2] Difference between Class Diagram & Object Diagram.

Q.6] Advantages and Disadvantages of Object Diagram.

Q.7] refer 1

Q.9] Explain Data member with example.

Q.13] Why need of a function in C++?

CH- 5

UNIT II

CH- 6

Q.2] refer 1

Q.3] What is copy constructor? Explain it's types.

In C++, a copy constructor is a special member function that creates a new


object of the same class as an existing object. It's typically used when you
need to create a copy of an object, independent of the original. Here's a
breakdown of its functionality:

Purpose:

Creates a new object that is a complete and independent copy of an existing


object.
Initializes the new object with the member values of the existing object.

Ensures deep copying for objects that contain pointers or references to


dynamically allocated memory.
class MyClass {
public:
// ... other members and methods
MyClass(const MyClass& other); // Copy constructor declaration
};

Q.4] Difference between copy constructor & assignment operator.

CH- 8

Q.3] Explain the scope specifiers in C++.

Q.7] What is virtual function? Explain with code.

Q.8] Difference between static & dyanamic binding.

UNIT III

CH- 9

Q.2] What is Friend Function? Explain with code.

In C++, a friend function is a special function that has access to the private
and protected members of a class even though it's not formally a member of
the class itself. This friend function is declared inside the class definition,
granting it special privileges.

Here's how friend functions work:

Declaration: A friend function is declared using the friend keyword inside the
class definition. You can friend another function or an entire class.

Access: The friend function can then access the private and protected
members of the class as if they were its own members. This allows the friend
function to perform operations on the class's data that would normally be
restricted to member functions.
Q.3] What is Friend Class? Explain with code.

Mix

Q.1] What is association modelmy?

Q.2] Explain the Inline Function.

Q.4] Difference between text file & binary file.

Text Files

Content: Store human-readable characters, typically encoded using a


character set like ASCII or Unicode.

Structure: Organized line by line, with line endings marked by special


characters (e.g., \n for newline in Unix-like systems, \r\n for newline and
carriage return in Windows).

Editing: Can be opened and edited using simple text editors because the
content is directly interpretable by humans.

Examples: .txt, .cpp, .html, .css (source code files are generally considered
text files).

Binary Files

Content: Store data in raw binary format, consisting of sequences of 0s and


1s. The interpretation of this data depends on the specific program or file
format that created the file.

Structure: Can have any internal structure, depending on the file format.
There's no inherent concept of lines or human-readable characters.

Editing: Cannot be directly edited using text editors because the content is
not meant to be human-readable. Special software or tools designed for the
specific file format are required.
Examples: .exe, .jpg, .mp3, .pdf (executable programs, image files, audio
files, and document files are typically binary files).

Q.5] Explain the notation on class diagram.

You might also like