SlideShare a Scribd company logo
1. What is computer?
ANS: A computer is a device that can be instructed to carry out sequences of
arithmetic or logical operations automatically via computer programming.
2. What is computer program?
ANS: A computer program is a set of instructions for a computer to follow
3. What is Computer software?
ANS: Computer software is the collection of programs used by a computer
4. Discuss Computer Vs Human?
ANS: Computers understand a language variously known as computer language or machine language.
 Therefore, computers and humans have agreed to sort of meet in the middle, using intermediate
languages
• Humans can speak C++ (sort of), and C++ is converted into machine language for the computer to
understand
5. What is Compilers?
ANS: Translate high-level language to machine language
6. What is source code?
ANS: Sourcecode: the original program in a high level language
7. What is object code?
ANS: the translated version in machine language
• Object code is also referred to as binary code or machine code
8. What is Linker?
• ANS: A Linker combines
• The object code for the programs we write
and
• The object code for the pre-compiled routines
into
The machine language program the CPU can run.
9. Why Do We Need Object-Oriented Programming?
ANS: Object-oriented programming was developed because limitations were discovered in earlier approaches
to programming. To appreciate what OOP does, we need to understand what these limitations are and how
they arose from traditional programming languages.
10. What is procedural language?
ANS: C, Pascal, and similar languages are procedural languages. That is, each statement in the language tells the
computer to do something.
11. What is class?
ANS: A class is a description of a number of similar objects.
12. What is instance of class?
Chapter 1: Object Oriented Programming in C++
ANS: specific people with specific names are members of this class if they possess certain characteristics. An
object is often called an “instance” of a class.
13. What are oo p characteristics?
14. What are the benefits of oop?
ANS:
15. What is Algorithm?
 ANS: Algorithms
◦ A sequence of precise instructions which leads to a solution
 Program
◦ An algorithm expressed in a language the computer can understand
16. How many types the problem solving in c++?
ANS: Problem Solving Phase
Implementation Phase
17. What is Problem solving Phase?
Develop the algorithm before implementation
18. What is implementation Phase?
ANS: Translate the algorithm into a programming
language
19. What are the three errors of programming language?
 Syntaxerrors
 Run-time errors
 Logicerrors
END Chapter1
20. What is Function?
 ANS: Functions are one of the fundamental building blocks of C++. The FIRST program consists almost
entirely of a single function called main ( ).
21. What is comment?
ANS: Comments help the person writing a program, and anyone else who must read the source file,
understand what’s going on.
22. Two types of comment?
 ANS: Single-line comment which begins with // and terminates at the end of the current line.
 Multi-line comment which begins with /* and ends with */.
23. What is Variable?
 ANS: A variable is a location in the computer's memory where a value can be stored for use by a
program.
 All variables must be declared with a name and a data type before they can be used in a program
 Declarations of variables can be placed almost anywhere in a program
 That value is actually placed in the memory space assigned to the variable.
Chapter2 C++Programming Basics
24. Tell the Basic Data base
25. Tell Their Basic Range
26. What is difference B/wee Expressions and Statements?
ANS: Any arrangement of variables, constants, and operators that specifies a computation is called an
expression.
Statements tell the compiler to do something and terminate with a semicolon.
27 Tell the rules of operator precedence?
ANS: PEDMAS (Parentheses, Exponents, Division, Multiplication, Addition and Subtraction)
END Chapter2
Q1: what is called operator that compares two values?
A1: A relational operator.
Q2: what do loops cause?
A2: Loops cause section of your program to be repeated a certain number of times.
Q3: what are three kinds of loops in C++?
• A3:There are three kinds of loops in C++:
• the for loop
• the while loop
• and the do loop
Q4: what is for loop?
A4: The for loop executes a section of code a fixed number of times.
Q5: when for loop used?
A5:It’s usually used when you know, before entering the loop, how many times you want to execute the code.
Q6: when while loop used?
A6: The while loop is used when you do not know how many times you want to do something before you start
the loop.
Q7: when test of while loop is evaluated?
A7: The test expression is evaluated at the beginning of the loop.
Q8: which have higher precedence arithmetic and rational operators?
A8: Note that arithmetic operators have a higher precedence than relational operators
Example (a < b / 2)
Q8: when do loop used?
A8: Use do loop when you want to guarantee that the loop body is executed at least once.
Chapter3 C++Programming Loops
Q9: when test of do while is evaluated?
A9: The test expression is evaluated at the end of the loop.
Q10: what do break and continue statement are used?
A10: break and continue statements are used to alter the flow of loops.
Q11: what are three types of decisions?
A11:
 The if statement
 The if...else statement
 Nested if...else statement
 The switch statement
Q12: what does if statement performs?
A12: The if statement performs an action if a condition is true or skips the action if the condition is false.
END Chapter3
Q1. Define function? And tell the most important reason to use functions?
A1. A function groups a number of program statements into a unit and gives it a name.
The most important reason to use functions is to:
Chapter4 C++ Programming Function
• Divide a program into units (divide & conquer).
• Reduce program size: the function’s code is stored in only one place in memory,
even though the function is executed many times.
Q2.What is the three components necessary to add a function to a program?
A2.The three components necessary to add a function to a program are:
a. the function declaration
b. the calls to the function
c. And the function definition.
Q3.Distinguish the different b/w function declaration, calling and function Definition?
A3. Function Declaration
 Declare the function before it is called
 Notice that the function declaration is terminated with a semicolon.
 Function declarations are also called prototypes, since they provide a model or
blueprint for the function.
 The keyword void specifies that the function has no return value, and the empty
parentheses indicate that it takes no arguments
Function calling
• To call a function we need: the function name, followed by parentheses.
• The syntax of the call is very similar to that of the declaration, except that the
return type is not used.
• The call is terminated by a semicolon.
Function definition
• The definition contains the actual code for the function.
• The definition consists of a line called the declarator, followed by the function
body.
• The declarator must agree with the declaration: It must use the same function
name, have the same argument types in the same order (if there are arguments),
and have the same return type.
• Notice that the declarator is not terminated by a semicolon.
Q4.Define declaration and tell some library functions?
A4.The declaration is in the header file specified at the beginning of the program (conio.h
for getche () and cmath.h for sqrt()).
Some library function such as getche () or sqrt ()?
Q5.What is an argument and parameters?
• An argument is a piece of data passed from a program to the function.
• Arguments allow a function to operate with different values, or even to do
different things, depending on the requirements of the program calling it.
The variables used within the function to hold the argument values are called
parameters.
Q6. What is the different b/w passing by value and passing by reference?
A6.Passing by value
• Passing by value means that the function creates copies of the arguments passed
to it. The called function creates a new variable of the same type as the argument
and copies the argument’s value into it.
• The function cannot access the original variable in the calling program, only the
copy it created.
• Passing arguments by value is useful when the function does not need to modify
the original variable in the calling program.
• In fact, it offers insurance that the function cannot harm the original variable.
Passing by reference
• In passing arguments by reference, a reference to the original variable, in the
calling program, is passed. (It is actually the memory address of the variable that
is passed).
• An important advantage of passing by reference is that:
 The function can access the actual variables in the calling program.
 It provides a mechanism for passing more than one value from the function
back to the calling program.
Q7.Describe Overloaded Functions with example?
A7.An overloaded function performs different activities depending on the kind of data
sent to it. It is more convenient to use functions with the same name even though they
each have different arguments.
Examples
• Declaration:
Voiddrawchar ();
Voiddrawchar (char);
Voiddrawchar (char, int);
• Calling:
Draw char ();
Draw char ('=');
Draw char ('+', 30);
Q8.What is Recursion?
A8.Recursion involves a function calling itself. Recursion is much easier to understand
with an example than with lengthy explanations.
Q9. What is Default Arguments?
A9.A function can be called without specifying all its arguments.
• The default argument follows an equal sign, which is placed directly after the type
name.
• Remember that missing arguments must be the trailing arguments—those at the
end of the argument list.
Q10. Differentiate Scope and Storage Class?
A10.scope
• The scope of a variable determines which parts of the program can access it, and
its storage class determines how long it stays in existence.
• Two different kinds of scope are important here: local and file.
 Variables with local scope are visible only within a block.
 Variables with file scope are visible throughout a file.
Storage Class
• A block is basically the code between an opening brace and a closing brace. Thus
a function body is a block.
• There are two storage classes: automatic and static.
• Variables with storage class automatic exist during the lifetime of the function in
which they are defined.
• Variables with storage class static exist for the lifetime of the program.
END Chapter4
C++ question and answers
C++ question and answers

More Related Content

What's hot

C programming basics
C  programming basicsC  programming basics
C programming basics
argusacademy
 
JAVA GUI PART I
JAVA GUI PART IJAVA GUI PART I
JAVA GUI PART I
OXUS 20
 
An introduction to Xamarin
An introduction to XamarinAn introduction to Xamarin
Operating Systems
Operating SystemsOperating Systems
Operating Systems
Harshith Meela
 
Loops in c++ programming language
Loops in c++ programming language Loops in c++ programming language
Ppt of c vs c#
Ppt of c vs c#Ppt of c vs c#
Ppt of c vs c#
shubhra chauhan
 
Networking in java, Advanced programming
Networking in java, Advanced programmingNetworking in java, Advanced programming
Networking in java, Advanced programming
Gera Paulos
 
Synchronous vs Asynchronous Programming
Synchronous vs Asynchronous ProgrammingSynchronous vs Asynchronous Programming
Synchronous vs Asynchronous Programming
jeetendra mandal
 
UNIT 10. Files and file handling in C
UNIT 10. Files and file handling in CUNIT 10. Files and file handling in C
UNIT 10. Files and file handling in C
Ashim Lamichhane
 
Modular programming
Modular programmingModular programming
3 definition of operating systems
3 definition of operating systems3 definition of operating systems
3 definition of operating systems
myrajendra
 
Structure of C program
Structure of C programStructure of C program
Structure of C program
Pavan prasad
 
User and Operating System Interface
User and Operating System InterfaceUser and Operating System Interface
User and Operating System Interface
Nusrat Jahan Shanta
 
Client server chat application
Client server chat applicationClient server chat application
Client server chat application
Samsil Arefin
 
Parallel Programming
Parallel ProgrammingParallel Programming
Parallel Programming
Uday Sharma
 
Wordpress ppt
Wordpress pptWordpress ppt
Wordpress ppt
Crest TechnoSoft
 
Java GUI PART II
Java GUI PART IIJava GUI PART II
Java GUI PART II
OXUS 20
 
Operating System-Types-Examples-Advantages & disadvantages
Operating System-Types-Examples-Advantages & disadvantagesOperating System-Types-Examples-Advantages & disadvantages
Operating System-Types-Examples-Advantages & disadvantages
OPTOM Nimra Murtaza
 
01 c++ Intro.ppt
01 c++ Intro.ppt01 c++ Intro.ppt
01 c++ Intro.ppt
Tareq Hasan
 
Windows programming ppt
Windows programming pptWindows programming ppt
Windows programming ppt
SAMIR CHANDRA
 

What's hot (20)

C programming basics
C  programming basicsC  programming basics
C programming basics
 
JAVA GUI PART I
JAVA GUI PART IJAVA GUI PART I
JAVA GUI PART I
 
An introduction to Xamarin
An introduction to XamarinAn introduction to Xamarin
An introduction to Xamarin
 
Operating Systems
Operating SystemsOperating Systems
Operating Systems
 
Loops in c++ programming language
Loops in c++ programming language Loops in c++ programming language
Loops in c++ programming language
 
Ppt of c vs c#
Ppt of c vs c#Ppt of c vs c#
Ppt of c vs c#
 
Networking in java, Advanced programming
Networking in java, Advanced programmingNetworking in java, Advanced programming
Networking in java, Advanced programming
 
Synchronous vs Asynchronous Programming
Synchronous vs Asynchronous ProgrammingSynchronous vs Asynchronous Programming
Synchronous vs Asynchronous Programming
 
UNIT 10. Files and file handling in C
UNIT 10. Files and file handling in CUNIT 10. Files and file handling in C
UNIT 10. Files and file handling in C
 
Modular programming
Modular programmingModular programming
Modular programming
 
3 definition of operating systems
3 definition of operating systems3 definition of operating systems
3 definition of operating systems
 
Structure of C program
Structure of C programStructure of C program
Structure of C program
 
User and Operating System Interface
User and Operating System InterfaceUser and Operating System Interface
User and Operating System Interface
 
Client server chat application
Client server chat applicationClient server chat application
Client server chat application
 
Parallel Programming
Parallel ProgrammingParallel Programming
Parallel Programming
 
Wordpress ppt
Wordpress pptWordpress ppt
Wordpress ppt
 
Java GUI PART II
Java GUI PART IIJava GUI PART II
Java GUI PART II
 
Operating System-Types-Examples-Advantages & disadvantages
Operating System-Types-Examples-Advantages & disadvantagesOperating System-Types-Examples-Advantages & disadvantages
Operating System-Types-Examples-Advantages & disadvantages
 
01 c++ Intro.ppt
01 c++ Intro.ppt01 c++ Intro.ppt
01 c++ Intro.ppt
 
Windows programming ppt
Windows programming pptWindows programming ppt
Windows programming ppt
 

Similar to C++ question and answers

Pc module1
Pc module1Pc module1
Pc module1
SANTOSH RATH
 
C Language Presentation.pptx
C Language Presentation.pptxC Language Presentation.pptx
C Language Presentation.pptx
PradeepKumar206701
 
C programming
C programmingC programming
C programming
Jigarthacker
 
Introduction Of C++
Introduction Of C++Introduction Of C++
Introduction Of C++
Sangharsh agarwal
 
Chapter One Function.pptx
Chapter One Function.pptxChapter One Function.pptx
Chapter One Function.pptx
miki304759
 
Functions in c
Functions in cFunctions in c
Functions in c
reshmy12
 
Bcsl 031 solve assignment
Bcsl 031 solve assignmentBcsl 031 solve assignment
INTRODUCTION TO C PROGRAMMING MATERIAL.pdf
INTRODUCTION TO C PROGRAMMING MATERIAL.pdfINTRODUCTION TO C PROGRAMMING MATERIAL.pdf
INTRODUCTION TO C PROGRAMMING MATERIAL.pdf
Subramanyambharathis
 
Introduction to c first week slides
Introduction to c first week slidesIntroduction to c first week slides
Introduction to c first week slides
luqman bawany
 
VIT351 Software Development VI Unit1
VIT351 Software Development VI Unit1VIT351 Software Development VI Unit1
VIT351 Software Development VI Unit1
YOGESH SINGH
 
cbybalaguruswami-e-180803051831.pptx
cbybalaguruswami-e-180803051831.pptxcbybalaguruswami-e-180803051831.pptx
cbybalaguruswami-e-180803051831.pptx
SRamadossbiher
 
cbybalaguruswami-e-180803051831.pptx
cbybalaguruswami-e-180803051831.pptxcbybalaguruswami-e-180803051831.pptx
cbybalaguruswami-e-180803051831.pptx
SRamadossbiher
 
Lecture 1
Lecture 1Lecture 1
Lecture 1
marvellous2
 
FUNCTION CPU
FUNCTION CPUFUNCTION CPU
FUNCTION CPU
Krushal Kakadia
 
Tutorial basic of c ++lesson 1 eng ver
Tutorial basic of c ++lesson 1 eng verTutorial basic of c ++lesson 1 eng ver
Tutorial basic of c ++lesson 1 eng ver
Qrembiezs Intruder
 
Technical trainning.pptx
Technical trainning.pptxTechnical trainning.pptx
Technical trainning.pptx
SanuSan3
 
Top 40 C Programming Interview Questions
Top 40 C Programming Interview QuestionsTop 40 C Programming Interview Questions
Top 40 C Programming Interview Questions
Simplilearn
 
Book management system
Book management systemBook management system
Book management system
SHARDA SHARAN
 
C.pdf
C.pdfC.pdf
over all view programming to computer
over all view programming to computer over all view programming to computer
over all view programming to computer
muniryaseen
 

Similar to C++ question and answers (20)

Pc module1
Pc module1Pc module1
Pc module1
 
C Language Presentation.pptx
C Language Presentation.pptxC Language Presentation.pptx
C Language Presentation.pptx
 
C programming
C programmingC programming
C programming
 
Introduction Of C++
Introduction Of C++Introduction Of C++
Introduction Of C++
 
Chapter One Function.pptx
Chapter One Function.pptxChapter One Function.pptx
Chapter One Function.pptx
 
Functions in c
Functions in cFunctions in c
Functions in c
 
Bcsl 031 solve assignment
Bcsl 031 solve assignmentBcsl 031 solve assignment
Bcsl 031 solve assignment
 
INTRODUCTION TO C PROGRAMMING MATERIAL.pdf
INTRODUCTION TO C PROGRAMMING MATERIAL.pdfINTRODUCTION TO C PROGRAMMING MATERIAL.pdf
INTRODUCTION TO C PROGRAMMING MATERIAL.pdf
 
Introduction to c first week slides
Introduction to c first week slidesIntroduction to c first week slides
Introduction to c first week slides
 
VIT351 Software Development VI Unit1
VIT351 Software Development VI Unit1VIT351 Software Development VI Unit1
VIT351 Software Development VI Unit1
 
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
 
Lecture 1
Lecture 1Lecture 1
Lecture 1
 
FUNCTION CPU
FUNCTION CPUFUNCTION CPU
FUNCTION CPU
 
Tutorial basic of c ++lesson 1 eng ver
Tutorial basic of c ++lesson 1 eng verTutorial basic of c ++lesson 1 eng ver
Tutorial basic of c ++lesson 1 eng ver
 
Technical trainning.pptx
Technical trainning.pptxTechnical trainning.pptx
Technical trainning.pptx
 
Top 40 C Programming Interview Questions
Top 40 C Programming Interview QuestionsTop 40 C Programming Interview Questions
Top 40 C Programming Interview Questions
 
Book management system
Book management systemBook management system
Book management system
 
C.pdf
C.pdfC.pdf
C.pdf
 
over all view programming to computer
over all view programming to computer over all view programming to computer
over all view programming to computer
 

Recently uploaded

Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AIEnchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Vladimir Iglovikov, Ph.D.
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
Adtran
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
Quotidiano Piemontese
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
Uni Systems S.M.S.A.
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
innovationoecd
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Aggregage
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
Neo4j
 
“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”
Claudio Di Ciccio
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Paige Cruz
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
Kari Kakkonen
 
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
Neo4j
 
20 Comprehensive Checklist of Designing and Developing a Website
20 Comprehensive Checklist of Designing and Developing a Website20 Comprehensive Checklist of Designing and Developing a Website
20 Comprehensive Checklist of Designing and Developing a Website
Pixlogix Infotech
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
SOFTTECHHUB
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
Matthew Sinclair
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
DianaGray10
 
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Speck&Tech
 
Large Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial ApplicationsLarge Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial Applications
Rohit Gautam
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
mikeeftimakis1
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
danishmna97
 

Recently uploaded (20)

Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AIEnchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
 
“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
 
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
 
20 Comprehensive Checklist of Designing and Developing a Website
20 Comprehensive Checklist of Designing and Developing a Website20 Comprehensive Checklist of Designing and Developing a Website
20 Comprehensive Checklist of Designing and Developing a Website
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
 
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
 
Large Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial ApplicationsLarge Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial Applications
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
 

C++ question and answers

  • 1. 1. What is computer? ANS: A computer is a device that can be instructed to carry out sequences of arithmetic or logical operations automatically via computer programming. 2. What is computer program? ANS: A computer program is a set of instructions for a computer to follow 3. What is Computer software? ANS: Computer software is the collection of programs used by a computer 4. Discuss Computer Vs Human? ANS: Computers understand a language variously known as computer language or machine language.  Therefore, computers and humans have agreed to sort of meet in the middle, using intermediate languages • Humans can speak C++ (sort of), and C++ is converted into machine language for the computer to understand 5. What is Compilers? ANS: Translate high-level language to machine language 6. What is source code? ANS: Sourcecode: the original program in a high level language 7. What is object code? ANS: the translated version in machine language • Object code is also referred to as binary code or machine code 8. What is Linker? • ANS: A Linker combines • The object code for the programs we write and • The object code for the pre-compiled routines into The machine language program the CPU can run. 9. Why Do We Need Object-Oriented Programming? ANS: Object-oriented programming was developed because limitations were discovered in earlier approaches to programming. To appreciate what OOP does, we need to understand what these limitations are and how they arose from traditional programming languages. 10. What is procedural language? ANS: C, Pascal, and similar languages are procedural languages. That is, each statement in the language tells the computer to do something. 11. What is class? ANS: A class is a description of a number of similar objects. 12. What is instance of class? Chapter 1: Object Oriented Programming in C++
  • 2. ANS: specific people with specific names are members of this class if they possess certain characteristics. An object is often called an “instance” of a class. 13. What are oo p characteristics? 14. What are the benefits of oop? ANS: 15. What is Algorithm?  ANS: Algorithms ◦ A sequence of precise instructions which leads to a solution  Program ◦ An algorithm expressed in a language the computer can understand 16. How many types the problem solving in c++? ANS: Problem Solving Phase Implementation Phase 17. What is Problem solving Phase? Develop the algorithm before implementation 18. What is implementation Phase? ANS: Translate the algorithm into a programming language 19. What are the three errors of programming language?
  • 3.  Syntaxerrors  Run-time errors  Logicerrors END Chapter1 20. What is Function?  ANS: Functions are one of the fundamental building blocks of C++. The FIRST program consists almost entirely of a single function called main ( ). 21. What is comment? ANS: Comments help the person writing a program, and anyone else who must read the source file, understand what’s going on. 22. Two types of comment?  ANS: Single-line comment which begins with // and terminates at the end of the current line.  Multi-line comment which begins with /* and ends with */. 23. What is Variable?  ANS: A variable is a location in the computer's memory where a value can be stored for use by a program.  All variables must be declared with a name and a data type before they can be used in a program  Declarations of variables can be placed almost anywhere in a program  That value is actually placed in the memory space assigned to the variable. Chapter2 C++Programming Basics
  • 4. 24. Tell the Basic Data base 25. Tell Their Basic Range 26. What is difference B/wee Expressions and Statements? ANS: Any arrangement of variables, constants, and operators that specifies a computation is called an expression. Statements tell the compiler to do something and terminate with a semicolon. 27 Tell the rules of operator precedence? ANS: PEDMAS (Parentheses, Exponents, Division, Multiplication, Addition and Subtraction) END Chapter2
  • 5. Q1: what is called operator that compares two values? A1: A relational operator. Q2: what do loops cause? A2: Loops cause section of your program to be repeated a certain number of times. Q3: what are three kinds of loops in C++? • A3:There are three kinds of loops in C++: • the for loop • the while loop • and the do loop Q4: what is for loop? A4: The for loop executes a section of code a fixed number of times. Q5: when for loop used? A5:It’s usually used when you know, before entering the loop, how many times you want to execute the code. Q6: when while loop used? A6: The while loop is used when you do not know how many times you want to do something before you start the loop. Q7: when test of while loop is evaluated? A7: The test expression is evaluated at the beginning of the loop. Q8: which have higher precedence arithmetic and rational operators? A8: Note that arithmetic operators have a higher precedence than relational operators Example (a < b / 2) Q8: when do loop used? A8: Use do loop when you want to guarantee that the loop body is executed at least once. Chapter3 C++Programming Loops
  • 6. Q9: when test of do while is evaluated? A9: The test expression is evaluated at the end of the loop. Q10: what do break and continue statement are used? A10: break and continue statements are used to alter the flow of loops. Q11: what are three types of decisions? A11:  The if statement  The if...else statement  Nested if...else statement  The switch statement Q12: what does if statement performs? A12: The if statement performs an action if a condition is true or skips the action if the condition is false. END Chapter3 Q1. Define function? And tell the most important reason to use functions? A1. A function groups a number of program statements into a unit and gives it a name. The most important reason to use functions is to: Chapter4 C++ Programming Function
  • 7. • Divide a program into units (divide & conquer). • Reduce program size: the function’s code is stored in only one place in memory, even though the function is executed many times. Q2.What is the three components necessary to add a function to a program? A2.The three components necessary to add a function to a program are: a. the function declaration b. the calls to the function c. And the function definition. Q3.Distinguish the different b/w function declaration, calling and function Definition? A3. Function Declaration  Declare the function before it is called  Notice that the function declaration is terminated with a semicolon.  Function declarations are also called prototypes, since they provide a model or blueprint for the function.  The keyword void specifies that the function has no return value, and the empty parentheses indicate that it takes no arguments Function calling • To call a function we need: the function name, followed by parentheses. • The syntax of the call is very similar to that of the declaration, except that the return type is not used. • The call is terminated by a semicolon. Function definition • The definition contains the actual code for the function. • The definition consists of a line called the declarator, followed by the function body.
  • 8. • The declarator must agree with the declaration: It must use the same function name, have the same argument types in the same order (if there are arguments), and have the same return type. • Notice that the declarator is not terminated by a semicolon. Q4.Define declaration and tell some library functions? A4.The declaration is in the header file specified at the beginning of the program (conio.h for getche () and cmath.h for sqrt()). Some library function such as getche () or sqrt ()? Q5.What is an argument and parameters? • An argument is a piece of data passed from a program to the function. • Arguments allow a function to operate with different values, or even to do different things, depending on the requirements of the program calling it. The variables used within the function to hold the argument values are called parameters. Q6. What is the different b/w passing by value and passing by reference? A6.Passing by value • Passing by value means that the function creates copies of the arguments passed to it. The called function creates a new variable of the same type as the argument and copies the argument’s value into it. • The function cannot access the original variable in the calling program, only the copy it created. • Passing arguments by value is useful when the function does not need to modify the original variable in the calling program. • In fact, it offers insurance that the function cannot harm the original variable. Passing by reference
  • 9. • In passing arguments by reference, a reference to the original variable, in the calling program, is passed. (It is actually the memory address of the variable that is passed). • An important advantage of passing by reference is that:  The function can access the actual variables in the calling program.  It provides a mechanism for passing more than one value from the function back to the calling program. Q7.Describe Overloaded Functions with example? A7.An overloaded function performs different activities depending on the kind of data sent to it. It is more convenient to use functions with the same name even though they each have different arguments. Examples • Declaration: Voiddrawchar (); Voiddrawchar (char); Voiddrawchar (char, int); • Calling: Draw char (); Draw char ('='); Draw char ('+', 30); Q8.What is Recursion? A8.Recursion involves a function calling itself. Recursion is much easier to understand with an example than with lengthy explanations.
  • 10. Q9. What is Default Arguments? A9.A function can be called without specifying all its arguments. • The default argument follows an equal sign, which is placed directly after the type name. • Remember that missing arguments must be the trailing arguments—those at the end of the argument list. Q10. Differentiate Scope and Storage Class? A10.scope • The scope of a variable determines which parts of the program can access it, and its storage class determines how long it stays in existence. • Two different kinds of scope are important here: local and file.  Variables with local scope are visible only within a block.  Variables with file scope are visible throughout a file. Storage Class • A block is basically the code between an opening brace and a closing brace. Thus a function body is a block. • There are two storage classes: automatic and static. • Variables with storage class automatic exist during the lifetime of the function in which they are defined. • Variables with storage class static exist for the lifetime of the program. END Chapter4