Simple Interest Algorithm
Step1 :- Start
Step2 :- store 10 into P, 2 into N, 3 into R
Step3 :- calculate si=P*N*R/100
Step4 :- Print the value of Simple Interest
Step5 :- Stop
An 'EduTech' is short for Education & Technology, refers to new Technological implementations for the Department of Education and Literacy!
Simple Interest Algorithm
Step1 :- Start
Step2 :- store 10 into P, 2 into N, 3 into R
Step3 :- calculate si=P*N*R/100
Step4 :- Print the value of Simple Interest
Step5 :- Stop
Physiotherapy as described by World Physiotherapy is a health care profession concerned with human function and movement and maximising physical potential.
Physical therapy (PT), also known as physiotherapy, is one of the allied health professions.
It is provided by physical therapists who promote, maintain, or restore health through physical examination, diagnosis, prognosis, patient education, physical intervention, rehabilitation, disease prevention, and health promotion.
Questions and Answers
Q.1. How does Toto come to grandfather’s private zoo ?
Ans. A tanga-driver used to keep a little’red monkey tied to a feeding trough. Grandfather buys the monkey from the tanga-driver for five rupees. He brings it home and names it Toto. In this way, Toto comes to grandfather’s private zoo.
प्रश्न 1. टोटो दादाजी के निजी चिड़ियाघर में कैसे आता है ?
उत्तर। एक तांगा-चालक एक छोटे से लाल बंदर को चारागाह से बांधकर रखता था। दादाजी ने बंदर को तांगा-चालक से पांच रुपये में खरीदा। वह इसे घर लाता है और इसे टोटो नाम देता है। इस तरह टोटो दादा के निजी चिड़ियाघर में आ जाता है।
Q.2. “Tota was a pretty monkey.” In what sense is Toto pretty?
Ans. Toto is a pretty monkey. He has bright eyes which always sparkle with mischief. He has white teeth like pearls. He often displays them in a smile. He has a long tail which serves him as a third hand.
1. What is the purpose of a header file in a program?
Ans. Header files provide function prototypes, definitions of library functions, declaration of data types and constants used with the library functions.
2. What main integer types are offered by C++?
Ans. C++ offered three types of integers : short, int and long. Each comes in both signed and unsigned versions.
3. Explain the usage of following with the help of an example:
(i) constant (ii) reference (iii) variable (iv) union
Ans. (i) constant: The keyword const can be added to the declaration of an object to make that object a constant rather
than a variable. Thus, the value of the named constant cannot be altered during the program run. The general form of
constant declaration is as follows: const type name = value. Example: const int a=10;
(ii) reference: A reference is an alternative name for an object.
A reference variable provides an alias for a previously defined variable.
The general form of declaring a reference variable is:
Type &ref-var = var-name;
where type is any valid c++ data type, ref-var is the name of reference variable that will point to variable denoted by
var-name. Example:
int total;
int &sum=total;
total=100;
cout<<"Sum="<<sum<<"\n";
cout<<"Total="<<total<<"\n";
In above code both the variables refer to the same data object in the memory, thus, print the same value.
(iii) variable: Variables represent named storage locations whose value can be manipulated during program run.
Variables are generally declared as: type name; where type is any C++ data type and name is the variable name. A
variable can be initialized either by a separate assignment statement following its declaration as shown below:
int age; age = 10;
(iv) union: A union is a memory location that is shared by two or more different variables, generally of different types
at different times. Defining a union is similar to defining a structure. Following of declaration declares a union share
having two variables and creates a union object cnvt of union type share:
union share{
int i;
char ch;
};
union share cnvt;
union can referred to the data stored in cnvt as either an integer or character. To assign the integer 20 to element i of
cnvt, write - cnvt.i = 20;
To print the value of element ch of cnvt,
write - cout<<cnvt.ch;
5. What is the difference between fundamental data types and derived data types? Explain with examples.
Ans. Fundamental data types
1) These are the data types that are not composed of any other data type.
2) There are five fundamental data types: char, int, float, double and void.
3) Example: int a=10; float b;
Derived data types
1) These are tha data types that are composed of fundamental data types.
2) These are: array, function, pointer, reference, constant, class, structure, union and enumeration.
3) Example: float marks[50]; Const int a=5;
5. How many ways can a variable be initialized into? Give examples for each type of initialization.
Ans. A variable can be initialized into two ways as following:
(i) By separate assignment statement: Example: int age;
age = 10;
(ii) At the time of declaration: Example: int age = 10;
(iii) Dynamic initialization: Example: float avg = sum/count;
6. How are the following two statements different?
char pcode = 75;
char pcode = ‘K’;
Ans. The first statement treats 75 as ascii value and converts it into its relative character ‘K’ whereas second statement
stores character ‘K’ and does not make any conversion.
7. How are the following two statements different?
char pcode = 75; short pcode = 75;
Ans. The first statement treats 75 as ascii value and converts it into its relative character ‘K’ whereas second statement
treats 75 as number.
8. If value is an identifier of int type and is holding value 200, is the following statement correct?
char code = value
Ans. VALID Statement
9. The data type double is another floating-point type. Then why is it treated as a distinct data type?
Ans. The data type double is treated as a distinct data type because it occupies twice as much memory as type float, and
stores floating-point numbers with much larger range and precision. It stands for double precision floating-point. It is
used when type float is too small or insufficiently precise.
10. Explain the impact of access modifier const over variables. Support your answer with examples.
Ans. The access modifier const can be added to the declaration of an object to make that object a constant rather than a
variable. Thus, the value of the named constant cannot be altered during the program run whereas the value of the
variable can be changed during the program run.
Example: void main()
{
const int a=10;
int b=20;
a++;
cout<<"a="<<a;
b++;
cout<<"b="<<b;
}
11. What are arithmetic operators in C++? Distinguish between unary and binary arithmetic operators. Give examples for each of them.
Ans. Following are the arithmetic operators in C++: addition(+), subtraction(-), multiplication(*), division(/) and reminder(%).
Unary arithmetic operators
1) Unary Operators has only one operand.
2) The Unary Operators are ++,--,&,*,+, - etc.
3) Example: short x = 987; x = -x;
Binary arithmetic operators
1) Binary operators (”bi” as in “two”) have two operands
2) The +, -, &&, <<, ==, >> etc. are binary operators.
3) Example: int x, y = 5, z;
z = 10;
x = y + z;
12. What is the function of increment/decrement operators? How many varieties do they come in? How are these two varieties different from one another?
Ans. The increment operator, ++ adds 1 to its operand and the decrement operator -- subtract 1 from its operands.
The increment/decrement operator comes in two varieties as following: (i) Prefix version and (ii) Postfix version:
Prefix version
1) Performs the increment or decrement operation before using the value of the operand.
2)
Example: sum = 10;
ctr = 5;
sum = sum + (++ctr);
Postfix version
1) First uses the value of the operand in evaluating the expression before incrementing or decrementing the operand’s value.
2)
Example: sum = 10;
ctr = 5;
sum = sum + (ctr++);
Overview of C++
KEY POINTS:
Introduction to C++
C++ is the successor of C language & developed by Bjarne Stroustrup at Bell Laboratories,
New Jersey in 1979.
Tokens- smallest individual unit. Following are the tokens
Keyword-Reserve word that can‘t be used as identifier
Identifiers-Names given to any variable, function, class, union etc.
Literals-Value of specific data type
Variable- memory block of certain size where value can be stored and changed.
Constant- memory block where value can be stored once but can‘t changed later on
Operator – performs some action on data
o Arithmetic(+,-,*,/,%)
o Relational/comparison (<,>,<=,>=,==,!=).
o Logical(AND(&&),OR(||),NOT(!).
o Conditional (? :)
o Increment/Decrement Operators( ++/--)
Precedence of operators:
++(post increment),--(post decrement) Highest
Low
++(pre increment),--(pre decrement),sizeof !(not),-(unary),+unary plus)
*(multiply), / (divide), %(modulus)
+(add),-(subtract)
<(less than),<=(less than or equal),>(greater than), >=(greater than or equal to)
==(equal),!=(not equal)
&& (logical AND)
||(logical OR)
?:(conditional expression)
=(simple assignment) and other assignment operators(arithmetic assignment
operator)
, Comma operator
Data type- A specifier to create memory block of some specific size and type. For example –
int,float,double,char etc.
cout – It is an object of ostream_withassign class defined in iostream.h header file and used to
display value on monitor.
cin – It is an object of istream_withassign class defined in iostream.h header file and used to read
value from keyboard for specific variable.
comment- Used for better understanding of program statements and escaped by the compiler to
compile . e.g. – single line (//) and multi line(/*….*/)
Control structure :
Sequence
control
statement(if)
conditional
statement
(if else)
case control statement
(switch case)
loop control statement
(while ,do… while, for)
Syntax Syntax Syntax Syntax
if(expression)
{
statements;
}
If(expression)
{
statements;
}
else
{
statements;
}
switch(integral expression)
{case (int const expr1):
[statements
break;]
case (int const expr2):
[statements,
break;]
default:Statements;}
while(expression)
{statements;}
do ….while loop
do
{statement;} while(expression);
for loop
for(expression1;expression2;expression3)
{statement;}
Note: any non-zero value of an expression is treated as true and exactly 0 (i.e. all bits contain
0) is treated as false.
Nested loop -loop within loop.
5
exit()- defined in process.h and used to leave from the program.
break- exit from the current loop.
continue- to skip the remaining statements of the current loop and passes control to the next loop
control statement.
goto- control is unconditionally transferred to the location of local label specified by <identifier>.
For example
A1:
cout<<‖test‖;
goto A1;
Some Standard C++ libraries
Header Nome Purpose
iostream.h Defines stream classes for input/output streams
stdio.h Standard input and output
ctype.h Character tests
string.h String operations
math.h Mathematical functions such as sin() and cos()
stdlib.h Utility functions such as malloc() and rand()
Some functions
isalpha(c)-check whether the argument is alphabetic or not.
islower(c)- check whether the argument is lowecase or not.
isupper(c) - check whether the argument is upercase or not.
isdigit(c)- check whether the argument is digit or not.
isalnum(c)- check whether the argument is alphanumeric or not.
tolower()-converts argument in lowercase if its argument is a letter.
toupper(c)- converts argument in uppercase if its argument is a letter.
strcat()- concatenates two string.
strcmp-compare two string.
pow(x,y)-return x raised to power y.
sqrt(x)-return square root of x.
random(num)-return a random number between 0 and (num-1)
randomize- initializes the random number generator with a random value.
Array- Collection of element of same type that are referred by a common name.
One Dimension array
An array is a continuous memory location holding similar type of data in single row or single
column
Two dimensional array
A two diamensional array is a continuous memory location holding similar type of data in of
both row sand columns (like a matrix structure).
Function -Self-contained block of code that does some specific task and may return a value.
Function prototypes-Function declaration that specifies the function name, return type and
parameter list of the function.
syntax: return_type function_name(type var1,type var2,….,type varn );
Passing value to function-
Passing by value
Passing by address/reference
Function overloading
Processing of two or more functions having same name but different list of parameters
Function recursion
Function that call itself either directly or indirectly.
Local variables
Declared inside the function.
Global variables
Declared outside all braces { } in a program
Actual Parameters
Variables associated with function name during function call statement.
Formal Parameters
Variables which contains copy of actual parameters inside the function definition.
6
Structure-Collection of logically related different data types (Primitive and Derived) referenced under
one name.
Nested structure
A Structure definition within another structure.
A structure containing object of another structure.
typedef
Used to define new data type name
#define Directives
Use to define a constant number or macro or to replace an instruction.
Inline Function
Inline functions are functions where the call is made to inline functions, the actual code then
gets placed in the calling program.
What happens when an inline function is written?
The inline function takes the format as a normal function but when it is compiled it is compiled
as inline code. The function is placed separately as inline function, thus adding readability to
the source program. When the program is compiled, the code present in function body is
replaced in the place of function call.
General Format of inline Function:
The general format of inline function is as follows:
inline datatype function_name(arguments)
inline int MyClass( )
Example:
#include <iostream.h>
int MyClass(int);
void main( )
{int x;
cout << ―\n Enter the Input Value: ‖;
cin>>x;
cout<<‖\n The Output is: ― << MyClass(x);
}
inline int MyClass(int x1)
{return 5*x1;}
The output of the above program is:
Enter the Input Value: 10
The Output is: 50
The output would be the same even when the inline function is written solely as a function.
The concept, however, is different. When the program is compiled, the code present in the
inline function MyClass ( ) is replaced in the place of function call in the calling program. The
concept of inline function is used in this example because the function is a small line of code.
The above example, when compiled, would have the structure as follows:
#include <iostream.h>
int MyClass(int);
void main( )
{int x;
cout << ―\n Enter the Input Value: ‖; cin>>x;
//The MyClass(x) gets replaced with code return 5*x1;
cout<<‖\n The Output is: ― << MyClass(x);
}
#include <iostream.h>
int MyClass(int);
void main( )
{int x;
cout << ―\n Enter the Input Value: ‖;
cin>>x;
//Call is made to the function MyClass
7
cout<<‖\n The Output is: ― << MyClass(x);
}
int MyClass(int x1)
{return 5*x1;}
1) What is Formatting?
Answer | Formatting means to make the document more attractive by changing the font style, font size, font type etc.
2) What is the short cut key for making text underline?
Answer | Ctrl + U
3) What is the short cut command for pasting object?
Answer | Ctrl + V
4) What are bullets and numbers?
Answer | Bullets and numbers are added before the text.
B) Tick the correct answer:
1) It makes the text darker than the normal text.
Answer | b. Bold
2) It makes the text appears below the line.
Answer | c. Subscript
3) It means to show the text selected with different Colors.
Answer | c. Formatting Text
4) It means the change the position of the text in the document.
Answer | c. Alignment
5) It align the text evenly from both left and right margin.
Answer | c. Justify Alignment
C) Fill in the blanks:
1) Formatting
2) Mini toolbar
3) Character Formatting and Paragraph Formatting
4) Centre Alignment
5) Bullets or numbers
D) True / False Statements!
1) False
2) True
3) True
4) False
5) False
E) Short Key to do the following:
1) Make text bold Ctrl + B
2) To underline text Ctrl + U
3) To make text italics Ctrl + I
4) To make text superscript Ctrl + Shift + =
5) To make text subscript Ctrl + =
6) To copy format Ctrl + Shift + C
7) To Paste format Ctrl + Shift + V
G) Answer the following questions:-
1) What do you mean by formatting?
Answer | Formatting means to make the document more attractive by changing the font style, font size, font type etc.
2) Define the formatting tools.
Answer | Formatting tools is used to format the text like bold, italic, underline and etc.
3) Describe text alignment?
Answer | Text alignment means to change the position of the text in the document.
4) What do you mean by highlighting text?
Answer | Highlighting text means to show the text selected with different Colors.
5) Differentiate between subscript and super script?
Answer | Subscript makes the text appears below the line. while superscript makes the text appears above the line.
A) Oral Questions
1) What is MS-PowerPoint?
Answer | MS PowerPoint is a Presentation Software that present our information in a presentation format on series of slides.
2) What are placeholders?
Answer | Placeholders are used to add the information.
3) What is the use of outline pane?
Answer | The use of outline pane for designing and organising the content of presentation.
4) What do you mean by alignment?
Answer | Alignment means to change the position of the text.
B)Tick the Correct answer:
1) This software presents our information in a presentable format on series of slides.
Answer | c) Presentation
2) It is used to add elements like text, graphics, movies and sound in the slide.
Answer | Slide Pane
3) In this view, all slides can be seen all together.
Answer | Slide sorter view
4) In this view, you can type your own notes and take printout.
Answer | Notes Page View
5) In this view, the presentation is displayed as slide show that fits within window.
Answer | Reading View
C) Fill in the blanks:
1) Presentation
2) Slide
3) Outline Pane
4) Slide show View
5) Smart Art Graphics
D) True/False Statements
1) False
2) True
3) True
4) False
5)True
E) Match the Following:
1) Slides-->c
2) Notes Pane -->d
3) Place holders -->e
4) Slide Layout -->b
5) SmartArt-->a
F) Answer the following questions:
1) What is the importance of a presentation?
Answer | The importance of a presentation to viewed on a projector by attaching the computer.
2) What is the use of place holder?
Answer | The use of place holder to add information on it.
3) What is Slide Layout?
Answer | Slide Layout appears in slide panel that can be changes and arrange the slide content.
4) What is slide in presentation?
Answer | Slide is the main screen of the power point window.
5) Define Normal View?
Answer | Normal view allowed to write and design a presentation. It contains four working areas.
4) Answer these questions:
a) What is a Computer Virus?
Answer | A Computer Virus is a Program or a Piece of Code that is loaded on to your computer without your knowledge.
b) What are the symptoms of a computer infected with viruses?
Answer | The symptoms of a computer infected with viruses are:-
1) New files or folder appearing on system.
2) Program size keep changing.
c) Name any two types of computer viruses.
Answer | There are two types of computer viruses are :-1) Program Viruse 2) Boot Virus
d)What are e-mail viruses?
Answer | E-mail viruses use email messages to spread. An email virus automatically forward itself to thousands of people.
e) Name any three anti-virus software.
Answer | The three antivirus software are:- 1) Kaspersky 2) Quick Heal 3) McAfee
Part-A Multiple Choice Questions 1) Who is the developer C++? a) Von Neumann b) Dennis M. Ritchie c) Charles Babbage d) Bjarne Stroustrup ...