SlideShare una empresa de Scribd logo
1 de 15
www.rekruitin.com
C, C++ Interview Questions
Part - 1
Page  2
1. What is C++?
Released in 1985, C++ is an object-oriented programming language created
by Bjarne Stroustrup. C++ maintains almost all aspects of the C language,
while simplifying memory management and adding several features -
including a new datatype known as a class (you will learn more about these
later) - to allow object-oriented programming. C++ maintains the features of C
which allowed for low-level memory access but also gives the programmer
new tools to simplify memory management.
C++ used for:
C++ is a powerful general-purpose programming language. It can be used to
create small programs or large applications. It can be used to make CGI
scripts or console-only DOS programs. C++ allows you to create programs to
do almost anything you need to do. The creator of C++, Bjarne Stroustrup,
has put together a partial list of applications written in C++.
Page  3
2. How do you find out if a linked-list has an end? (i.e. the list is not a
cycle)?
You can find out by using 2 pointers. One of them goes 2 nodes each time.
The second one goes at 1 nodes each time. If there is a cycle, the one that
goes 2 nodes each time will eventually meet the one that goes slower. If that
is the case, then you will know the linked-list is a cycle.
3. What is the difference between realloc() and free()?
The free subroutine frees a block of memory previously allocated by the
malloc subroutine. Undefined results occur if the Pointer parameter is not a
valid pointer. If the Pointer parameter is a null value, no action will occur.
The realloc subroutine changes the size of the block of memory pointed to
by the Pointer parameter to the number of bytes specified by the Size
parameter and returns a new pointer to the block. The pointer specified by
the Pointer parameter must have been created with the malloc, calloc, or
realloc subroutines and not been deallocated with the free or realloc
subroutines. Undefined results occur if the Pointer parameter is not a valid
pointer.
Page  4
4. What is function overloading and operator overloading?
Function overloading: C++ enables several functions of the same name to be
defined, as long as these functions have different sets of parameters (at least as
far as their types are concerned). This capability is called function overloading.
When an overloaded function is called, the C++ compiler selects the proper
function by examining the number, types and order of the arguments in the call.
Function overloading is commonly used to create several functions of the same
name that perform similar tasks but on different data types.
Operator overloading allows existing C++ operators to be redefined so that they
work on objects of user-defined classes.
Overloaded operators are syntactic sugar for equivalent function calls. They
form a pleasant facade that doesn't add anything fundamental to the language
(but they can improve understandability and reduce maintenance costs).
Page  5
5. What is the difference between declaration and definition?
The declaration tells the compiler that at some later point we plan to present the
definition of this declaration.
E.g.: void stars () //function declaration
The definition contains the actual implementation.
E.g.: void stars () // declarator
{
for(int j=10; j > =0; j--) //function body
cout << *;
cout << endl; }
6. What are the advantages of inheritance?
It permits code reusability. Reusability saves time in program development. It
encourages the reuse of proven and debugged high-quality software, thus reducing
problem after a system becomes functional.
Page  6
7. Define Storage Classes and explain application domain?
Register: tell to the compiler for use a CPU register for fast aceess for that
variable.
Auto: It's a variable created and initialized when it is defined. It is not visible
outside of the block.
Static: defined inside of the function retain its value between calls. Always is
initialized with 0. Defined as global in a file is visible on for the functions from that
file.
Extern : The definition of the variable is in another file.
8. Define a "dangling" pointer?
Dangling pointer is obtained by using the address of an object which was freed.
9. Any difference between "const int*ptr" and int *const ptr" ?
Yes, it's a major difference. First define a constant data and second define a
constant pointer.
Page  7
10. Define the Storage Qualifiers?
const - define a variable that can not change its value along the program
execution.
volatile - define a variable that can be changed indirectly. An example can
be a counter register that is updated by hardware.
mutuable - a member of a structure or object can be changed even if the
structure, for example is declared const:
Ex: struct complex {mutuable int x; int y;};
const complex Mycomplex = {1, 2};
Mycomplex.x = 3; /* correct */
11. Does c++ support multilevel and multiple inheritance?
Yes.
Page  8
12. What is the difference between an ARRAY and a LIST?
Array is collection of homogeneous elements.
List is collection of heterogeneous elements.
For Array memory allocated is static and continuous.
For List memory allocated is dynamic and Random.
Array: User need not have to keep in track of next memory allocation.
List: User has to keep in Track of next location where memory is allocated.
13. Define a constructor - What it is and how it might be called.
constructor is a member function of the class, with the name of the function
being the same as the class name. It also specifies how the object should be
initialized.
Ways of calling constructor:
1) Implicitly: automatically by complier when an object is created.
2) Calling the constructors explicitly is possible, but it makes the code
unverifiable.
Page  9
14. What is a template?
Templates allow to create generic functions that admit any data type as
parameters and return value without having to overload the function with all
the possible data types. Until certain point they fulfill the functionality of a
macro. Its prototype is any of the two following ones:
template <class indetifier> function_declaration; template <typename
indetifier> function_declaration;
The only difference between both prototypes is the use of keyword class or
typename, its use is indistinct since both expressions have exactly the same
meaning and behave exactly the same way.
15. What is RTTI?
Runtime type identification (RTTI) lets you find the dynamic type of an object
when you have only a pointer or a reference to the base type. RTTI is the
official way in standard C++ to discover the type of an object and to convert
the type of a pointer or reference (that is, dynamic typing). The need came
from practical experience with C++. RTTI replaces many Interview Questions
- Homegrown versions with a solid, consistent approach.
Page  10
16. How can you tell what shell you are running on UNIX system?
You can do the Echo $RANDOM. It will return a undefined variable if you are
from the C-Shell, just a return prompt if you are from the Bourne shell, and a 5
digit random numbers if you are from the Korn shell. You could also do a ps -l
and look for the shell with the highest PID.
17. What do you mean by inheritance?
Inheritance is the process of creating new classes, called derived classes, from
existing classes or base classes. The derived class inherits all the capabilities of
the base class, but can add embellishments and refinements of its own.
18. What is Boyce Codd Normal form?
A relation schema R is in BCNF with respect to a set F of functional
dependencies if for all functional dependencies in F+ of the form a-> , where a
and b is a subset of R, at least one of the following holds:
* a- > b is a trivial functional dependency (b is a subset of a)
* a is a superkey for schema R
Page  11
19. What is namespace?
Namespaces allow us to group a set of global classes, objects and/or
functions under a name.
To say it somehow, they serve to split the global scope in sub-scopes known
as namespaces.
The form to use namespaces is:
namespace identifier { namespace-body }
Where identifier is any valid identifier and namespace-body is the set of
classes, objects and functions that are included within the namespace. For
example:
namespace general { int a, b; }
In this case, a and b are normal variables integrated within the general
namespace. In order to access to these variables from outside the
namespace we have to use the scope operator ::.
For example, to access the previous variables we would have to put:
general::a general::b
The functionality of namespaces is specially useful in case that there is a
possibility that a global object or function can have the same name than
another one, causing a redefinition error.
Page  12
20. What do you mean by binding of data and functions?
Encapsulation.
21. What are virtual functions?
A virtual function allows derived classes to replace the implementation
provided by the base class.
The compiler makes sure the replacement is always called whenever the
object in question is actually of the derived class, even if the object is
accessed by a base pointer rather than a derived pointer. This allows
algorithms in the base class to be replaced in the derived class, even if users
don't know about the derived class.
22. What is the difference between an external iterator and an internal
iterator? Describe an advantage of an external iterator.
An internal iterator is implemented with member functions of the class that
has items to step through. .An external iterator is implemented as a separate
class that can be "attach" to the object that has items to step through
.An external iterator has the advantage that many difference iterators can be
active simultaneously on the same object.
Page  13
23. What is an HTML tag? 
An HTML tag is a syntactical construct in the HTML language that 
abbreviates specific instructions to be executed when the HTML script is 
loaded into a Web browser. 
It is like a method in Java, a function in C++, a procedure in Pascal, or a 
subroutine in FORTRAN.
24. How do you decide which integer type to use?
 
It depends on our requirement. 
When we are required an integer to be stored in 1 byte (means less than or 
equal to 255) we use short int, for 2 bytes we use int, for 8 bytes we use long 
int. 
A char is for 1-byte integers, a short is for 2-byte integers, an int is generally 
a 2-byte or 4-byte integer (though not necessarily), a long is a 4-byte integer, 
and a long long is a 8-byte integer.
25.What is a class? 
Class is a user-defined data type in C++. It can be created to solve a 
particular kind of problem. After creation the user need not know the specifics 
of the working of a class.
Page  14
For more details, Please log on to www.rekruitin.com
Customer Care : 8855041500
Career Guidance : 9823205144
Tech Support : 7758806112
Human Resource: 9823204144
You can also Find us on:
15
Thank You !!!

Más contenido relacionado

La actualidad más candente

C basics 4 std11(GujBoard)
C basics 4 std11(GujBoard)C basics 4 std11(GujBoard)
C basics 4 std11(GujBoard)
indrasir
 

La actualidad más candente (20)

Functions in C
Functions in CFunctions in C
Functions in C
 
Function overloading
Function overloadingFunction overloading
Function overloading
 
Data Type in C Programming
Data Type in C ProgrammingData Type in C Programming
Data Type in C Programming
 
FUNCTIONS IN C PROGRAMMING.pdf
FUNCTIONS IN C PROGRAMMING.pdfFUNCTIONS IN C PROGRAMMING.pdf
FUNCTIONS IN C PROGRAMMING.pdf
 
Storage classes in c language
Storage classes in c languageStorage classes in c language
Storage classes in c language
 
Function in c
Function in cFunction in c
Function in c
 
Introduction to Basic C programming 01
Introduction to Basic C programming 01Introduction to Basic C programming 01
Introduction to Basic C programming 01
 
Preprocessor
PreprocessorPreprocessor
Preprocessor
 
Function in C Programming
Function in C ProgrammingFunction in C Programming
Function in C Programming
 
Storage Class in C Progrmming
Storage Class in C Progrmming Storage Class in C Progrmming
Storage Class in C Progrmming
 
Function overloading(c++)
Function overloading(c++)Function overloading(c++)
Function overloading(c++)
 
Operator Overloading & Function Overloading
Operator Overloading & Function OverloadingOperator Overloading & Function Overloading
Operator Overloading & Function Overloading
 
C pointer
C pointerC pointer
C pointer
 
Structure of C program
Structure of C programStructure of C program
Structure of C program
 
C Programming: Control Structure
C Programming: Control StructureC Programming: Control Structure
C Programming: Control Structure
 
Functions in c
Functions in cFunctions in c
Functions in c
 
Characteristics of OOPS
Characteristics of OOPS Characteristics of OOPS
Characteristics of OOPS
 
Increment and Decrement operators in C++
Increment and Decrement operators in C++Increment and Decrement operators in C++
Increment and Decrement operators in C++
 
detailed information about Pointers in c language
detailed information about Pointers in c languagedetailed information about Pointers in c language
detailed information about Pointers in c language
 
C basics 4 std11(GujBoard)
C basics 4 std11(GujBoard)C basics 4 std11(GujBoard)
C basics 4 std11(GujBoard)
 

Destacado

100 c interview questions answers
100 c interview questions answers100 c interview questions answers
100 c interview questions answers
Sareen Kumar
 
C interview question answer 2
C interview question answer 2C interview question answer 2
C interview question answer 2
Amit Kapoor
 
C interview-questions-techpreparation
C interview-questions-techpreparationC interview-questions-techpreparation
C interview-questions-techpreparation
Kushaal Singla
 
Geometry formula sheet
Geometry formula sheetGeometry formula sheet
Geometry formula sheet
sidraqasim99
 
Notes and-formulae-mathematics
Notes and-formulae-mathematicsNotes and-formulae-mathematics
Notes and-formulae-mathematics
Ragulan Dev
 

Destacado (19)

C++ questions and answers
C++ questions and answersC++ questions and answers
C++ questions and answers
 
C++ questions And Answer
C++ questions And AnswerC++ questions And Answer
C++ questions And Answer
 
C faqs interview questions placement paper 2013
C faqs interview questions placement paper 2013C faqs interview questions placement paper 2013
C faqs interview questions placement paper 2013
 
100 c interview questions answers
100 c interview questions answers100 c interview questions answers
100 c interview questions answers
 
C interview question answer 2
C interview question answer 2C interview question answer 2
C interview question answer 2
 
C interview-questions-techpreparation
C interview-questions-techpreparationC interview-questions-techpreparation
C interview-questions-techpreparation
 
C Programming Interview Questions
C Programming Interview QuestionsC Programming Interview Questions
C Programming Interview Questions
 
Cat Quant Cheat Sheet
Cat Quant Cheat SheetCat Quant Cheat Sheet
Cat Quant Cheat Sheet
 
C interview Question and Answer
C interview Question and AnswerC interview Question and Answer
C interview Question and Answer
 
Geometry formula sheet
Geometry formula sheetGeometry formula sheet
Geometry formula sheet
 
Algebra formulas
Algebra formulas Algebra formulas
Algebra formulas
 
Geometry formula-sheet
Geometry formula-sheetGeometry formula-sheet
Geometry formula-sheet
 
Probability Formula sheet
Probability Formula sheetProbability Formula sheet
Probability Formula sheet
 
Notes and-formulae-mathematics
Notes and-formulae-mathematicsNotes and-formulae-mathematics
Notes and-formulae-mathematics
 
Research method - How to interview?
Research method - How to interview?Research method - How to interview?
Research method - How to interview?
 
C Programming Language Tutorial for beginners - JavaTpoint
C Programming Language Tutorial for beginners - JavaTpointC Programming Language Tutorial for beginners - JavaTpoint
C Programming Language Tutorial for beginners - JavaTpoint
 
Top 100 SQL Interview Questions and Answers
Top 100 SQL Interview Questions and AnswersTop 100 SQL Interview Questions and Answers
Top 100 SQL Interview Questions and Answers
 
Shortcuts in Mathematics for CAT, CET, GRE, GMAT or any similar competitive ...
Shortcuts in  Mathematics for CAT, CET, GRE, GMAT or any similar competitive ...Shortcuts in  Mathematics for CAT, CET, GRE, GMAT or any similar competitive ...
Shortcuts in Mathematics for CAT, CET, GRE, GMAT or any similar competitive ...
 
Basic java important interview questions and answers to secure a job
Basic java important interview questions and answers to secure a jobBasic java important interview questions and answers to secure a job
Basic java important interview questions and answers to secure a job
 

Similar a C, C++ Interview Questions Part - 1

C basic questions&amp;ansrs by shiva kumar kella
C basic questions&amp;ansrs by shiva kumar kellaC basic questions&amp;ansrs by shiva kumar kella
C basic questions&amp;ansrs by shiva kumar kella
Manoj Kumar kothagulla
 
New microsoft office word document (2)
New microsoft office word document (2)New microsoft office word document (2)
New microsoft office word document (2)
rashmita_mishra
 

Similar a C, C++ Interview Questions Part - 1 (20)

1183 c-interview-questions-and-answers
1183 c-interview-questions-and-answers1183 c-interview-questions-and-answers
1183 c-interview-questions-and-answers
 
C++ Interview Question And Answer
C++ Interview Question And AnswerC++ Interview Question And Answer
C++ Interview Question And Answer
 
Interoduction to c++
Interoduction to c++Interoduction to c++
Interoduction to c++
 
7.-Download_CS201-Solved-Subjective-with-Reference-by-Aqib.doc
7.-Download_CS201-Solved-Subjective-with-Reference-by-Aqib.doc7.-Download_CS201-Solved-Subjective-with-Reference-by-Aqib.doc
7.-Download_CS201-Solved-Subjective-with-Reference-by-Aqib.doc
 
cbybalaguruswami-e-180803051831.pptx
cbybalaguruswami-e-180803051831.pptxcbybalaguruswami-e-180803051831.pptx
cbybalaguruswami-e-180803051831.pptx
 
cbybalaguruswami-e-180803051831.pptx
cbybalaguruswami-e-180803051831.pptxcbybalaguruswami-e-180803051831.pptx
cbybalaguruswami-e-180803051831.pptx
 
Technical Interview
Technical InterviewTechnical Interview
Technical Interview
 
Tcs NQTExam technical questions
Tcs NQTExam technical questionsTcs NQTExam technical questions
Tcs NQTExam technical questions
 
C by balaguruswami - e.balagurusamy
C   by balaguruswami - e.balagurusamyC   by balaguruswami - e.balagurusamy
C by balaguruswami - e.balagurusamy
 
C questions
C questionsC questions
C questions
 
C basic questions&amp;ansrs by shiva kumar kella
C basic questions&amp;ansrs by shiva kumar kellaC basic questions&amp;ansrs by shiva kumar kella
C basic questions&amp;ansrs by shiva kumar kella
 
My c++
My c++My c++
My c++
 
Introduction to C++ Programming
Introduction to C++ ProgrammingIntroduction to C++ Programming
Introduction to C++ Programming
 
New microsoft office word document (2)
New microsoft office word document (2)New microsoft office word document (2)
New microsoft office word document (2)
 
Bcsl 031 solve assignment
Bcsl 031 solve assignmentBcsl 031 solve assignment
Bcsl 031 solve assignment
 
Unit 1
Unit  1Unit  1
Unit 1
 
Intervies
InterviesIntervies
Intervies
 
Technical_Interview_Questions.pdf
Technical_Interview_Questions.pdfTechnical_Interview_Questions.pdf
Technical_Interview_Questions.pdf
 
C interview questions
C interview questionsC interview questions
C interview questions
 
interview questions.docx
interview questions.docxinterview questions.docx
interview questions.docx
 

Más de ReKruiTIn.com

Más de ReKruiTIn.com (16)

Tips On Telephonic Interview Round
Tips On Telephonic Interview RoundTips On Telephonic Interview Round
Tips On Telephonic Interview Round
 
What not to Include in your Resume.
What not to Include in your Resume.What not to Include in your Resume.
What not to Include in your Resume.
 
Tips for Salary Negotiation
Tips for Salary NegotiationTips for Salary Negotiation
Tips for Salary Negotiation
 
Tips on Group Discussion
Tips on Group DiscussionTips on Group Discussion
Tips on Group Discussion
 
Team management
Team managementTeam management
Team management
 
Importance of Cover Letter
Importance of Cover LetterImportance of Cover Letter
Importance of Cover Letter
 
Mistakes to avoid in Job Interview
Mistakes to avoid in  Job InterviewMistakes to avoid in  Job Interview
Mistakes to avoid in Job Interview
 
DB2 Interview Questions - Part 1
DB2 Interview Questions - Part 1DB2 Interview Questions - Part 1
DB2 Interview Questions - Part 1
 
Sap Interview Questions - Part 1
Sap Interview Questions - Part 1Sap Interview Questions - Part 1
Sap Interview Questions - Part 1
 
Dot Net Interview Questions - Part 1
Dot Net Interview Questions - Part 1Dot Net Interview Questions - Part 1
Dot Net Interview Questions - Part 1
 
PeopleSoft Interview Questions - Part 1
PeopleSoft Interview Questions - Part 1PeopleSoft Interview Questions - Part 1
PeopleSoft Interview Questions - Part 1
 
Resume Writing Skills
Resume Writing SkillsResume Writing Skills
Resume Writing Skills
 
Interview Process
Interview ProcessInterview Process
Interview Process
 
Recruitment skills
Recruitment skillsRecruitment skills
Recruitment skills
 
Basic Interview Questions
Basic Interview QuestionsBasic Interview Questions
Basic Interview Questions
 
Career Development Tips
Career Development TipsCareer Development Tips
Career Development Tips
 

Último

Top profile Call Girls In Sagar [ 7014168258 ] Call Me For Genuine Models We ...
Top profile Call Girls In Sagar [ 7014168258 ] Call Me For Genuine Models We ...Top profile Call Girls In Sagar [ 7014168258 ] Call Me For Genuine Models We ...
Top profile Call Girls In Sagar [ 7014168258 ] Call Me For Genuine Models We ...
nirzagarg
 
Top profile Call Girls In Ratnagiri [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In Ratnagiri [ 7014168258 ] Call Me For Genuine Models...Top profile Call Girls In Ratnagiri [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In Ratnagiri [ 7014168258 ] Call Me For Genuine Models...
gajnagarg
 
Jual obat aborsi Jakarta ( 085657271886 )Cytote pil telat bulan penggugur kan...
Jual obat aborsi Jakarta ( 085657271886 )Cytote pil telat bulan penggugur kan...Jual obat aborsi Jakarta ( 085657271886 )Cytote pil telat bulan penggugur kan...
Jual obat aborsi Jakarta ( 085657271886 )Cytote pil telat bulan penggugur kan...
ZurliaSoop
 
Girls in Aiims Metro (delhi) call me [🔝9953056974🔝] escort service 24X7
Girls in Aiims Metro (delhi) call me [🔝9953056974🔝] escort service 24X7Girls in Aiims Metro (delhi) call me [🔝9953056974🔝] escort service 24X7
Girls in Aiims Metro (delhi) call me [🔝9953056974🔝] escort service 24X7
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Gabriel_Carter_EXPOLRATIONpp.pptx........
Gabriel_Carter_EXPOLRATIONpp.pptx........Gabriel_Carter_EXPOLRATIONpp.pptx........
Gabriel_Carter_EXPOLRATIONpp.pptx........
deejay178
 
Eden Gardens * High Profile Call Girls in Kolkata Phone No 8005736733 Elite E...
Eden Gardens * High Profile Call Girls in Kolkata Phone No 8005736733 Elite E...Eden Gardens * High Profile Call Girls in Kolkata Phone No 8005736733 Elite E...
Eden Gardens * High Profile Call Girls in Kolkata Phone No 8005736733 Elite E...
HyderabadDolls
 
Howrah [ Call Girls Kolkata ₹7.5k Pick Up & Drop With Cash Payment 8005736733...
Howrah [ Call Girls Kolkata ₹7.5k Pick Up & Drop With Cash Payment 8005736733...Howrah [ Call Girls Kolkata ₹7.5k Pick Up & Drop With Cash Payment 8005736733...
Howrah [ Call Girls Kolkata ₹7.5k Pick Up & Drop With Cash Payment 8005736733...
HyderabadDolls
 
Simple, 3-Step Strategy to Improve Your Executive Presence (Even if You Don't...
Simple, 3-Step Strategy to Improve Your Executive Presence (Even if You Don't...Simple, 3-Step Strategy to Improve Your Executive Presence (Even if You Don't...
Simple, 3-Step Strategy to Improve Your Executive Presence (Even if You Don't...
Angela Justice, PhD
 

Último (20)

Kannada Call Girls Mira Bhayandar WhatsApp +91-9930687706, Best Service
Kannada Call Girls Mira Bhayandar WhatsApp +91-9930687706, Best ServiceKannada Call Girls Mira Bhayandar WhatsApp +91-9930687706, Best Service
Kannada Call Girls Mira Bhayandar WhatsApp +91-9930687706, Best Service
 
Dating Call Girls inTiruvallur { 9332606886 } VVIP NISHA Call Girls Near 5 St...
Dating Call Girls inTiruvallur { 9332606886 } VVIP NISHA Call Girls Near 5 St...Dating Call Girls inTiruvallur { 9332606886 } VVIP NISHA Call Girls Near 5 St...
Dating Call Girls inTiruvallur { 9332606886 } VVIP NISHA Call Girls Near 5 St...
 
Specialize in a MSc within Biomanufacturing, and work part-time as Process En...
Specialize in a MSc within Biomanufacturing, and work part-time as Process En...Specialize in a MSc within Biomanufacturing, and work part-time as Process En...
Specialize in a MSc within Biomanufacturing, and work part-time as Process En...
 
drug book file on obs. and gynae clinical pstings
drug book file on obs. and gynae clinical pstingsdrug book file on obs. and gynae clinical pstings
drug book file on obs. and gynae clinical pstings
 
Top profile Call Girls In Sagar [ 7014168258 ] Call Me For Genuine Models We ...
Top profile Call Girls In Sagar [ 7014168258 ] Call Me For Genuine Models We ...Top profile Call Girls In Sagar [ 7014168258 ] Call Me For Genuine Models We ...
Top profile Call Girls In Sagar [ 7014168258 ] Call Me For Genuine Models We ...
 
Novo Nordisk Kalundborg. We are expanding our manufacturing hub in Kalundborg...
Novo Nordisk Kalundborg. We are expanding our manufacturing hub in Kalundborg...Novo Nordisk Kalundborg. We are expanding our manufacturing hub in Kalundborg...
Novo Nordisk Kalundborg. We are expanding our manufacturing hub in Kalundborg...
 
UXPA Boston 2024 Maximize the Client Consultant Relationship.pdf
UXPA Boston 2024 Maximize the Client Consultant Relationship.pdfUXPA Boston 2024 Maximize the Client Consultant Relationship.pdf
UXPA Boston 2024 Maximize the Client Consultant Relationship.pdf
 
Top profile Call Girls In Ratnagiri [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In Ratnagiri [ 7014168258 ] Call Me For Genuine Models...Top profile Call Girls In Ratnagiri [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In Ratnagiri [ 7014168258 ] Call Me For Genuine Models...
 
B.tech Civil Engineering Major Project by Deepak Kumar ppt.pdf
B.tech Civil Engineering Major Project by Deepak Kumar ppt.pdfB.tech Civil Engineering Major Project by Deepak Kumar ppt.pdf
B.tech Civil Engineering Major Project by Deepak Kumar ppt.pdf
 
Jual obat aborsi Jakarta ( 085657271886 )Cytote pil telat bulan penggugur kan...
Jual obat aborsi Jakarta ( 085657271886 )Cytote pil telat bulan penggugur kan...Jual obat aborsi Jakarta ( 085657271886 )Cytote pil telat bulan penggugur kan...
Jual obat aborsi Jakarta ( 085657271886 )Cytote pil telat bulan penggugur kan...
 
Girls in Aiims Metro (delhi) call me [🔝9953056974🔝] escort service 24X7
Girls in Aiims Metro (delhi) call me [🔝9953056974🔝] escort service 24X7Girls in Aiims Metro (delhi) call me [🔝9953056974🔝] escort service 24X7
Girls in Aiims Metro (delhi) call me [🔝9953056974🔝] escort service 24X7
 
Gabriel_Carter_EXPOLRATIONpp.pptx........
Gabriel_Carter_EXPOLRATIONpp.pptx........Gabriel_Carter_EXPOLRATIONpp.pptx........
Gabriel_Carter_EXPOLRATIONpp.pptx........
 
Eden Gardens * High Profile Call Girls in Kolkata Phone No 8005736733 Elite E...
Eden Gardens * High Profile Call Girls in Kolkata Phone No 8005736733 Elite E...Eden Gardens * High Profile Call Girls in Kolkata Phone No 8005736733 Elite E...
Eden Gardens * High Profile Call Girls in Kolkata Phone No 8005736733 Elite E...
 
Guide to a Winning Interview May 2024 for MCWN
Guide to a Winning Interview May 2024 for MCWNGuide to a Winning Interview May 2024 for MCWN
Guide to a Winning Interview May 2024 for MCWN
 
Personal Brand Exploration ppt.- Ronnie Jones
Personal Brand  Exploration ppt.- Ronnie JonesPersonal Brand  Exploration ppt.- Ronnie Jones
Personal Brand Exploration ppt.- Ronnie Jones
 
9352852248 Call Girls Sanand Escort Service Available 24×7 In Sanand
9352852248 Call Girls  Sanand Escort Service Available 24×7 In Sanand9352852248 Call Girls  Sanand Escort Service Available 24×7 In Sanand
9352852248 Call Girls Sanand Escort Service Available 24×7 In Sanand
 
Athwa gate \ Call Girls Service Ahmedabad - 450+ Call Girl Cash Payment 80057...
Athwa gate \ Call Girls Service Ahmedabad - 450+ Call Girl Cash Payment 80057...Athwa gate \ Call Girls Service Ahmedabad - 450+ Call Girl Cash Payment 80057...
Athwa gate \ Call Girls Service Ahmedabad - 450+ Call Girl Cash Payment 80057...
 
Low Cost Coimbatore Call Girls Service 👉📞 6378878445 👉📞 Just📲 Call Ruhi Call ...
Low Cost Coimbatore Call Girls Service 👉📞 6378878445 👉📞 Just📲 Call Ruhi Call ...Low Cost Coimbatore Call Girls Service 👉📞 6378878445 👉📞 Just📲 Call Ruhi Call ...
Low Cost Coimbatore Call Girls Service 👉📞 6378878445 👉📞 Just📲 Call Ruhi Call ...
 
Howrah [ Call Girls Kolkata ₹7.5k Pick Up & Drop With Cash Payment 8005736733...
Howrah [ Call Girls Kolkata ₹7.5k Pick Up & Drop With Cash Payment 8005736733...Howrah [ Call Girls Kolkata ₹7.5k Pick Up & Drop With Cash Payment 8005736733...
Howrah [ Call Girls Kolkata ₹7.5k Pick Up & Drop With Cash Payment 8005736733...
 
Simple, 3-Step Strategy to Improve Your Executive Presence (Even if You Don't...
Simple, 3-Step Strategy to Improve Your Executive Presence (Even if You Don't...Simple, 3-Step Strategy to Improve Your Executive Presence (Even if You Don't...
Simple, 3-Step Strategy to Improve Your Executive Presence (Even if You Don't...
 

C, C++ Interview Questions Part - 1

  • 2. Page  2 1. What is C++? Released in 1985, C++ is an object-oriented programming language created by Bjarne Stroustrup. C++ maintains almost all aspects of the C language, while simplifying memory management and adding several features - including a new datatype known as a class (you will learn more about these later) - to allow object-oriented programming. C++ maintains the features of C which allowed for low-level memory access but also gives the programmer new tools to simplify memory management. C++ used for: C++ is a powerful general-purpose programming language. It can be used to create small programs or large applications. It can be used to make CGI scripts or console-only DOS programs. C++ allows you to create programs to do almost anything you need to do. The creator of C++, Bjarne Stroustrup, has put together a partial list of applications written in C++.
  • 3. Page  3 2. How do you find out if a linked-list has an end? (i.e. the list is not a cycle)? You can find out by using 2 pointers. One of them goes 2 nodes each time. The second one goes at 1 nodes each time. If there is a cycle, the one that goes 2 nodes each time will eventually meet the one that goes slower. If that is the case, then you will know the linked-list is a cycle. 3. What is the difference between realloc() and free()? The free subroutine frees a block of memory previously allocated by the malloc subroutine. Undefined results occur if the Pointer parameter is not a valid pointer. If the Pointer parameter is a null value, no action will occur. The realloc subroutine changes the size of the block of memory pointed to by the Pointer parameter to the number of bytes specified by the Size parameter and returns a new pointer to the block. The pointer specified by the Pointer parameter must have been created with the malloc, calloc, or realloc subroutines and not been deallocated with the free or realloc subroutines. Undefined results occur if the Pointer parameter is not a valid pointer.
  • 4. Page  4 4. What is function overloading and operator overloading? Function overloading: C++ enables several functions of the same name to be defined, as long as these functions have different sets of parameters (at least as far as their types are concerned). This capability is called function overloading. When an overloaded function is called, the C++ compiler selects the proper function by examining the number, types and order of the arguments in the call. Function overloading is commonly used to create several functions of the same name that perform similar tasks but on different data types. Operator overloading allows existing C++ operators to be redefined so that they work on objects of user-defined classes. Overloaded operators are syntactic sugar for equivalent function calls. They form a pleasant facade that doesn't add anything fundamental to the language (but they can improve understandability and reduce maintenance costs).
  • 5. Page  5 5. What is the difference between declaration and definition? The declaration tells the compiler that at some later point we plan to present the definition of this declaration. E.g.: void stars () //function declaration The definition contains the actual implementation. E.g.: void stars () // declarator { for(int j=10; j > =0; j--) //function body cout << *; cout << endl; } 6. What are the advantages of inheritance? It permits code reusability. Reusability saves time in program development. It encourages the reuse of proven and debugged high-quality software, thus reducing problem after a system becomes functional.
  • 6. Page  6 7. Define Storage Classes and explain application domain? Register: tell to the compiler for use a CPU register for fast aceess for that variable. Auto: It's a variable created and initialized when it is defined. It is not visible outside of the block. Static: defined inside of the function retain its value between calls. Always is initialized with 0. Defined as global in a file is visible on for the functions from that file. Extern : The definition of the variable is in another file. 8. Define a "dangling" pointer? Dangling pointer is obtained by using the address of an object which was freed. 9. Any difference between "const int*ptr" and int *const ptr" ? Yes, it's a major difference. First define a constant data and second define a constant pointer.
  • 7. Page  7 10. Define the Storage Qualifiers? const - define a variable that can not change its value along the program execution. volatile - define a variable that can be changed indirectly. An example can be a counter register that is updated by hardware. mutuable - a member of a structure or object can be changed even if the structure, for example is declared const: Ex: struct complex {mutuable int x; int y;}; const complex Mycomplex = {1, 2}; Mycomplex.x = 3; /* correct */ 11. Does c++ support multilevel and multiple inheritance? Yes.
  • 8. Page  8 12. What is the difference between an ARRAY and a LIST? Array is collection of homogeneous elements. List is collection of heterogeneous elements. For Array memory allocated is static and continuous. For List memory allocated is dynamic and Random. Array: User need not have to keep in track of next memory allocation. List: User has to keep in Track of next location where memory is allocated. 13. Define a constructor - What it is and how it might be called. constructor is a member function of the class, with the name of the function being the same as the class name. It also specifies how the object should be initialized. Ways of calling constructor: 1) Implicitly: automatically by complier when an object is created. 2) Calling the constructors explicitly is possible, but it makes the code unverifiable.
  • 9. Page  9 14. What is a template? Templates allow to create generic functions that admit any data type as parameters and return value without having to overload the function with all the possible data types. Until certain point they fulfill the functionality of a macro. Its prototype is any of the two following ones: template <class indetifier> function_declaration; template <typename indetifier> function_declaration; The only difference between both prototypes is the use of keyword class or typename, its use is indistinct since both expressions have exactly the same meaning and behave exactly the same way. 15. What is RTTI? Runtime type identification (RTTI) lets you find the dynamic type of an object when you have only a pointer or a reference to the base type. RTTI is the official way in standard C++ to discover the type of an object and to convert the type of a pointer or reference (that is, dynamic typing). The need came from practical experience with C++. RTTI replaces many Interview Questions - Homegrown versions with a solid, consistent approach.
  • 10. Page  10 16. How can you tell what shell you are running on UNIX system? You can do the Echo $RANDOM. It will return a undefined variable if you are from the C-Shell, just a return prompt if you are from the Bourne shell, and a 5 digit random numbers if you are from the Korn shell. You could also do a ps -l and look for the shell with the highest PID. 17. What do you mean by inheritance? Inheritance is the process of creating new classes, called derived classes, from existing classes or base classes. The derived class inherits all the capabilities of the base class, but can add embellishments and refinements of its own. 18. What is Boyce Codd Normal form? A relation schema R is in BCNF with respect to a set F of functional dependencies if for all functional dependencies in F+ of the form a-> , where a and b is a subset of R, at least one of the following holds: * a- > b is a trivial functional dependency (b is a subset of a) * a is a superkey for schema R
  • 11. Page  11 19. What is namespace? Namespaces allow us to group a set of global classes, objects and/or functions under a name. To say it somehow, they serve to split the global scope in sub-scopes known as namespaces. The form to use namespaces is: namespace identifier { namespace-body } Where identifier is any valid identifier and namespace-body is the set of classes, objects and functions that are included within the namespace. For example: namespace general { int a, b; } In this case, a and b are normal variables integrated within the general namespace. In order to access to these variables from outside the namespace we have to use the scope operator ::. For example, to access the previous variables we would have to put: general::a general::b The functionality of namespaces is specially useful in case that there is a possibility that a global object or function can have the same name than another one, causing a redefinition error.
  • 12. Page  12 20. What do you mean by binding of data and functions? Encapsulation. 21. What are virtual functions? A virtual function allows derived classes to replace the implementation provided by the base class. The compiler makes sure the replacement is always called whenever the object in question is actually of the derived class, even if the object is accessed by a base pointer rather than a derived pointer. This allows algorithms in the base class to be replaced in the derived class, even if users don't know about the derived class. 22. What is the difference between an external iterator and an internal iterator? Describe an advantage of an external iterator. An internal iterator is implemented with member functions of the class that has items to step through. .An external iterator is implemented as a separate class that can be "attach" to the object that has items to step through .An external iterator has the advantage that many difference iterators can be active simultaneously on the same object.
  • 13. Page  13 23. What is an HTML tag?  An HTML tag is a syntactical construct in the HTML language that  abbreviates specific instructions to be executed when the HTML script is  loaded into a Web browser.  It is like a method in Java, a function in C++, a procedure in Pascal, or a  subroutine in FORTRAN. 24. How do you decide which integer type to use?   It depends on our requirement.  When we are required an integer to be stored in 1 byte (means less than or  equal to 255) we use short int, for 2 bytes we use int, for 8 bytes we use long  int.  A char is for 1-byte integers, a short is for 2-byte integers, an int is generally  a 2-byte or 4-byte integer (though not necessarily), a long is a 4-byte integer,  and a long long is a 8-byte integer. 25.What is a class?  Class is a user-defined data type in C++. It can be created to solve a  particular kind of problem. After creation the user need not know the specifics  of the working of a class.
  • 14. Page  14 For more details, Please log on to www.rekruitin.com Customer Care : 8855041500 Career Guidance : 9823205144 Tech Support : 7758806112 Human Resource: 9823204144 You can also Find us on: