Top 150 C++ Interview Questions and Answers
Updated 12 Feb 2025
Q1. What are classes in C++
Classes in C++ are user-defined data types that encapsulate data and functions.
Classes are used for object-oriented programming.
They allow for data abstraction and encapsulation.
Classes can have member variables and member functions.
Objects are instances of classes.
Inheritance and polymorphism are key features of classes.
Q2. What is C++ Java
C++ and Java are programming languages used for software development.
C++ is a high-performance language used for system programming, game development, and other performance-critical applications.
Java is an object-oriented language used for developing web applications, mobile apps, and enterprise software.
C++ is compiled, while Java is both compiled and interpreted.
C++ allows for direct memory manipulation, while Java has automatic memory management.
C++ is known for its speed ...read more
Q3. Why is c++ better than C?
C++ is better than C due to its object-oriented programming features and better memory management.
C++ supports object-oriented programming while C does not.
C++ has better memory management with features like constructors and destructors.
C++ has more advanced features like templates and exceptions.
C++ is more versatile and can be used for both low-level system programming and high-level application development.
C++ has a larger standard library compared to C.
C++ allows for func...read more
Q4. Wap to check the Armstrong number
Armstrong number is a number whose sum of cubes of digits is equal to the number itself.
Take input number from user
Find the number of digits in the number
Calculate the sum of cubes of each digit
Check if the sum is equal to the input number
Q5. HOW CAN WE EMBED PYTHON IN C++?
Python can be embedded in C++ using the Python/C API.
Include the Python header files in the C++ code.
Initialize the Python interpreter in the C++ code.
Call Python functions from C++ code using the Python/C API.
Pass data between Python and C++ using Python objects and C++ data types.
Compile the C++ code with the Python library.
Example: Embedding a Python script in a C++ program to perform complex calculations.
Q6. Explain file handling
File handling refers to the process of managing and manipulating files on a computer system.
File handling involves tasks such as creating, reading, writing, updating, and deleting files.
Common file operations include opening a file, reading its contents, writing data to it, and closing the file.
File handling in programming languages often involves using functions or libraries specifically designed for file operations.
Examples of file handling functions include fopen(), fread(...read more
Q7. HOW CAN WE EMBED ASSEMBLY LANGUAGE IN C++?
Assembly language can be embedded in C++ using inline assembly or by linking assembly files.
Inline assembly can be used to write assembly code directly in C++ code.
Assembly files can be linked with C++ code using the linker.
Inline assembly can be platform-specific and may require different syntax for different architectures.
Assembly code can be used to optimize critical sections of code for performance.
Debugging assembly code can be difficult and error-prone.
Q8. Tell about Data Structures in C++
Data structures in C++ are used to organize and store data efficiently.
C++ provides various built-in data structures like arrays, linked lists, stacks, queues, trees, and graphs.
These data structures can be used to store and manipulate data in an efficient manner.
C++ also allows for the creation of user-defined data structures using classes and structures.
The choice of data structure depends on the type of data and the operations that need to be performed on it.
C++ Jobs
Q9. Software we have worked with
I have worked with various payroll software including ADP, Paychex, and QuickBooks.
ADP
Paychex
QuickBooks
Q10. Design Patterns in C++
Design patterns in C++ are reusable solutions to common problems in software design.
Design patterns help in creating flexible, maintainable, and scalable code.
Examples of design patterns in C++ include Singleton, Factory, Observer, and Strategy.
Each design pattern has a specific purpose and can be applied in different scenarios.
Understanding design patterns can improve code quality and efficiency in software development.
Q11. Concurrency in C++
Concurrency in C++ allows multiple tasks to run simultaneously, improving performance and efficiency.
Concurrency in C++ can be achieved using threads, mutexes, condition variables, and atomic operations.
Threads allow multiple functions to run concurrently within the same program.
Mutexes are used to protect shared data from being accessed by multiple threads simultaneously.
Condition variables allow threads to wait for a certain condition to be met before proceeding.
Atomic oper...read more
Q12. Use of lambda expression
Lambda expressions are anonymous functions that can be used to create concise and readable code.
Lambda expressions are used to create inline functions without a formal definition.
They are often used in functional programming languages like Java, Python, and C++.
Lambda expressions can be used to pass functions as arguments to higher-order functions.
They are particularly useful for writing code that is more concise and readable.
Example: (x, y) -> x + y is a lambda expression th...read more
Q13. C++ vs go points
Go is simpler, more efficient, and easier to learn compared to C++.
Go has a simpler syntax and is easier to read and write compared to C++.
Go has built-in concurrency support with goroutines and channels, making it easier to write concurrent programs.
Go has a garbage collector, which simplifies memory management compared to manual memory management in C++.
Go compiles faster than C++ due to its simpler type system and lack of header files.
C++ has more features and is more powe...read more
Q14. Coding Exercise in desired language
Implement a coding exercise in the desired language
Understand the requirements of the coding exercise
Write clean and efficient code in the desired language
Test the code with different inputs to ensure correctness
Q15. Usage of This keyword
The 'this' keyword in JavaScript refers to the current object or context.
Used to refer to the current object within a method
Helps avoid naming conflicts with global variables
Can be used to call another method within the same object
Q16. What is the new operator used for?
The new operator is used to create an instance of a class or to allocate memory for an object.
The new operator is followed by the name of the class and parentheses.
It can also be used to create arrays of objects.
Example: MyClass obj = new MyClass();
Example: int[] arr = new int[5];
Q17. what is c+,c++ what is java
C+ and C++ are programming languages used for system and application development, while Java is a high-level programming language known for its portability and versatility.
C+ and C++ are low-level programming languages used for system programming and application development.
C++ is an extension of the C programming language with added features like classes and objects.
Java is a high-level programming language known for its portability and versatility, often used for web develo...read more
Q18. What is the diff between c and c++
C is a procedural programming language while C++ is an object-oriented programming language with features like classes and inheritance.
C is a procedural programming language while C++ is a multi-paradigm language with support for object-oriented programming.
C does not support classes and objects, while C++ does.
C uses structures for data organization, while C++ uses classes.
C does not have features like inheritance and polymorphism, which are present in C++.
C++ allows functio...read more
Q19. Explain the difference between C++ and Python?
C++ is a statically typed language with a focus on performance and low-level memory manipulation, while Python is dynamically typed and emphasizes readability and simplicity.
C++ is statically typed, meaning variable types must be declared at compile time, while Python is dynamically typed, allowing for more flexibility.
C++ is compiled directly into machine code, resulting in faster performance, while Python is interpreted at runtime, making it slower but easier to write and r...read more
Q20. How to declare file
To declare a file in software development, you typically need to specify the file type, name, and location.
Use a file declaration statement in the programming language you are using (e.g. 'File myFile = new File("example.txt");' in Java)
Specify the file type if necessary (e.g. '.txt' for text files, '.csv' for CSV files)
Provide the file name and location within the declaration statement (e.g. 'example.txt' or 'C:/Users/User/Documents/example.txt')
Q21. Data structures in C++
Data structures in C++ are used to store and organize data efficiently.
Data structures like arrays, linked lists, stacks, queues, trees, and graphs are commonly used in C++ programming.
Arrays are used to store a collection of elements of the same data type.
Linked lists are used to store elements in a linear order.
Stacks follow the Last In First Out (LIFO) principle.
Queues follow the First In First Out (FIFO) principle.
Trees are hierarchical data structures with a root node an...read more
You can find the size of an array in C or C++ by dividing the total size of the array by the size of one element.
Calculate the total size of the array by multiplying the number of elements by the size of each element.
Divide the total size by the size of one element to get the size of the array.
For example, if you have an array of strings arr[] = {'hello', 'world', 'example'}, you can find the size by dividing the total size of the array by the size of one string.
Q23. Difference between c,c++
C is a procedural programming language, while C++ is an object-oriented programming language that is an extension of C.
C is a procedural programming language, focusing on functions and procedures.
C++ is an object-oriented programming language, allowing for classes, objects, and inheritance.
C++ is an extension of C, adding features like classes, templates, and exception handling.
Q24. Advantages of python over c++
Python is easier to learn, has simpler syntax, and is more versatile than C++.
Python has a simpler syntax and is easier to read and write than C++.
Python is an interpreted language, which means it doesn't need to be compiled before running.
Python has a vast library of modules and packages that can be easily imported and used.
Python is more versatile than C++ and can be used for a wide range of applications, including web development, data analysis, and artificial intelligence...read more
Q25. can string class be extended
Yes, the string class can be extended in most programming languages.
Inheritance can be used to extend the functionality of the string class.
By creating a new class that inherits from the string class, additional methods and properties can be added.
Extending the string class allows for customization and adding specific functionality to strings.
Example: In Python, the string class can be extended by creating a new class that inherits from the built-in str class.
Q26. c vs c++ diff
C is a procedural programming language while C++ is an object-oriented programming language.
C is a procedural programming language, focusing on functions and procedures.
C++ is an object-oriented programming language, allowing for classes, objects, and inheritance.
C++ is an extension of C, adding features like classes, templates, and exception handling.
Q27. What is Qpointer?
QPointer is a deprecated Qt class used for storing and managing pointers.
QPointer is used to avoid dangling pointers in Qt applications.
It is a template class that can be used with any QObject-derived class.
QPointer is now deprecated and replaced by QWeakPointer.
QPointer can be used to check if a QObject is still valid before accessing it.
Q28. What is dpointer?
dpointer is a Qt framework concept used for efficient memory management.
dpointer is a private implementation pointer.
It is used to hide implementation details from the public API.
dpointer allows for copy-on-write semantics.
It reduces memory usage and improves performance.
Example: QString uses dpointer to store its data.
Example: QSharedDataPointer is used to share data between objects.
Q29. what are 3 steps for using function in c?
Three steps for using functions in C.
Declare the function with its return type, name, and parameters.
Define the function by writing the code for it.
Call the function by using its name and passing arguments if necessary.
Q30. what are the datatypes in C++?
C++ has various datatypes including int, float, char, bool, double, and more.
int - used for storing whole numbers
float - used for storing decimal numbers
char - used for storing single characters
bool - used for storing true or false values
double - used for storing double-precision floating-point numbers
Q31. What is mother of all classes?
There is no such thing as 'mother of all classes' in Selenium Automation.
There is no concept of 'mother of all classes' in Selenium Automation.
It is possible that the interviewer is asking a trick question or trying to test the candidate's knowledge.
The candidate should politely ask for clarification or context before attempting to answer.
If the interviewer insists on an answer, the candidate can explain that there is no such thing and provide examples of important classes in...read more
Q32. What are CPP for HSG, FBP, Compression,Coating, Blending
CPP for HSG, FBP, Compression, Coating, Blending
HSG - temperature, pressure, flow rate, and time
FBP - particle size distribution, moisture content, and bulk density
Compression - force, speed, and dwell time
Coating - spray rate, inlet temperature, and atomization pressure
Blending - mixing time, speed, and order of addition
Q33. What is the function of global keyword
Global keyword is used to define a variable as global, which can be accessed from any part of the program.
Global keyword is used to declare a variable outside of a function, making it accessible from any part of the program.
It is useful when a variable needs to be accessed by multiple functions or modules.
Global variables can be modified by any function that has access to them, which can lead to unexpected behavior.
Example: global x def func(): global x x = 10 func() print(x)...read more
Q34. Can I increment a void pointer?
No, incrementing a void pointer is not allowed.
Void pointers do not have a data type, so incrementing them is not possible.
Attempting to increment a void pointer will result in a compilation error.
To increment a pointer, it must be of a specific data type.
Q35. What are features of C++?
C++ is a high-level programming language with features like object-oriented programming, templates, and memory management.
C++ supports object-oriented programming concepts like encapsulation, inheritance, and polymorphism.
Templates allow generic programming and code reusability.
C++ provides low-level memory manipulation through pointers.
Standard Template Library (STL) provides a collection of classes and functions for data structures and algorithms.
C++ supports operator overl...read more
Q36. What are you good at in C++ ?
I am good at object-oriented programming, data structures, and algorithms in C++.
Strong understanding of object-oriented programming principles
Proficient in implementing data structures and algorithms in C++
Experience with memory management and pointers
Familiarity with C++ standard library and STL
Ability to optimize code for performance and efficiency
Q37. where is it necessary to use references
References are necessary when passing large objects to functions or when returning objects from functions.
When passing large objects to functions
When returning objects from functions
When working with complex data structures
When implementing operator overloading
When working with polymorphism
Q38. Can one edit standard libraries of C?
Yes, one can edit standard libraries of C.
Standard libraries of C are typically provided as source code, allowing developers to modify them.
Modifying standard libraries can be useful for fixing bugs, adding new features, or optimizing performance.
However, it is generally recommended to avoid modifying standard libraries directly to maintain compatibility and portability.
Instead, developers can create their own libraries or use existing third-party libraries for customization.
Q39. Explain stcl?
STCL stands for Software Test Case Language, a scripting language used for automated testing.
STCL is used to write test cases for software testing.
It is a scripting language that allows for automated testing.
STCL is used to define the steps and expected results of a test case.
It can be used with various testing tools such as Selenium and Appium.
STCL scripts can be easily maintained and updated as needed.
Q40. Why we use volatile key word
Volatile keyword is used to indicate that a variable's value can be changed unexpectedly.
Volatile keyword is used in multi-threaded programming to ensure that the value of a variable is always read from memory and not from a cache.
It is also used in embedded systems where hardware can change the value of a variable unexpectedly.
Without volatile keyword, the compiler may optimize the code by caching the value of a variable, which can lead to unexpected behavior.
Example: In a m...read more
Q41. How to use Tc modifer
The Tc modifier is used to indicate that a service was performed as a component of a larger service.
The Tc modifier is used for technical components of a service.
It is used to indicate that a service was performed using equipment owned by the provider.
The Tc modifier is used in conjunction with the 26 modifier, which indicates that a service was performed as a professional component.
For example, a radiologist may use the Tc modifier to indicate that they provided the technica...read more
Q42. What is defaulting?
Defaulting is the failure to fulfill a financial obligation or debt repayment.
Defaulting occurs when a borrower fails to make timely payments on a loan or debt.
It can result in penalties, fees, and damage to the borrower's credit score.
Examples include defaulting on a mortgage, car loan, or credit card debt.
Defaulting can also refer to the failure to meet contractual obligations in other areas, such as defaulting on a lease agreement.
Q43. What's manage and unmage in C++
manage and unmanage are not standard terms in C++
There are no standard terms or concepts called 'manage' and 'unmanage' in C++
These terms might be specific to a particular framework or library
Without more context, it is difficult to provide a specific answer
Q44. What is the use of main function.
Main function is the entry point of a program. It is used to execute the code in the program.
Main function is required in every program written in C, C++, Java, etc.
It is the first function to be executed when the program starts.
It can take command line arguments.
It returns an integer value to the operating system.
Example: int main() { // code to be executed }
Q45. how are static functions used in c/c++
Static functions in C/C++ are functions that can only be accessed within the same file they are defined in.
Static functions are declared using the 'static' keyword.
They cannot be called using an object or instance of a class.
They are useful for encapsulating functionality that is only relevant within a specific file.
Static functions can access only static variables and other static functions within the same file.
They are not part of the class's interface and cannot be overrid...read more
Q46. Why C++?
C++ is a powerful and versatile programming language widely used in system engineering.
C++ offers high performance and low-level control, making it suitable for system-level programming.
It supports object-oriented programming, allowing for modular and reusable code.
C++ has a large standard library and a vast ecosystem of third-party libraries and frameworks.
It provides features like templates, exception handling, and memory management.
C++ is used in various domains such as op...read more
Q47. Whats “preinitialization” View Answer
Preinitialization is the process of initializing data or objects before they are actually needed.
Preinitialization can improve performance by reducing the time needed to initialize data or objects when they are actually needed.
It can also help to avoid delays or interruptions during runtime.
Examples of preinitialization include preloading data into memory, initializing objects in advance, and caching frequently used data.
Q48. What does #include perform?
The #include directive is used to include a file in the source code.
It allows the programmer to use code from other files in their program.
The included file is processed by the preprocessor before compilation.
The syntax is #include
or #include "filename". Examples of included files are header files like
or user-defined header files.
Q49. How do you include new Cps?
New CPS can be included by identifying potential clients, building relationships, and providing value through product knowledge and excellent customer service.
Identify potential clients through market research and networking
Build relationships through regular communication and follow-up
Provide value through product knowledge and excellent customer service
Offer promotions or incentives to encourage new CPS to try your products
Track and analyze sales data to identify areas for ...read more
Q50. where to declare const pointers
Const pointers should be declared in the same scope as the variable they point to.
Declaring const pointers in the same scope as the variable they point to ensures that the pointer cannot be used to modify the variable.
If the pointer is only used within a function, it should be declared within that function.
If the pointer is used across multiple functions, it should be declared in a header file or at the top of the source file.
Examples: const int* ptr = &variable; const MyClas...read more
Q51. What is complete lft parmeter
Complete LFT parameter refers to a comprehensive set of liver function tests that assess the overall health and function of the liver.
Complete LFT parameter includes tests such as ALT, AST, ALP, bilirubin, albumin, and total protein.
These tests help in diagnosing liver diseases, monitoring liver function, and evaluating the effectiveness of treatment.
Abnormal results in LFT parameters can indicate liver damage, hepatitis, cirrhosis, or other liver disorders.
For example, eleva...read more
Q52. What is the difference between char a [] ="string";and char .p ="star";?
The first declaration creates an array of characters, while the second declaration creates a pointer to a character.
char a[] = "string"; creates an array of characters with the size determined by the length of the string.
char *p = "star"; creates a pointer to a character that points to the first character of the string.
Q53. common questions like
The question is about the common header file in C++.
The
header file is used for input/output operations in C++. It provides classes like cin and cout for reading and writing data.
It also includes classes for file input/output operations like ifstream and ofstream.
The header file can be included in a C++ program using the #include directive.
An inline function in C++ is a function that is expanded in place at the point of call, rather than being called like a regular function.
Inline functions are typically small and simple, as they are expanded in place at each call site.
They can improve performance by reducing the overhead of function calls.
Example: inline int square(int x) { return x * x; }
Q55. what is purpose of virtual keyword?
The virtual keyword is used in object-oriented programming to indicate that a method or property can be overridden in a derived class.
The virtual keyword allows for polymorphism, where a derived class can provide its own implementation of a method or property inherited from a base class.
It enables the concept of dynamic dispatch, where the appropriate method implementation is determined at runtime based on the actual type of the object.
The virtual keyword is typically used in...read more
Q56. You can work one type by various ways?
Yes, there are multiple ways to work on one type in computer operations.
Using different programming languages
Using different software tools
Using different algorithms or approaches
Using different hardware configurations
Q57. What is Cnc programming?
CNC programming is the process of creating instructions for a computer-controlled machine to perform specific tasks.
CNC stands for Computer Numerical Control
Programs are created using CAM software
Instructions are written in G-code
Used in manufacturing for precision and efficiency
Examples include milling, drilling, and turning operations
Q58. What is inline function in C++
Inline function is a function that is expanded in line when it is called.
Inline functions are defined with the 'inline' keyword.
They are used to improve performance by reducing function call overhead.
They are best suited for small functions that are called frequently.
Example: inline int square(int x) { return x * x; }
Q59. Write code for below: Removed number character before hash based on count of hash Case 1 I/P= abc#d O/P= abcd Case 2 I/P=abc##d O/p=ad
Write code to remove number character before hash based on count of hash
Count the number of hashes in the input string
Loop through the string and remove the character before the hash based on the count of hashes
Return the modified string
Q60. Explain about modifier
A modifier is a word or phrase that describes or changes the meaning of another word or phrase in a sentence.
Modifiers can be adjectives, adverbs, or phrases.
They provide additional information about the subject, verb, or object in a sentence.
Examples of modifiers include 'very' in 'very fast car' and 'in the park' in 'playing in the park.'
Q61. For what all purposes is the virtual keyword used in C++?
The virtual keyword is used in C++ for creating virtual functions and implementing polymorphism.
Used to create virtual functions that can be overridden by derived classes
Allows for dynamic binding of functions at runtime
Used in implementing polymorphism
Can be used with multiple inheritance to resolve ambiguity
Example: virtual void functionName() = 0; creates a pure virtual function
Q62. Implement add without “+†sign.
Implementing addition without using the + sign.
Use bitwise operators like XOR and AND to perform addition.
Convert the numbers to binary and perform addition bit by bit.
Use recursion to add the numbers.
Use a lookup table to perform addition.
Use the Math library to perform addition using functions like Math.floor and Math.ceil.
Q63. find the missing number from ? (1,3,4,5) two is missing write a program from that?
Program to find the missing number from an array of integers.
Create an array of integers with the given values.
Loop through the array and check for missing numbers.
Print the missing numbers.
Alternatively, use mathematical formula to find the missing number(s).
Q64. What is new operator?.
The new operator is used to dynamically allocate memory for an object at runtime.
It returns a pointer to the newly allocated memory.
It can be used to allocate memory for built-in types, user-defined types, and arrays.
The syntax is: new type;
Example: int *ptr = new int;
Example: MyClass *obj = new MyClass();
Q65. Explain for vcb
VCB stands for Vacuum Circuit Breaker, which is an electrical switch that uses vacuum as the dielectric medium.
VCB is used to protect electrical equipment from damage caused by overcurrents and short circuits.
It is commonly used in high voltage power systems.
VCBs are more reliable and require less maintenance compared to other types of circuit breakers.
They are also more environmentally friendly as they do not use any harmful gases.
Example of VCB manufacturers include Siemens...read more
Q66. What is cas
CAS stands for Columnstore Archive Storage in Azure SQL Database.
CAS is a storage tier in Azure SQL Database that is optimized for cold data storage.
It is designed to store large amounts of data that is infrequently accessed.
CAS uses columnstore indexing to achieve high compression rates and reduce storage costs.
Data can be moved to CAS using the ALTER TABLE command in SQL Server Management Studio.
CAS is a cost-effective solution for storing historical data, backups, and arch...read more
Q67. Write program on 1 01 101 1010 10101
The program prints a pattern of alternating 1s and 0s in a specific sequence.
Use a loop to iterate through the given sequence of numbers
Inside the loop, check the length of each number and print the corresponding pattern of 1s and 0s
Repeat the pattern until all numbers are processed
Q68. Can constant and volatile both be used at same time?
Yes, constant and volatile can be used together.
Constant variables are read-only and cannot be modified.
Volatile variables are used to indicate that the value may change unexpectedly.
Using both together can be useful in multi-threaded environments.
For example, a constant pointer to a volatile variable can be used to ensure thread safety.
The new keyword in C++ is used to dynamically allocate memory for an object or array.
Used to create objects on the heap: MyClass* obj = new MyClass();
Used to create arrays on the heap: int* arr = new int[10];
Q70. Why are taking reference?
Taking reference helps in understanding and improving the quality of work.
To gain knowledge and understanding of a particular subject or task
To improve the quality of work by learning from successful examples
To avoid mistakes and errors by learning from past experiences
To provide evidence and support for arguments or claims
To save time and effort by not reinventing the wheel
For inspiration and creativity
Q71. What is initializer list in C++ and code it with example?
Initializer list is a syntax in C++ to initialize objects with a list of values.
Initializer list is enclosed in curly braces {}.
It can be used to initialize arrays, structs, and classes.
Example: int arr[] = {1, 2, 3};
Example: struct Point { int x, y; } p = {1, 2};
Example: class Person { public: string name; int age; } p = {"John", 30};
Q72. What are the different storage classes in C++?
C++ has 5 storage classes: auto, register, static, extern, and mutable.
auto: default storage class for local variables
register: stores variables in CPU registers for faster access
static: retains value even after function call
extern: used to access global variables across multiple files
mutable: allows modification of a member variable declared as const
Q73. what is struct keyword
The struct keyword is used in programming languages to define a user-defined data type that contains multiple variables of different types.
Structs are used to group related data together.
They can have different types of variables, including other structs.
Structs can be used to create complex data structures.
They are commonly used in object-oriented programming languages.
Q74. Can you handel multi dimenssional assignment
Yes, I have experience in handling multi-dimensional assignments.
I have previously managed a team with diverse skill sets and responsibilities.
I am comfortable with delegating tasks and ensuring timely completion.
I have a strong understanding of project management and resource allocation.
I am adept at prioritizing tasks and managing multiple projects simultaneously.
Q75. Write any code for preincriment, Add two string
Preincrement code and string addition code in Java
Preincrement code: int i = 5; ++i;
String addition code: String str1 = "Hello "; String str2 = "World!"; String result = str1 + str2;
Q76. What is mean by share
A share is a unit of ownership in a company or corporation.
Shares represent a portion of ownership in a company
Shareholders have voting rights and may receive dividends
Shares can be bought and sold on stock exchanges
The value of shares can fluctuate based on market conditions
Q77. what is out keyword
The out keyword is used to pass arguments as reference parameters in C#.
The out keyword is used to return multiple values from a method.
The out keyword must be used in both the method signature and the method call.
The out keyword initializes the variable passed as an argument within the method.
The out keyword is similar to the ref keyword, but the variable passed as an argument does not need to be initialized before the method call.
In C++, a structure is a user-defined data type that can hold both data and functions, while a class can also have access specifiers and inheritance.
Structures in C++ are primarily used for grouping data members together, while classes can have additional features like access specifiers (public, private, protected) and inheritance.
Structures default to public access for their members, while classes default to private access.
Structures are typically used for simple data struct...read more
Q79. what is the c++ language definition?
C++ is a high-level programming language used for developing system software, application software, device drivers, and video games.
C++ was developed by Bjarne Stroustrup in 1983.
It is an extension of the C programming language.
C++ supports object-oriented programming, generic programming, and procedural programming.
It is used for developing operating systems, browsers, databases, and more.
Some popular applications developed using C++ include Adobe Photoshop, Microsoft Office...read more
Q80. What is cp
CP can refer to several things depending on the context, such as cost per click, cerebral palsy, or control point.
CP can stand for cost per click in online advertising.
CP can also refer to cerebral palsy, a group of disorders affecting movement and muscle tone.
In surveying, CP can mean control point, a point with known coordinates used as a reference for measurements.
CP can also stand for many other things depending on the context, such as chemical potential, critical path, o...read more
The types of access modifiers in C++ are public, private, and protected.
Public: accessible from outside the class
Private: only accessible within the class
Protected: accessible within the class and its subclasses
A namespace in C++ is a declarative region that provides a scope for the identifiers within it.
Namespaces help in organizing code by grouping related classes, functions, and variables.
They prevent naming conflicts by allowing the same name to be used in different namespaces.
Example: namespace myNamespace { int x; }
Example: using namespace std; // for using standard library functions without prefix
Q83. What is main
The main responsibility of a National Sales Manager is to oversee and manage the sales team and ensure that sales targets are met.
Managing and leading the sales team
Developing and implementing sales strategies
Setting sales targets and ensuring they are met
Analyzing sales data and making recommendations for improvement
Building and maintaining relationships with key clients
Collaborating with other departments to ensure smooth operations
Staying up-to-date with industry trends an...read more
Q84. What is the function involved in c++
Functions in C++ are blocks of code that perform a specific task and can be called from other parts of the program.
Functions are declared using the 'function' keyword followed by the return type, name, and parameters.
Functions can be defined inside or outside of classes.
Functions can be overloaded, meaning multiple functions can have the same name but different parameters.
Functions can also be recursive, meaning they call themselves.
Example: int add(int a, int b) { return a +...read more
Q85. Write A program take the name and print the hello user name ?
A program to take user name and print 'Hello, username'
Create a variable to store the user input
Use printf or cout to print the greeting with the user input
Q86. What is inlining?
Inlining is a compiler optimization technique that replaces a function call with the actual code of the function.
Inlining can improve performance by reducing the overhead of function calls.
Inlining is typically used for small functions that are called frequently.
Inlining can also increase code size and reduce the effectiveness of caching.
Inlining can be done manually or automatically by the compiler.
Example: inline int add(int a, int b) { return a + b; }
Example: int result = ...read more
Q87. What is use of volatile keyword
Volatile keyword is used to indicate that a variable's value can be changed unexpectedly.
It is used in embedded systems where hardware can change a variable's value
It tells the compiler not to optimize the variable
It ensures that the variable is always read from memory and not from a cache
Example: a variable that is updated by an interrupt service routine
Q88. 1. take two values a&b from user and print c= a+b
A program to take two values from user and print their sum.
Use input() function to take user input.
Convert input to integer using int() function.
Add the two values and store in a variable.
Print the result using print() function.
Q89. Write program for break program?
A program that breaks another program into smaller parts or components.
Use functions or modules to break down the main program into smaller, more manageable parts
Consider using object-oriented programming principles to encapsulate related functionality
Utilize comments and documentation to explain the purpose and functionality of each part
Q90. What is DCPP?
DCPP stands for Design Control and Process Performance. It is a quality management system used to ensure product design and manufacturing processes meet regulatory requirements.
DCPP is a quality management system used in various industries such as medical devices, pharmaceuticals, and aerospace.
It involves designing and controlling processes to ensure product quality and compliance with regulatory requirements.
DCPP includes activities such as risk management, design verificat...read more
Q91. Difference between CP & CCP
CP stands for Central Policy and CCP stands for Customized Central Policy.
CP is a predefined policy provided by Cyberark, while CCP is a policy customized by the administrator.
CP is a general policy that applies to all users, while CCP can be tailored to specific user roles or permissions.
CP may not meet all the organization's security requirements, whereas CCP can be adjusted to address specific needs.
CP is easier to implement and manage, while CCP requires more time and eff...read more
Q92. which is faster a++ or a=a+1
a++ is faster than a=a+1 because it is a single operation compared to two operations in a=a+1.
a++ is a single operation that increments the value of a directly
a=a+1 involves two operations - addition and assignment
Example: int a = 5; int b = a++; // b will be 5, a will be 6
Example: int a = 5; int b = a=a+1; // b will be 6, a will be 6
Q93. how you find call the doc
I use a combination of research, networking, and persistence to find and connect with doctors.
Research online directories and databases of medical professionals
Attend medical conferences and events to network with doctors
Utilize social media platforms to connect with doctors
Reach out to medical associations and organizations for referrals
Be persistent in following up with doctors to schedule a call or meeting
Q94. What is ptr full name
PTR stands for Project Technical Report.
PTR is a document that summarizes the technical aspects of a project.
It includes details such as project scope, objectives, methodology, results, and conclusions.
PTRs are often used to communicate project progress and findings to stakeholders.
Q95. What is c++ language and what the main sytax
C++ is a high-level programming language used for developing system software, application software, device drivers, and video games.
C++ was developed by Bjarne Stroustrup in 1983.
It is an extension of the C programming language.
C++ supports object-oriented programming, generic programming, and procedural programming.
The main syntax of C++ includes data types, variables, operators, control structures, functions, and classes.
Example: int main() { cout << 'Hello, World!'; return...read more
Q96. make int a = 0xabcd to a=0xcdab without using 2nd variable
Use bitwise operations to swap the bytes of the integer without using a second variable.
Use bitwise AND and bitwise OR operations to swap the bytes of the integer.
Shift the bytes to the correct positions using bitwise operations.
Example: a = 0xabcd; a = ((a & 0x00FF) << 8) | ((a & 0xFF00) >> 8);
Q97. What is reference variable
A reference variable is a variable that stores the memory address of another variable.
Reference variables are used to access the value of the variable they point to.
They are commonly used in programming languages like C++ and Java.
Example: int x = 10; int& ref = x; // ref now refers to the variable x
Q98. what is virtual destructor in c++
A virtual destructor in C++ is used to ensure that the correct destructor is called when deleting an object through a base class pointer.
Virtual destructors are necessary when deleting an object through a pointer to a base class in order to properly call the derived class destructor.
Without a virtual destructor, only the base class destructor would be called, potentially leading to memory leaks or undefined behavior.
Example: class Base { public: virtual ~Base() {} }; class De...read more
Q99. What happens when we use new keyword ?
The new keyword is used in object-oriented programming to create a new instance of a class or struct.
Used to allocate memory for a new object
Invokes the constructor of the class or struct
Returns a reference to the newly created object
Q100. What are inline functions?
Inline functions are functions defined with the 'inline' keyword, which instructs the compiler to insert the function's code directly where it is called.
Inline functions are typically used for small, frequently called functions to reduce the overhead of function calls.
They can improve performance by eliminating the function call overhead.
Inline functions are expanded by the compiler at the place where they are called, rather than being executed as a separate function.
Example:...read more
Top Interview Questions for Related Skills
Interview Questions of C++ Related Designations
Interview experiences of popular companies
Reviews
Interviews
Salaries
Users/Month