Top 150 C++ Interview Questions and Answers

Updated 12 Feb 2025

Q101. 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
right arrow
Frequently asked in

Q102. 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
right arrow

Q103. 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
right arrow
Frequently asked in

Q104. 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
right arrow
Frequently asked in
Are these interview questions helpful?

Q105. 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
right arrow
Frequently asked in

Q106. 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
right arrow
Share interview questions and help millions of jobseekers 🌟

Q107. 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
right arrow

Q108. 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
right arrow
Frequently asked in

C++ Jobs

PD - Thermal Design Engineer 4-9 years
Foxconn Hon Hai Technology India Mega Development Private Limited
3.9
₹ 5 L/yr - ₹ 6 L/yr
Bangalore / Bengaluru
Embedded Developer 3-6 years
Larsen & Toubro (L&T)
4.0
₹ 1 L/yr - ₹ 1 L/yr
Hazira
Qa Engineer 3-5 years
Aster DM Healthcare
3.8
Bangalore / Bengaluru

Q109. 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
right arrow
Frequently asked in

Q110. 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
right arrow
Frequently asked in

Q111. 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
right arrow
Frequently asked in

Q112. 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
right arrow
Frequently asked in

Q113. 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
right arrow

Q114. 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
right arrow

Q115. 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
right arrow

Q116. 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
right arrow
Frequently asked in

Q117. 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
right arrow
Frequently asked in

Q118. 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
right arrow

Q119. 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
right arrow

Q120. What are out keyword?

Ans.

The 'out' keyword is used in C# to pass arguments by reference, allowing the method to modify the value of the argument.

  • Used to pass arguments by reference in C#

  • Allows the method to modify the value of the argument

  • Must be assigned a value inside the method before returning

Add your answer
right arrow

Q121. Which version of c++ you use

Ans.

I primarily use C++17, but I am familiar with earlier versions as well.

  • I am comfortable working with features introduced in C++17 such as structured bindings and constexpr if

  • I have experience with earlier versions like C++11 and C++14

  • I stay updated with the latest features and improvements in C++ standards

Add your answer
right arrow
Frequently asked in

Q122. What is readonly?

Ans.

readonly keyword is used in C# to declare that a field can only be assigned a value during initialization or in a constructor.

  • readonly keyword can only be used on fields, not properties.

  • The value of a readonly field can only be changed in the constructor of the class.

  • Using readonly fields can help ensure that certain values remain constant throughout the lifetime of an object.

Add your answer
right arrow
Frequently asked in

Q123. what is inline keyword

Ans.

The inline keyword is used in Kotlin to suggest that a function should be inlined at the call site.

  • Used to eliminate the overhead of function calls by copying the function code directly at the call site

  • Helps in improving performance by reducing the function call overhead

  • Should be used for small functions or lambdas to avoid unnecessary function call overhead

Add your answer
right arrow
Frequently asked in

Q124. how to swap two nos without using another variable ?

Ans.

Swapping two numbers without using another variable

  • Use the XOR operation to swap the numbers

  • Perform XOR operation on the two numbers

  • The result will be the swapped values

Add your answer
right arrow
Frequently asked in

Q125. What are macros

Ans.

Macros are automated scripts that can be used to perform repetitive tasks in Servicenow.

  • Macros in Servicenow are used to automate tasks and reduce manual effort.

  • They can be used to update multiple records at once, send notifications, or perform calculations.

  • Macros can be triggered manually or automatically based on certain conditions.

  • Example: Creating a macro to automatically close all resolved incidents in Servicenow.

Add your answer
right arrow
Frequently asked in

Q126. When will you use private constructor ?

Ans.

Private constructors are used to prevent instantiation of a class from outside the class itself.

  • Private constructors are used in classes that should not be instantiated directly by external code.

  • They are often used in classes that contain only static methods or properties.

  • Private constructors can also be used in singleton design pattern to ensure only one instance of a class is created.

Add your answer
right arrow

Q127. What's enum class?

Ans.

Enum class is a strongly-typed class that defines a set of named constants.

  • Enum class is introduced in C++11 to provide type-safe enums.

  • It allows defining a set of named constants that can be used as values.

  • Each constant in an enum class is treated as a separate type, preventing type mismatches.

  • Example: enum class Color { RED, GREEN, BLUE };

  • Example: Color c = Color::RED;

Add your answer
right arrow
Frequently asked in

Q128. C++ define in cute way

Ans.

C++ is a powerful programming language known for its efficiency and flexibility.

  • C++ is a statically typed language

  • It supports object-oriented programming

  • It allows for low-level memory manipulation

  • Example: defining a class in C++ - class Car { public: int speed; };

Add your answer
right arrow
Frequently asked in

Q129. What is #include

Ans.

The #include directive is used in C and C++ programming languages to include the contents of another file in the current file.

  • Used to include header files that contain function prototypes and declarations

  • Improves code organization and reusability

  • Example: #include includes the standard input/output library in the current file

Add your answer
right arrow
Frequently asked in

Q130. Explain if we remove static keyword from main function what will happen.

Ans.

Removing static keyword from main function will not have any impact on the program's functionality.

  • Removing static keyword from main function will not affect the program's execution.

  • The main function in C/C++ is always called by the operating system, regardless of whether it is static or not.

  • Static keyword in main function is optional and does not change the behavior of the program.

Add your answer
right arrow

Q131. when we use volatile and const at the same time what will happen

Ans.

When volatile and const are used together, the variable is treated as read-only and its value can change unexpectedly.

  • The const keyword indicates that the variable's value cannot be changed by the program.

  • The volatile keyword tells the compiler that the variable's value may change at any time, even if it doesn't appear to be modified by the program.

  • When used together, the variable is treated as read-only by the program, but its value can still change unexpectedly due to exter...read more

Add your answer
right arrow

Q132. What are the modifier.

Ans.

Modifiers are codes used in medical billing to provide additional information about a service or procedure.

  • Modifiers are two-digit codes appended to a CPT or HCPCS code to indicate that a service or procedure has been altered in some way

  • Modifiers can affect reimbursement rates, indicate that multiple procedures were performed, or provide more specific information about the service

  • For example, modifier -59 is used to indicate a distinct procedural service

Add your answer
right arrow

Q133. Why using class?

Ans.

Using classes in programming allows for better organization, encapsulation, and reusability of code.

  • Classes help organize code by grouping related data and functions together

  • Encapsulation allows for data hiding and protection, preventing direct access to data from outside the class

  • Classes promote code reusability through inheritance and polymorphism

Add your answer
right arrow
Frequently asked in

Q134. Code to print * in five consecutive lines

Ans.

Code to print * in five consecutive lines

  • Use a loop to iterate five times

  • Inside the loop, print a string containing a single * character

View 5 more answers
right arrow

Q135. Use of the 'static' Keyword

Ans.

The 'static' keyword is used in programming to declare variables, functions, or classes that retain their values or state across multiple function calls or instances.

  • Static variables are initialized only once and retain their values throughout the program's execution.

  • Static functions can only access other static variables and functions within the same class.

  • Static classes cannot be instantiated and are used to provide utility functions or constants.

  • Static keyword can also be ...read more

View 2 more answers
right arrow

Q136. Software known

Ans.

I am proficient in AutoCAD, SolidWorks, and Revit.

  • AutoCAD: Used for 2D drafting and 3D modeling.

  • SolidWorks: Used for mechanical design and simulation.

  • Revit: Used for architectural design and building information modeling.

View 2 more answers
right arrow

Q137. Advantages of using c++

Ans.

C++ offers high performance, low-level control, and a wide range of applications.

  • C++ is faster than many other programming languages due to its low-level control.

  • C++ is widely used in developing operating systems, game engines, and high-performance applications.

  • C++ supports object-oriented programming, templates, and generic programming.

  • C++ has a large community and a vast library of pre-built functions and classes.

  • C++ is backward compatible with C, allowing for easy integrat...read more

Add your answer
right arrow

Q138. 12. Is INCLUDE executable statement

Ans.

Yes, INCLUDE is an executable statement in SAP ABAP.

  • INCLUDE statement is used to include a program or a subroutine in another program.

  • It is executed at runtime and the included program or subroutine is executed as part of the main program.

  • INCLUDE statement can be used to modularize the code and improve reusability.

  • Example: INCLUDE [OBJECT ].

Add your answer
right arrow

Q139. OOP Concept they have Taken?

Ans.

Encapsulation, Inheritance, Polymorphism, Abstraction

  • Encapsulation: bundling of data and methods that act on that data within a single unit

  • Inheritance: ability of a class to inherit properties and methods from a parent class

  • Polymorphism: ability of objects to take on many forms

  • Abstraction: hiding of complex implementation details and showing only the necessary information

Add your answer
right arrow
Frequently asked in

Q140. Technologies used

Ans.

Various technologies including Java, Python, SQL, AWS, Docker, etc.

  • Java

  • Python

  • SQL

  • AWS

  • Docker

Add your answer
right arrow
Frequently asked in, ,

Q141. One program from list

Ans.

Visual Studio Code

  • Free and open-source code editor

  • Supports multiple programming languages

  • Has a large library of extensions

  • Integrates with Git for version control

Add your answer
right arrow

Q142. Coding excercise for choosen programming launguage

Ans.

I would choose Python and ask the candidate to write a program to find the largest number in an array.

  • Ask the candidate to create an array of numbers

  • Write a function to iterate through the array and find the largest number

  • Test the function with different arrays to ensure it works correctly

Add your answer
right arrow

Q143. Use of Cond parameter

Ans.

Cond parameter is used to conditionally render elements in React.

  • It is a ternary operator that takes three arguments.

  • The first argument is the condition to be evaluated.

  • The second argument is the element to be rendered if the condition is true.

  • The third argument is the element to be rendered if the condition is false.

  • It can be used to render different elements based on the state of the component.

Add your answer
right arrow
Frequently asked in

Q144. what is the use of 'friend' access specifier in c++? ( redundancy)

Ans.

The 'friend' access specifier in C++ allows a non-member function or class to access private and protected members of a class.

  • The 'friend' keyword is used to declare a function or class as a friend of a class.

  • A friend function can access private and protected members of the class it is declared as a friend of.

  • A friend class can access private and protected members of the class it is declared as a friend of.

  • The 'friend' keyword does not affect the access specifiers of the clas...read more

Add your answer
right arrow
Frequently asked in

Q145. C++ code given to write output

Ans.

C++ code given to write output

  • Understand the input and expected output

  • Use cout to print output to console

  • Handle errors and edge cases

Add your answer
right arrow

Q146. Y use header file gv one eg

Ans.

Header files are used to declare functions, variables, and constants that are used in multiple source files.

  • Header files allow for modular programming and code reuse.

  • They help to avoid code duplication and reduce errors.

  • Examples of header files include stdio.h, math.h, and string.h.

  • Header files are included using the #include preprocessor directive.

Add your answer
right arrow
Frequently asked in

Q147. use of volatile const ?

Ans.

Volatile const is used to indicate that a variable's value may change outside the program's control.

  • Volatile const is used for hardware registers that can change their value without the program's knowledge.

  • It is also used for variables that are accessed by multiple threads.

  • Example: volatile const int* const ptr = (int*)0x1234; // pointer to a hardware register

Add your answer
right arrow

Q148. Realted coding guild lines

Ans.

Coding guidelines are important for accurate and consistent medical coding.

  • Coding guidelines provide instructions on how to properly assign codes for diagnoses and procedures.

  • They help ensure accurate and consistent coding across different healthcare settings.

  • Guidelines are updated regularly to reflect changes in medical terminology and coding practices.

  • Examples of coding guidelines include the ICD-10-CM Official Guidelines for Coding and Reporting and the CPT Assistant newsl...read more

Add your answer
right arrow

Q149. Technology used for work

Ans.

I use a variety of technologies for work.

  • I primarily use Microsoft Office Suite for documentation and communication.

  • I also use project management tools like Jira and Trello.

  • For data analysis, I use Excel and SQL.

  • I have experience with programming languages like Python and Java.

  • I am familiar with cloud computing platforms like AWS and Azure.

  • I use collaboration tools like Slack and Zoom for remote work.

  • I am constantly learning and adapting to new technologies as needed.

Add your answer
right arrow

Q150. C++ Development which year

Ans.

C++ development started in 1983.

  • C++ was developed by Bjarne Stroustrup at Bell Labs.

  • The first commercial C++ compiler was released in 1985.

  • C++11 was released in 2011, introducing new features like lambda expressions and range-based for loops.

Add your answer
right arrow

Q151. Knowledge of Software in which you previously have worked

Ans.

I have worked with various software including AutoCAD, SolidWorks, and MATLAB.

  • Proficient in AutoCAD for 2D drafting and SolidWorks for 3D modeling

  • Experience in MATLAB for data analysis and simulation

  • Familiarity with ANSYS for finite element analysis

  • Knowledge of Adobe Creative Suite for graphic design

Add your answer
right arrow

Q152. Experience in Skill set/ Technology expertise / Programming language

Ans.

I have extensive experience in various skill sets, technology expertise, and programming languages.

  • Proficient in project management methodologies such as Agile and Waterfall

  • Expertise in using project management tools like JIRA and Trello

  • Strong knowledge of programming languages such as Java, Python, and C++

  • Experience in web development technologies like HTML, CSS, and JavaScript

  • Familiarity with database management systems like MySQL and MongoDB

View 1 answer
right arrow

Q153. use of namespace in c++

Ans.

Namespace in C++ is used to avoid naming conflicts and organize code.

  • Namespace allows grouping of related functions, classes, and variables.

  • It helps in avoiding naming conflicts by providing a unique identifier to each entity.

  • Namespace can be nested within another namespace.

  • Using namespace keyword, we can access the entities within a namespace.

  • Example: namespace std { class string {}; }

  • Example: using namespace std; string s;

Add your answer
right arrow
Frequently asked in

Q154. Maintenance of CPP Portion of CPP

Ans.

Maintenance of CPP involves regular inspections, repairs, and upgrades to ensure efficient operation.

  • Regularly inspecting and lubricating machinery components

  • Performing preventive maintenance tasks to avoid breakdowns

  • Replacing worn out parts to prevent failures

  • Upgrading equipment to improve efficiency and reliability

  • Keeping detailed maintenance records for future reference

Add your answer
right arrow

Q155. Examples for application programs and System programming

Ans.

Application programs are designed for end-users while system programming is for the operating system.

  • Application programs: Microsoft Word, Adobe Photoshop, Google Chrome

  • System programming: device drivers, operating system kernels, firmware

  • Application programs are written in high-level languages while system programming is written in low-level languages

  • Application programs are used to perform specific tasks while system programming is used to manage hardware resources

  • Applicati...read more

Add your answer
right arrow

Q156. Lamda expression used

Ans.

Lambda expressions are used in Java to create anonymous functions.

  • Lambda expressions are used to provide a concise way to represent a method that can be passed around.

  • They are commonly used in functional interfaces, such as Java's streams API.

  • Syntax: (parameters) -> expression or (parameters) -> { statements; }

  • Example: (int a, int b) -> a + b

Add your answer
right arrow
Frequently asked in

Q157. coding in preferred languages

Ans.

I am proficient in coding in Java, Python, and SQL.

  • Proficient in Java, Python, and SQL programming languages

  • Have experience in writing test scripts and automation using Java and Python

  • Familiar with SQL for database testing and querying

Add your answer
right arrow

Q158. programming cnc and codes application

Ans.

Programming CNC involves writing instructions for the machine to follow, using codes to control its movements and operations.

  • Understand the CNC machine's capabilities and limitations

  • Write code using G-code or M-code to control the machine

  • Test the program on a simulator before running it on the actual machine

  • Make adjustments based on feedback and results

  • Examples: G00 for rapid movement, G01 for linear interpolation

Add your answer
right arrow

Q159. List const and var difference

Ans.

const is used for variables that should not be reassigned, while var allows for reassignment

  • const is block-scoped, var is function-scoped

  • const cannot be reassigned, var can be reassigned

  • const must be initialized during declaration, var can be declared without initialization

Add your answer
right arrow

Q160. Static keyword explain

Ans.

Static keyword is used in Java to create class-level variables and methods.

  • Static variables are shared among all instances of a class

  • Static methods can be called without creating an instance of the class

  • Static keyword can also be used to create static blocks for initialization

Add your answer
right arrow
Frequently asked in

Q161. Fundamentals of Coding in trend

Ans.

Understanding the basics of coding trends and practices.

  • Stay updated on the latest programming languages and frameworks.

  • Practice regularly to improve coding skills.

  • Collaborate with other developers to learn new techniques.

  • Attend coding workshops and conferences for networking and knowledge sharing.

Add your answer
right arrow

Q162. Wap string releted program

Ans.

Write a program to manipulate strings in a specific way.

  • Use string manipulation functions to modify the input string

  • Consider using loops to iterate through the characters of the string

  • Implement logic to perform the required operations on the string

Add your answer
right arrow

Q163. You are given a string, name and an integer which is year of birth. You need to print the reverse of year of birth followed by the reverse of name.

Ans.

Reverse the year of birth and name, then print them in that order.

  • Reverse the year of birth using StringBuilder.reverse() method

  • Reverse the name using StringBuilder.reverse() method

  • Print the reversed year of birth followed by the reversed name

Add your answer
right arrow

Q164. gsftsubmit used in

Ans.

gsftsubmit is used in ServiceNow to submit a form or record.

  • Used to submit a form or record in ServiceNow

  • Can be used in client scripts or UI actions

  • Example: gsftsubmit();

Add your answer
right arrow

Q165. Fir what we used.. / in code?

Ans.

The / is used to close an opening tag in HTML code.

  • The / is used to close self-closing tags like .

  • It is also used to close opening tags like

    .

  • It is not used in closing tags like .

Add your answer
right arrow

Q166. Codes been used for design & software used

Ans.

The codes used for design are typically building codes such as ACI, AISC, and software like ETABS, SAP2000.

  • Building codes such as ACI, AISC are commonly used for structural design

  • Software like ETABS, SAP2000 are used for analysis and modeling

Add your answer
right arrow

Q167. Code snippet results

Ans.

The code snippet results in an array of strings.

  • The code snippet should be provided to analyze the result.

  • The expected output should be an array of strings.

  • Check for any error handling or edge cases in the code snippet.

Add your answer
right arrow

Q168. Static Keyword Uses

Ans.

Static keyword is used in programming languages to declare variables, methods, or classes that belong to the class itself rather than instances of the class.

  • Static variables retain their values between function calls

  • Static methods can be called without creating an instance of the class

  • Static classes cannot be instantiated and are used for grouping related methods and variables

  • Static keyword is used in Java, C++, C#, and other programming languages

Add your answer
right arrow
Frequently asked in

Q169. Skill level with coding

Ans.

Proficient in coding with experience in languages like Java, Python, and SQL.

  • Experience in writing test scripts using Java for automation testing

  • Familiarity with Python for data analysis and scripting tasks

  • Knowledge of SQL for database testing and querying

  • Ability to read and understand code written in various languages

Add your answer
right arrow
Frequently asked in

Q170. While ,do while syntax

Ans.

The while loop executes a block of code as long as the specified condition is true, while the do while loop executes the block of code once before checking the condition.

  • While loop syntax: while (condition) { // code block to be executed }

  • Do while loop syntax: do { // code block to be executed } while (condition);

  • The do while loop will always execute the code block at least once, even if the condition is false.

Add your answer
right arrow
Frequently asked in

Q171. Lamda expression and usage

Ans.

Lambda expressions are anonymous functions used to create concise code in languages like Java.

  • Lambda expressions are used to create anonymous functions without a name.

  • They are commonly used in functional programming languages like Java.

  • Lambda expressions can be used to implement functional interfaces with a single abstract method.

  • Syntax: (parameters) -> expression or (parameters) -> { statements; }

  • Example: (int a, int b) -> a + b

Add your answer
right arrow
Frequently asked in

Q172. Use of static in main function

Ans.

Using static in main function allows it to be called without creating an instance of the class.

  • Static in main function allows it to be called directly without creating an object of the class.

  • Static methods can be called using the class name itself, without creating an object.

  • Example: public static void main(String[] args) { }

Add your answer
right arrow
Frequently asked in

Q173. Difference beetween thow and new thow

Ans.

throw is used to throw an exception, new throw is used to throw an exception with a new object

  • throw is used to throw an exception in JavaScript

  • new throw is used to throw an exception with a new object

  • Example: throw new Error('Something went wrong')

Add your answer
right arrow

Q174. Technology used

Ans.

Various technologies including Java, Python, SQL, AWS, Docker, Kubernetes, etc.

  • Java

  • Python

  • SQL

  • AWS

  • Docker

  • Kubernetes

Add your answer
right arrow
Frequently asked in

Q175. Print hello world

Ans.

Printing hello world is a common introductory programming task.

  • Use a print statement in the programming language of your choice.

  • For example, in Python: print('Hello, World!')

  • In Java: System.out.println('Hello, World!')

Add your answer
right arrow

Q176. Throws Vs Throw

Ans.

Throws is used for checked exceptions in Java, while throw is used to explicitly throw an exception.

  • Throws is used in method signature to declare that the method may throw a checked exception.

  • Throw is used to actually throw an exception in the code.

  • Example: public void method() throws IOException { //code }

  • Example: throw new IOException();

Add your answer
right arrow

Q177. Diff parameter and variable

Ans.

Parameters are values passed to a function, while variables are used to store data within a program.

  • Parameters are specified in the function definition, while variables are declared within the function body.

  • Parameters are used to pass values into a function, while variables are used to store values for later use.

  • Example: function add(num1, num2) { return num1 + num2; } - num1 and num2 are parameters, while result is stored in a variable.

Add your answer
right arrow

Q178. Different keywords in cpp

Ans.

Keywords in C++ are reserved words that have special meaning and cannot be used as identifiers.

  • Some keywords in C++ include: int, double, if, else, while, for, class, public, private, virtual, static

  • Keywords are case-sensitive

  • Keywords cannot be used as variable names

Add your answer
right arrow

Q179. Struck vs class

Ans.

Struck is a C programming language feature used to define a new data type, while class is a concept in object-oriented programming languages like C++ and Java.

  • Struck is used in C to define a new data type by grouping related variables together.

  • Class is used in object-oriented programming languages like C++ and Java to define a blueprint for creating objects.

  • Example: struct Person { char name[50]; int age; }; vs class Person { string name; int age; };

Add your answer
right arrow
Frequently asked in

Q180. Call and copy difference

Ans.

CALL statement is used to transfer control to another program while COPY statement is used to include copybooks in a program.

  • CALL statement is used to invoke a separate program or subroutine.

  • COPY statement is used to include copybooks in a program for reusability.

  • CALL statement transfers control to the called program and returns after execution.

  • COPY statement simply includes the contents of the copybook at the specified location.

Add your answer
right arrow
Frequently asked in

Q181. Code technology from Microsoft

Ans.

Microsoft offers a range of code technologies for developers.

  • Microsoft Visual Studio is a popular integrated development environment (IDE) for building applications.

  • Microsoft .NET Framework is a software framework for building Windows applications.

  • Microsoft Azure provides cloud-based services for building, deploying, and managing applications.

  • Microsoft SQL Server is a relational database management system for storing and retrieving data.

  • Microsoft Power Platform is a low-code ...read more

Add your answer
right arrow
Frequently asked in

Q182. Scope resolution with syntax ?

Ans.

Scope resolution refers to the process of specifying which scope a particular variable or function belongs to in a programming language.

  • Scope resolution is typically denoted by the double colon (::) operator in languages like C++ and PHP.

  • It is used to access static members, constants, and overridden methods in a class.

  • Example: ClassName::staticMember

  • Example: Namespace::functionName

Add your answer
right arrow
Frequently asked in

Q183. The tools you are aware of

Ans.

I am aware of various project management tools such as Trello, Asana, and Microsoft Project.

  • Trello

  • Asana

  • Microsoft Project

Add your answer
right arrow

Q184. coding qn based on your comfortable language

Ans.

I am comfortable with Java programming language.

  • Use Java to create a program that calculates the factorial of a number.

  • Utilize loops to iterate through the numbers and multiply them together.

  • Handle edge cases such as negative numbers or zero.

  • Consider using recursion for a more efficient solution.

Add your answer
right arrow

Q185. Program to print 0 to left

Ans.

Program to print 0 to left

  • Create a loop to iterate from 0 to the desired number

  • Use string manipulation to print the numbers with spaces to the left

  • Example: If the desired number is 5, print '0 1 2 3 4 5'

Add your answer
right arrow

Q186. CPP parameters during filling stages

Ans.

CPP parameters during filling stages refer to critical process parameters that need to be monitored and controlled to ensure product quality and consistency.

  • CPPs during filling stages may include fill volume, fill speed, fill accuracy, and container closure integrity.

  • Monitoring and controlling these parameters is essential to prevent issues such as underfilling or overfilling, which can impact product quality.

  • Examples of CPPs during filling stages in pharmaceutical manufactur...read more

Add your answer
right arrow

Q187. Use of include()

Ans.

include() is a PHP function used to include and evaluate a specified file.

  • include() is used to include and evaluate a specified file in PHP code.

  • It is commonly used to include reusable code snippets or libraries.

  • The included file is processed as if it were part of the calling file.

  • If the file cannot be included, a warning is generated but the script will continue to execute.

Add your answer
right arrow
Frequently asked in

Q188. Languages that we have prepared.

Ans.

We have prepared languages such as Java, Python, C++, and SQL for the position of Jr. Software Programmer.

  • Java

  • Python

  • C++

  • SQL

Add your answer
right arrow

Q189. Output of a code snippet

Ans.

The code snippet prints the elements of an array in reverse order.

  • The code snippet uses a loop to iterate through the array in reverse order.

  • The loop starts from the last element of the array and decrements the index until it reaches the first element.

  • Each element of the array is printed during each iteration of the loop.

Add your answer
right arrow

Q190. C++ programs snipet to tell output

Ans.

C++ program snippet to show output

  • Use cout to print output to console

  • Use endl to add a new line

  • Use << operator to concatenate output

  • Use cin to get input from user

Add your answer
right arrow
Frequently asked in

Q191. Technologies you learned

Ans.

I have learned technologies such as Java, Python, SQL, HTML, CSS, JavaScript, and Git.

  • Java

  • Python

  • SQL

  • HTML

  • CSS

  • JavaScript

  • Git

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

Interview experiences of popular companies

3.7
 • 10.4k Interviews
3.8
 • 8.1k Interviews
3.6
 • 7.5k Interviews
3.7
 • 5.6k Interviews
3.8
 • 5.6k Interviews
3.7
 • 4.7k Interviews
3.5
 • 3.8k Interviews
3.5
 • 3.8k Interviews
3.8
 • 2.9k Interviews
View all
Recently Viewed
SALARIES
Shell
JOBS
Browse jobs
Discover jobs you love
DESIGNATION
REVIEWS
Reliance Trends
No Reviews
JOBS
Wipro
No Jobs
SALARIES
Zudio
SALARIES
Trent
JOBS
Individual
No Jobs
DESIGNATION
JOBS
Box8
No Jobs
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
75 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