Top 150 C++ Interview Questions and Answers

Updated 12 Feb 2025

Q1. What are classes in C++

Ans.

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.

Add your answer

Q2. What is C++ Java

Ans.

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

Add your answer
Frequently asked in

Q3. Why is c++ better than C?

Ans.

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

Add your answer

Q4. Wap to check the Armstrong number

Ans.

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

Add your answer
Are these interview questions helpful?

Q5. HOW CAN WE EMBED PYTHON IN C++?

Ans.

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.

Add your answer

Q6. Explain file handling

Ans.

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

Add your answer
Frequently asked in
Share interview questions and help millions of jobseekers 🌟

Q7. HOW CAN WE EMBED ASSEMBLY LANGUAGE IN C++?

Ans.

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.

View 1 answer

Q8. Tell about Data Structures in C++

Ans.

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.

Add your answer
Frequently asked in

C++ Jobs

Software Engineer III(C++) 4-9 years
NCR Voyix
3.9
Hyderabad / Secunderabad
Embedded Developer 3-6 years
Larsen & Toubro (L&T)
4.0
₹ 1 L/yr - ₹ 1 L/yr
Hazira
Hiring Mech, Civil, Arch, CSE, IT, ECE, EEE & MBA Candidates 0-5 years
CADD Centre Training Services Private Limited
4.3
₹ 1 L/yr - ₹ 2 L/yr
Katpadi

Q9. Software we have worked with

Ans.

I have worked with various payroll software including ADP, Paychex, and QuickBooks.

  • ADP

  • Paychex

  • QuickBooks

Add your answer
Frequently asked in

Q10. Design Patterns in C++

Ans.

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.

Add your answer
Frequently asked in

Q11. Concurrency in C++

Ans.

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

Add your answer
Frequently asked in

Q12. Use of lambda expression

Ans.

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

Add your answer
Frequently asked in

Q13. C++ vs go points

Ans.

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

Add your answer

Q14. Coding Exercise in desired language

Ans.

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

Add your answer
Frequently asked in

Q15. Usage of This keyword

Ans.

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

Add your answer

Q16. What is the new operator used for?

Ans.

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];

View 1 answer
Frequently asked in

Q17. what is c+,c++ what is java

Ans.

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

Add your answer
Frequently asked in

Q18. What is the diff between c and c++

Ans.

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

Add your answer
Frequently asked in

Q19. Explain the difference between C++ and Python?

Ans.

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

Add your answer

Q20. How to declare file

Ans.

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')

Add your answer
Frequently asked in

Q21. Data structures in C++

Ans.

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

Add your answer

Q22. can string class be extended

Ans.

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.

Add your answer

Q23. Difference between c,c++

Ans.

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.

Add your answer
Frequently asked in

Q24. Advantages of python over c++

Ans.

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

Add your answer

Q25. What is Qpointer?

Ans.

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.

View 1 answer
Frequently asked in

Q26. c vs c++ diff

Ans.

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.

Add your answer
Frequently asked in

Q27. What is dpointer?

Ans.

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.

Add your answer
Frequently asked in

Q28. what are 3 steps for using function in c?

Ans.

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.

Add your answer
Frequently asked in

Q29. what are the datatypes in C++?

Ans.

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

Add your answer
Frequently asked in

Q30. What is mother of all classes?

Ans.

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

Add your answer
Frequently asked in

Q31. What are CPP for HSG, FBP, Compression,Coating, Blending

Ans.

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

Add your answer
Frequently asked in

Q32. What is the function of global keyword

Ans.

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

Add your answer
Frequently asked in

Q33. Can I increment a void pointer?

Ans.

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.

Add your answer
Frequently asked in

Q34. What are features of C++?

Ans.

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

Add your answer
Frequently asked in

Q35. What are you good at in C++ ?

Ans.

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

View 1 answer
Frequently asked in

Q36. where is it necessary to use references

Ans.

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

View 1 answer
Frequently asked in

Q37. Can one edit standard libraries of C?

Ans.

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.

Add your answer
Frequently asked in

Q38. Explain stcl?

Ans.

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.

Add your answer

Q39. Why we use volatile key word

Ans.

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

Add your answer

Q40. What is defaulting?

Ans.

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.

Add your answer
Frequently asked in

Q41. How to use Tc modifer

Ans.

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

Add your answer

Q42. What's manage and unmage in C++

Ans.

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

Add your answer

Q43. What is the use of main function.

Ans.

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 }

Add your answer

Q44. how are static functions used in c/c++

Ans.

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

Add your answer

Q45. Why C++?

Ans.

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

View 1 answer
Frequently asked in

Q46. Whats “preinitialization” View Answer

Ans.

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.

Add your answer

Q47. What does #include perform?

Ans.

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.

Add your answer

Q48. How do you include new Cps?

Ans.

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

Add your answer

Q49. What is complete lft parmeter

Ans.

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

View 4 more answers

Q50. where to declare const pointers

Ans.

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

Add your answer
Frequently asked in

Q51. common questions like

Ans.

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.

Add your answer
Frequently asked in

Q52. What is the difference between char a [] ="string";and char .p ="star";?

Ans.

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.

Add your answer
Frequently asked in

Q53. what is purpose of virtual keyword?

Ans.

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

Add your answer
Frequently asked in

Q54. You can work one type by various ways?

Ans.

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

View 1 answer

Q55. What is inline function in C++

Ans.

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; }

Add your answer
Frequently asked in

Q56. What is Cnc programming?

Ans.

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

Add your answer

Q57. 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

Ans.

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

Add your answer

Q58. Explain about modifier

Ans.

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.'

Add your answer

Q59. For what all purposes is the virtual keyword used in C++?

Ans.

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

Add your answer
Frequently asked in

Q60. find the missing number from ? (1,3,4,5) two is missing write a program from that?

Ans.

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).

Add your answer
Frequently asked in

Q61. Implement add without “+” sign.

Ans.

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.

Add your answer
Frequently asked in

Q62. What is new operator?.

Ans.

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();

Add your answer
Frequently asked in

Q63. Explain for vcb

Ans.

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

Add your answer

Q64. What is cas

Ans.

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

Add your answer

Q65. Write program on 1 01 101 1010 10101

Ans.

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

View 1 answer
Frequently asked in

Q66. Can constant and volatile both be used at same time?

Ans.

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.

Add your answer
Frequently asked in

Q67. Why are taking reference?

Ans.

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

Add your answer
Frequently asked in

Q68. What are the different storage classes in C++?

Ans.

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

Add your answer
Frequently asked in

Q69. Can you handel multi dimenssional assignment

Ans.

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.

Add your answer

Q70. Write any code for preincriment, Add two string

Ans.

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;

Add your answer

Q71. what is struct keyword

Ans.

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.

View 1 answer

Q72. What is initializer list in C++ and code it with example?

Ans.

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};

Add your answer
Frequently asked in

Q73. What is mean by share

Ans.

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

Add your answer

Q74. what is out keyword

Ans.

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.

Add your answer

Q75. what is the c++ language definition?

Ans.

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

Add your answer
Frequently asked in

Q76. What is cp

Ans.

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

Add your answer

Q77. What is main

Ans.

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

Add your answer

Q78. What is the function involved in c++

Ans.

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

Add your answer
Frequently asked in

Q79. Write A program take the name and print the hello user name ?

Ans.

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

Add your answer

Q80. What is use of volatile keyword

Ans.

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

Add your answer

Q81. 1. take two values a&b from user and print c= a+b

Ans.

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.

Add your answer
Frequently asked in

Q82. Write program for break program?

Ans.

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

Add your answer
Frequently asked in

Q83. What is inlining?

Ans.

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

Add your answer
Frequently asked in

Q84. Difference between CP & CCP

Ans.

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

Add your answer
Frequently asked in

Q85. which is faster a++ or a=a+1

Ans.

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

Add your answer

Q86. What is DCPP?

Ans.

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

Add your answer

Q87. how you find call the doc

Ans.

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

Add your answer

Q88. What is ptr full name

Ans.

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.

View 1 answer

Q89. What is c++ language and what the main sytax

Ans.

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

Add your answer

Q90. make int a = 0xabcd to a=0xcdab without using 2nd variable

Ans.

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);

Add your answer

Q91. What is reference variable

Ans.

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

Add your answer

Q92. what is virtual destructor in c++

Ans.

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

Add your answer
Frequently asked in

Q93. What happens when we use new keyword ?

Ans.

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

Add your answer

Q94. What are inline functions?

Ans.

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

Add your answer

Q95. Write a program that converts the alternate letters of a sentence into uppercase, whitespace excluded

Ans.

Program to convert alternate letters of a sentence to uppercase, excluding whitespace

  • Iterate through each character of the sentence

  • Check if the character is a letter and if its index is odd

  • Convert the letter to uppercase if conditions are met

Add your answer
Frequently asked in

Q96. what is auto keyword ?

Ans.

The auto keyword is used in C++ to automatically deduce the data type of a variable.

  • Used in C++ to automatically deduce the data type of a variable

  • Introduced in C++11

  • Helps in writing more concise and readable code

Add your answer
Frequently asked in

Q97. Can you explain virtual keyword

Ans.

The virtual keyword in C++ is used to declare a member function in a base class that can be overridden in a derived class.

  • Virtual keyword is used to achieve runtime polymorphism in C++

  • Virtual functions are declared in a base class and can be overridden in derived classes

  • When a virtual function is called, the actual function that gets executed is determined at runtime based on the type of object

Add your answer

Q98. How much do you know about c++ lanuage?

Ans.

I have a strong understanding of C++ language, including object-oriented programming concepts and data structures.

  • Proficient in C++ syntax and features

  • Familiar with object-oriented programming concepts like classes and inheritance

  • Knowledge of data structures like arrays, linked lists, and trees

  • Experience with C++ libraries like STL for algorithms and data structures

Add your answer

Q99. What is rule of 5 in C++

Ans.

Rule of 5 in C++ states that if a class needs to define any of the following functions, it should explicitly define all of them: destructor, copy constructor, copy assignment operator, move constructor, move assignment operator.

  • Rule of 5 helps in managing resources and preventing memory leaks in C++ classes.

  • If a class needs to define any of the mentioned functions, it should define all of them to ensure proper resource management.

  • Example: If a class has a custom destructor, i...read more

Add your answer

Q100. What is the CP Cpl

Ans.

CP Cpl stands for Cost Per Completed Lead, a metric used in marketing to measure the cost of generating a lead that has been successfully completed.

  • CP Cpl is calculated by dividing the total cost of generating leads by the number of completed leads.

  • It helps in determining the efficiency and effectiveness of lead generation campaigns.

  • For example, if a marketing campaign costs $1000 and generates 50 completed leads, the CP Cpl would be $20.

Add your answer
1
2
Interview Tips & Stories
Ace your next interview with expert advice and inspiring stories

Interview experiences of popular companies

3.7
 • 10.5k Interviews
3.8
 • 8.2k Interviews
3.6
 • 7.6k Interviews
3.7
 • 5.7k Interviews
3.8
 • 5.6k Interviews
3.7
 • 4.8k Interviews
3.5
 • 3.9k Interviews
3.5
 • 3.8k Interviews
3.8
 • 3k Interviews
View all
C++ Interview Questions
Share an Interview
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
70 Lakh+

Reviews

5 Lakh+

Interviews

4 Crore+

Salaries

1 Cr+

Users/Month

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter