0% found this document useful (0 votes)
11 views

Adobe Scan 18 Dec 2024

Uploaded by

crazysamosa05
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

Adobe Scan 18 Dec 2024

Uploaded by

crazysamosa05
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 19

Program outline

National Mathematics day 22-12-2024


Date of celebration: 23-12-24

From 8.00am to 9.00am

" Rangoli making -college's front region floor planned for Rangoli
" poster arrangements( for competitionsrOom no 3)
" Mathematical model arrangementroom no 3
" Poster on projects Visible front campus of college.

From 9.00am to 10.am- Assessment by teachers

From 10.am to 10.45 time for visiting students to observe posters.


10,45 am

" All students assermble in room no1


At 11 am Venue- room no

Anchor- Master Nachiket Deshmukh

" Dip-prajwalan by chief guest and Principal


" Buddha- vandana
Introduction to event (preface)
Introduction to Chief Guest. -by Miss Devyani Patil
Welcome to Chief guest -: Dr. Narendra Deshrmukh
Chairperson-: Principal Dr. Yogesh Borale
" Speeches of students
Prize distribution Miss Shravani Mahadik
Speech of guest
" Speech of chairperson
" Vote of thanks -Miss Shravani Salunke

At 1.00 pm

" Hands on training on a microscope by Dr. Narendra Deshmukh


Venue- physics lab.
At 2.15pm

" Interaction with teachers Venue- Auditoriurm hall.


uction to C++
,
41
KEYWORDS
Following are the keywords of the C++ language. (total
considered to be reserved. Keywords are not allowed to be 48).Keywords should be
are as tollows: used as variable names. They
asm ,auto,break ,case ,catch ,char , class, const,
enun, extern float for friend continue ,default ,delete, do ,double ,else
,goto,if,inline, int ,long, new ,operator, private, protected,
Dublic, register, return, short, signed, sizeof
fvpedef, union, unsigned, virtual, void, volatile,static,
while
struct, switch, template, throw, try,
INDENTIFIERS
Avalid identifier is a sequence of one or more letters, digits or underline
(L). symbols
there is no limit to the length of an
first 32characters of an identifier are identifier,, although for some compilers only
Neither spaces nor marked letters cansignificant
be part of an identifier. Only letters,
and underline characters are valid digits
the underscore character''
counts as a letter, In addition, variable identifiers
shouldalways begin with a letter. They can also begin with an
(), In no case they can begin with a digit. underline character
case is significant and all characters are
considered significant.
language's keywords should not be used to define an identifier
LITERALS:
Literal may be, character constant, integer
Constant. constant, floating point constant, string
3.5 OPERATORS IN C++
Anoperator does some operation on operands and this
operator's symbol. C++ has many operators, mainlyoperation is normally specified by
classified
working on single operand and binary, working on 2 operands. as unary operators,
Although C++ allows us to multiple meanings to the
operators, yet their association and
precedence remains same. E.g. (*) multiplication operator
than (+) add is having higher precedence
operator.
Following table lists all the C++ operators in order of
Cxpression involving operators of equal precedence isnon-increasing precedence. An
associability of the evaluated according to the
operators.
42

&&& & *,
1,% (rype) Sizeof * -,+
!=
, &
Operator(s)
OR
Logical|Logical
AND wiseOR AND
Bit XORwiseinequality
Bit Equality ShiftAddiionand Pointer|Pointer
Multiplication,
wiseBit and than, Less subtraction
(remainder). (coercion)
Typecast Sizeaddress
PointerLogincrement
cdecrement member
Class
al aUnarnd yreference elconstruction
Arement
Pointerreference
ray ValFunct
ue ionGlcaol(balsucnaropey)
greater than, left of Description(s)
to to an minus to
less and membermember negat
dereference
object ion class
than and
than shift division
or right selector
selector and plus nember
equal or (indirection) l's
equal,
and
modulus complement reference
greater
and

Associativity
leftto
lefttoright
right
left right
to leftto
right right
left
leftto right to
right
lefttoright lefttoright
lefttorightlefttoright lefttoright leftto right
lefttoright
leftto right lefttoright
lefttoright
leftto right lefttorightlefttorightleftto rightlefttorightlefttorighilefttozightleftto

sameleve Introductior
Connect
expressi AritH1)Some ofBrackets
Min C++ In
sc 2)
In +5,
b.
Mind C++ In 2) connected same
expression 1) Some Brackets IntroductionC++ to
some
Increment C. b. a.
Arithmetic
provides
it, of level. +=,
Ternary
Needs e.g. Here e.g. This % * operands.
-
Following+ Needs 2
Binary e.gNeeds
. Unary o=,*=,=,
situations,conditional
these (Subtraction
(Slash /(Addition
(Multiplication the are >>=,
K<= =,
(Modulus ta, by is Level
5operator
it a+ arithmetic
only made important evaluated &=,
special
operators and 3 gives
% b, or arithmetic arithmetic
-b operators:
operands.
arithmetic 2 c/d, division) uses evaluate ^=,
decrement a operator arithmetic
or one up
operators need remainder separators
can' t or
plus) of _expression
from Comma |AssignmentConditional
wil a unary
operand. operators
are give % minus)
or operators.
operator
may This be operator from
the
constants, They
unary b, star) separators operator
lateroperator applied
operators
++arise is l etc.
after for leftinside
as are
i.e. and inone Following to
to division.a remainder) varjables,.a used right out,
warning increase
this ofremainder with need
namely+
--
chapter). the for when
to floats 2
special are
do operands. (positive) mathematical dealing
on or
the while or the
combination
a double subtypes:
singledecrease,
same. features
5/2 with
will type. and
operand. multiple
value of - calçulations. of
C++ give (negative). both right
leftto rightleftto
rightleftto
of 2
a
language. or operators
as
variable a
quotient. function a An
(See
arithmetic of
by the 43
1. call,
Introduction to Ct
floating-point data type.
constant or
44 decrement types:variable and then take this new
increment or be of2
can
Alsoit is illegal to decrementing the yalue of the
and
increment/decrement
Theincrementing decrement the
a. Prefix:
first
value for processing.
e.g. ++a,--b
variable
increment or variable.
Eg
take the value ofthe
b. Postfix: First
a++, b respectively.
and Postfix 5 them. Here values of a
Use ofPrefix b are 5 and b-and print and
ofa and and
Supposeinitial values operation on it i.e. a++
postfix them wil be
bUPpose, I do
b remain
only.
unaltered. i.e. 5 and 5 done,values of a and b are printed
changed
operation is
While after postfix
to 6 and 4 respectively.
operators are binary
3) Relational operator: between 2 values. All C++
the relation
These are used to test
operators and hence require 2 operands. arithmetic expressions connected by a relationai
is made up of 2 nonzero when it is true.
Arelational expression when the relation is false while
operator. Itreturns zero
Result
Symbol Form
Operator a<b Returns 1 if ais iess thanb
Less than otherwise 0

Greater than a>b Returns 1if a is greater than b


otherwise 0
Less than a <=b Returns 1if ais less than or equal to
Or equal to b otherwise 0
Greater than a =b Returns 1if a is greater than or equ
Or equal to to b otherwise 0
Equal to equal to a==b Returns 1if both are equal (same)
Not equal to a!=b Returns1if both values are not
equal
These operators are having lower precedence than
e.g. a+b*c>d %fis evaluated as arithmetic operators.
(a +(b*c))> (d %f)
4) Logical operators: (Boolean
They combine the results of one operators)
or more expression and the resultant expressiol iscalled
as logical expression.
45
Introduction to C++

After testing the conditions, they return logical status (true or false)
may be constants, variables or
They may be unary or binary operators, and the operands
numbers.
even expressions. The operands may be integers/floating point
Form Result
Operator Symbol
a& & b Returns lif a and b are nonzero
Logical AND & &
else returns )
a ll b Returns 1if a or b is nonzero,
Logical OR
else 0
!a Returns 1if a is zero else
Logical negation returns 0

e.g. if ((a < b) && (a < c))


{
cout <K "a is smallest":
}
Hierarchy of logical operators
Logical NOT ()operator has a higher precedence thàn other.
While AND (&&) has higher precedence than logical OR ()
They have lower precedence than the relational and arithmetic operators.
Truth (Boolean) table for !operator - takes only loperand(used for negation)

Operator Operand Result


(false) 0 1
(true) I or nonzero 0
Truth (Boolean) table for && operator: Takes 2operands.

Operand 1 Operator Operand 2 Result


(&&)
False (0) && False (0) 0
True && False (0)
(nonzero)
True
False(0) &&
(nonzero)
True True
&&
(nonzero) 1(nonzero)
(nonzero)
If both the operands are true (nonzero) or if they are the expression returning true value
then only result is true otherwise false.
Introduction to t
operands.
2
46 operator:Takes Result
for ll
Truth (Boolean)table Operand2
Operand() False(0) 1
Operand1 False(0)
False (0)
True True (nonzero)
(nonzero) True (nonzero) 1(nonzero)
False(0)
True
(nonzero) false
or
expressionsreturns otherwise
when boththe operands
Returns false (0) only
always true.
operator (?: ) an _éxpression using conditiong
5) Conditional The value at
3.arguments.
It is ternary operatortaking its 2 or 3" operand, depending on
the value of the fi
operator is the value of either structure in the na
operand.
control structure. (Refer if...else control
This isequivalent to if.else
part)
Form
Result
Operator Symbol ff a is nonzero, result is b,
Conditional ?: a?b:c
otherwise it is c

and 3rd represens


In the above statement, the first operand is the test condition while 2nd
the final value of the expression. The following expression assigns greater value of a
to variable Max.
Max =(a> b) ?a :b);

6) Assignment operator ( =)
=operator causes the value of the right hand operand to be
operand. assigned to the left hau
The left hand operand, sometimes called as
location. lvalue, must always refer toa memoy

This operator has right-to-left


e.g. x=y=z=5: associativity.
is interpreted as,
(x=y= (z= 5));
Ctt Introduction to C++ 47

)Shorthand (compound) operators


C++ supports additional assignment operators combining assignment with each of the
arithmetic operations.

Operator Symbol Form Operation


Add-assign += a += b Equivalent to a =a +b
Subtract-assign -= a-=b Equivalent to a=a- b
Multiply-assign a *=b Equivalent to a =a*b
divide-assign /= a/=b Equivalent to a = a/b
Remainder-assign % = a%=b Equivalent to a = a% b

8) Bitwise operators:
Some special C+t oprators can also work on the bits, so they may be called to as bit
al manipulation operators.
They are used to manipulate or modify the individual bits of the piece of data.
They can be used only with the integral built-in data type i.e. in connection with char or
Xt int.

Operator Form Meaning


One's complement
a >>b Right shift a by b
<< a<<b Left shift a by b
& a &b Bitwise AND
alb Bitwise OR
b a ^b Bitwise XOR

a) One's complement operator (-)


The number iscomplemented (1's complement) by replacing all 1's by 0's and vice
versa. e.g. 1's complement of 1100 is 0011.

b) Right shift operator (>>)


Operator on the single operand.
Shifts each bit in the.operand to the right.
Number of places the bits. are shifted, depends on the number following the operand.
g SuppOse binary representation of a number x is 1001 1100
then x >>1 gives 0100 11 10
When number is shifted to right, left place is emptied and filled with 0.
dividingthat
Introduction
number by 2.,
48 equivalentto
is
operand one bittothe right
Shifting
e.g. 32 >> 1gives 16
32 >> 2 gives 8
right of
operator zeros are
and 11001001
added to the number
c) Left shift (<<) operand tothe left
It shifts each bitin the
binary representation ofanumber is
equivalentis 1001 0010
C.g. 1,it's multiplying number by 2.
So when it is leftshiftedI by
equivalentto
Left shifting by I is
data type as well as
d) Bitwise AND operator ( & ) operands should be the same
It works on 2 operands
and both the
either char or int.
operator (&) is to clear the given bit.
Ihe purpose of AND
1$ bit & 2 bit
2d bit
1st bit
0
0 0
1
1

1100 0111
e.g.
&
10110100
Result 1000 0100

e) Bitwise OR operator ( |)
It also works on 2operands. It is used to set the resultant bit to 1.
1 bit 2nd bit 1 bit 2nd bit

- 1
1

e.g. 1100 1001

1001 1101
Result 1101 1101
Introduction to C++
49

OBitwise XOR (^) operator


It works on 2 operands. It sets the resultant bit if both the bits on
which it operatorsS are
not equal.
Bit 1 Bit 2 Bit 1 ^ Bit 2

1
1 1
0

e.g. 1011 1000

1100 1001
0111 0001

9) Operators dealing with streams


a) Insertion operator (<<)
Stream decides flow of data. There are many types of streams in C++,but dealing with
input and output is called iostream.The operator dealing with output stream is called
insertion or put to operator. It inserts the contents of the variable on its right to the object
on its left. Thisoperator is used along with output stream.
e.g. Cout <<a;
Here value at variable a declared in the program is printed on standard output
device.(screen)
While, cout << "a": will display character a (included in double quotes)
on the Screen.

b) Extraction operator (>>)


It is get from operator. It extracts/takes the value from the standard input device i.e.
keyboard and assigns is to the variable on its right. It is associated with the input stream.
e.g. cin >> a;
So value entered by the user from keyboard is assigned to variable a declared in the
program.
10) Comma Operator
Multiple expressions can be combined into one expression using the comma operator.
The comma operator takes two operands. It first evaluates the left operand and then the
nght operand, and returns the value of the latter as the final outcome.
C.g int m, n, min;
int mCount = 0, nCount = 0;
=7bytes
string
size 1.45L
1.35size
bytesdouble
=8 size=4
floatbytes
long intshortchar* charWhen encountered far.so andtakes e.g 50
size dependent. operator,
providesC++ 11) Otherwise, This Here
size The
size size
=2
size size size run,
<iostream.h>
#include
main
void )
returns a for(int
operator when I...
= = = =l single sizeof
= 4 bytes 2 2= the min
10 bytes8 bytes Following the
bytes bytes
bytesbytesprogram nCount++
i=0,int can m=
operand, Operator a is (m
size useful less
"'string
cout<< cout cout cout cout cout cout cout cout cout
j=1 also
will <<
of <n?mCounttt,be is than
<<'"double
<<'"1.55 << << << << << << progran he
twhich ;
produce "1.55L "float"long "int
"short used
i<=10evaluated n,
"char*"char
specified mCount
in ++
may
illustrates sizeof, multiple; and
the size size size size
size size size size size
size be it+j--)
following ="
<<="<< =" ==" = = entity afor
m:nCount+t, the
=" =" type is
= " << "
" << " th e value
<<sizeof(long)
<< << <<<<<< calculating
in
assignmentsevaluated
sizeof("welcome") sizeof(tloat)
sizeof(1.35) sizeof(int)
sizeof(short) use name
sizeof(1.45L)
bytes\n'"; <<"
sizeof(double) sizeof(char*) sizeof(char) bytes. ofn n);
output of
isand
sizeof (e.g., the in
stored
<<" The int) for the
<<" <<" <<" on si ze
<<" <<" outcome or
Ioop value in
<< bytes\n' <<" th e of min.
bytes\n""; bytes\n"; an
bytes\n"; bytes\n"; any of
<«"bytes\n"; " bytesn";bytes\n"; expression
built-in (e.g.,
l00)
bytes\n"; is data Introduction
m
mistored
n. is
totally
types type,Iitem
or in Ctto
machine.
we
have

Com valu The int x int x= tobe


the lenc indit C+ 12) isSca
causes Common: int
declaration
to Block blockvalues. The int toprograms.
the in C++Introduction
12) C++ to
the x x different
beend
two = = local Scope
is
data it 2 and
Statements l; 10; also
to is declarations of
object refer vice th e We
to Resolution
of
contained blockS. a
int bloCk-structured
thatblock know
the versa.
declared
therein. to x block.
same
a = in
containing The that
different int 10; Blocks the of Operator
in Consider scope the
variablebloçk x secondrefer x
= same
1; in of
language.
data the
C++ block to the
1. two the variable
declaration.
object. in Note
Block e variable
an ardifferent following
can Blocks
outer often
Within that 2 not name
Block extends
block refer
nested.memory segment A
a variable can and
declaration
the 1 to be
For from scopes
inner and variable used
locations of
declared the
therefore, example, a can
block, program: point to
x have be
in declared
an containing inside of used
the the different
each its in
yariable inner following declaration a
constructing
in block
declaration the meanings
block different
x first is
wil style said till
hides 51
refer of is
x a
block.
form:
Introduction
to of delete untl
Following much when
way. free
inner
scope
following main existence
how andeasieras and
thethe known as
within variable. to
local
new
advance delete,
the
called block
again
declared
lm and
operators
in
from
:
takes
redeclared, inner "<<::m«"\n"'; also
better
remain
using
a block\n"'; "; in are
:operator
variable.
It
accessed of <<m<<"n' knowna they will
variable m
version global
l to unary
in by
local <<kk<"n":
<<'k="
cout delete) memory destroyed new
m nottwo store,
newhidden global Il Il inner with
be global is
(new, define free
cannot =" m= it the block
a introducing
auncover and
in block when the
Operators freeing
and
variable thelocal <<"'global
are m local supports
technique on new,a
<<'we inner memory inside
to <iostream.h>
include
# =30;
m
int
<<" 10 and using it
between
to ; access
M;
=30
m
local
= destroys
by used ame
=
cout coutcout in C++allocating
Management created
a int k
=20;
m m allocation
of problem
versionbe int k global
are=20 manipulate
needed. pointers)
by
difference ()main
allows
variable void we
created
object
explicitly
can 10;
:is of
thisThis operator =
global output dynamic
is task topic be
Memory space operators data
operator.
resolves:: illustratesmint can
the Gperators. delete
Syntax refer A
perform object
C, This use Inemory reauired.
52 In 12)We (ese(Also sing
An
to n

Operand: Just the


operators. (unsigned
As (char)(double)
122 (long)
3.214 (int)
3.14 any Syntax
e.g.operator. Ct+ 13) object.
Subsequently,
left
one illustreted value A statementsthedeclaration
object.
alreadyWhere e.g. sufficient
of Here,
of type Syntax:form:
Introduction
The C++ to
int(3.14) word, of permits the
the Type in
Type memory new
their short) sum/float
(i); :
type-name
other any average= cast *q=7.5;
*p=25; float int been ppointer_variable The
is
*p of
an by conversions: explicit
operator. *q= pointer_variable
memory newvoperator
a data-type =
is operand.
operators types. of =
pointers pointer
declared
alternate 3.14 the new p= space
same these new
(expression) neW to can
For
/ Il l I/ built-in type int; ofallocated.
I/ will float; and as may hold be
as examples, are givesconverts
convertsconverts type int is
notation This converts example: Simple conversion pointers used
(int) assign their ; be a a
pointer
unary
is types int data
any to
3.14 called as3 and
3.14
2 3.14 we 25 assignments of object
valid create
may (i.e., the an122 to Type type;
ofdata
unsigned to a to have of to appropriate isq type
explicit doublea to variables the a data of objects
take
be built-in
aConversion pointer
used char long an newly type
data-type.
seen type.
one int as
type shortwhose to to to so follows:types.
q= data-type of
in type or created of The any
give give
far new
whichoperand) give expressions type The
conversion. code 2.0 float
Alternatively,pointer-variable type.
identifiers 3L 3 can float. and new
int
the be : It
and is object returns
operator takes
brackets 122 converted Here,
using
Whenappear and the
can we p the
the and holds
allocates following
7.5 can address
appear tinside
he be (type-cast)
type to the
combine must q
type used the address of
aroundbrackets cast general
float have the
name as 53
to the
the type
is to
Introduction to Ct

54

conversions)
Implicit Conversions (automatic
We can mix data types in expressions
C++
e.g m =5 +2.75
are
is a valid statement. Wherever data types known
mixed
as
in an expression,
implicit or
automatic performs
conversions,
the
conversions automatically. This processis it divides the expressions into sub-
When the compiler encounters an expression, operands. For a binary
one or two
expressions consisting of one operator andconverts withoperator, if
using the rule that the "smaller" type is convertedtoone
the operands type differs, the compiler
of them to match
the
the"wider" type. For example i one other,
converted into a float
of the operand is an int and the other is a float the int
is
of different types are mixed in an
because a
loat is wider than an int. This happens when values
expression.
e.g. double d = 1; I/d receives 1.0
int i= 10.5; /ireceives 10
i=i+d; l/ means:i= int(double(i) + d)
In the last éxample, i + d involves mismatching types, so i is first converted to double
(promoted) and then added to d.The result is a double,which does not match the type of i
on the left side of the assignment, so it is converted to int (demoted) before being
assigned to i.
14) stream manipulation operators
For formatting the data display, manipulator operators are used. Normally used with (<<)
operator to modify or manipulate the way the data is displayed. These are present in
<iomanip.h>header file.
Some of the useful stream manipulators are:-

dec Sets base 10 integers.


endl Sends a new line character.,
ends Sends a null (end of string)
character.
flush Flushes an output stream.
hex Sets base 16 integers.
Oct
Sets base 8integers.
setw(int) Sets fild width.
e.g. cout <<"a='<<a<<endl;
Cout <<b'<<b<<endl;
Introduction to C++
55

Here endl is a stream manipulator, causing a linefeed to be inserted into stream. Thus
values of a and b are displayed on 2different lines.
IS lhe 3.6 COMMENTS in C++
Comments are important part of any program even though they are not mandatory to be
iven, Normally they are used to make program readable. The compiler
Suh. ments. so they do not add to the file size or execution time ignores
Orher,i, They can be specified in C++ using or /* */
the text to be commented */ is a single line comment.,
of executable program.

one
Se a
while // is used as a multiline comment.
e.g. #include<iostream.h>
an void main()

int a=10;
I/Following declaration willdisplay value of a on screen
cout<<a='<ka;
f; So in this program the text "Following declaration will display value of a on screen"
won't be compiled, so it will not be displayed on the screen.
Comments are useful to make program readable, if programming code is large enough.
3.7 SCOPE and VISIBILITY
The scope or visibility ofa variable determnines whether it can be accessed from other
functions in the same source file or in other source files. The position of an identifier
within a block is also a factor in determining scope. In others words it is that part of a
program over which the identifier can be seen by other identifiers and used by other
identifiers.

External variables, defined outside any block and memory for these is allocated once.
Even though the external variable is declared more than once, it only has
memory
allocated to it once. Variables can be declared as global variables, available to everything,
these are also known as external variables. External variables are defined outside of any
functions and retain their valuesduring the course of a program.
Static variables are variables that are local to a function but which (unlike auto
Variables) retain their values between invocations of the function - these are internal static
Variables. The second kind of static are external- or global variables that are local to a file
Dut not a part of any function. The main use of these is to bhide the variable so that other
SOUrCe code files don't see the variable. Static storage comes from a different memory
alocation it.is allocated from a static area of memory so static variables within
56 Introduction to
functions can retain their values between calls to the functions. Static variables can be
the first call.
amazed to some value other than 0 but will only beinitialized at
Automatic variable inside function doesn't exist until the function is called. At
time the memory for the automatic variable is allocated dynamically from a tha
stack and released when the function is finished. Auto variables are not initialized at memorstarty
up but each time they are called and do not retain their Values.

#inglude <iostream, h Global variables can


be referred
int Integer ;
anywhere
the code, within any
in
char aCharacter ;
char string [20]; Global variab les
function, whenever it ig
after its declaration.
unsigned int Nunber0fSons;
main 0 The scope of the local
variables is limited to
unsigned short Age; the code level in which
float ANumber, Another One; Local yariab les they are declared. If
cout « "Enter your they are declared at the
age:" beginning of afunction
cin >>> Age;
Instructions (like in main) its scope
is the whole main
function. This means
above, moreover than the function main() that if in the example
another
declared in main could not be used in the other function existed, the local variables
function and vice versa.
InC++, the scope of a local
is a group of variable is given by the block in which it is
declared (a block
declared within instructions grouped
a function it will be atogether within curly brackets () signs). If it is
loop its scope will be only the loop, etc...variable with function scope, if it is declared in a
In addition to local and
be visible not only in theglobal scopes exists the external scope, that
together with.
same source file but in all other causes a variable to
files which will be linked
Tobunduction to C++
57

1.Select the correct alternatives. QUESTIONS


a) C++ is a
msoytat b).
language
(procedural, object oriented, structured)
is a octal number
(076,23,0xAC)
c) is unary operator.
an (+,,t+)
re in d)_ is a keyword in C++.
yy (for ,int both)
e) The size of int is bits.
(2,6,16)
) char is data type
al (derived,built in,user defined)
to g). variables are automatic variables by default.
ch (static ,local global)
h)_ is ternary operator.
($, ?:, ’)
On
i) operator is used togive remainder after integer division.
(%,1,both)
is a bit wise operator
(&&, &,*&)
k). operator resolves ambiguity between local and global variables.
(-, ::, ?:)
I)_ is a stream manipulator
(for, while, setw)
Answer:
a) object oriented b) 076 c)++ d) both e)16 f) built in g) local h) ?:
i)% i)& k): 1) setw

2.Answer the following:


1. Explain the structure of simple C++t
2. Explain significance of comments in program.
C++.
3. What are different types of data types in
Ct+?
4. What are variables? Explain the difference between
declaration and initialization of
variable.
J. What is constant? Explain different types of
6. Explain different ules for a valid constants.
identifier.
I. What are manipulators? Explain different stream
manipulators in Ctt.
number
between incremental
++).]
the
ambiguity specified?
with
(++ *2
a=b!=j )
Explain * 2
postfix1): (number
number
++
!!
(p
operatsolveors? operator.
are
they with (++*++)
+
b)
to streams? Practice
ForPrograms
How variables product= a<=I==b,
++
v) !!
used postfix (number (a
d)
ternary C++? answers: +c!!la,
answer.
it
is and of2product product'=
ary,operator? with
binHow in prefix
dealing
comments
is;
product your b 2 program
yourc) is:"<<::a:
operators. iv) d)
justify1 c<b,(true),
unary. conversion. operators
between print is:productdeclarations: bc, v) declarationjustify following is:"<<a;
operator. [Hint:
incremental
prefix 1,
of and iv)
b=1,c=-1; c=-1 and &&
1 #include
<iostream.h>
a
bitwiseof resolution
significance
to value.
C++ 0.0 <= 1, 0.0 <b
c) of
incremental following
-
variables?
global
and difference
the a (true), a value
significance ii)
= b/c<i,iii) = following the
a of
conditional automatic
different incremental following2.5,j 1, q
following
1, b) cout<<"value
different in b= 2.5, of cout<<"now
scope aprogram ii) b, 1b) output void main() int
a=10;,
the =0, = 0, =0,= the&& 0, int
a=20;
13.
What
are Posttix
the i the i) p
is is Explain
Explain
Explain 14.
Explain
15.Expalin prefix a float
Evaluate
i)
a>b, thea float
i) Answers: a a) the
Evaluate
10.What int
Given int a) Answers:
11.What 1.Write Given 4.Write
58 8. 9. 12. and 2. 3.

You might also like