1. Evaluate the following expressions
a. x – y < z &&
y + z > x || x-z <= y – x + z
i.
If x=4,y=7 and z=10
ii.
If x=3, y=8 and z=-5
iii.
If x=-5, y=1 and z=3
b. (y) && (y-z) || !(2y+z-x)
i.
If x=13,y=14 and z=5
ii.
If x=10, y=5 and z=5
iii.
If x=5,y=6 and z=9
2. Determine the values of the following C++ expressions when a,
b, c are integers and d, f are floating point numbers. The values of a=5,b=3
and d=1.5
i.
f= a + b/a
ii.
c= d * a + b
iii.
c= (a++) *d +a
iv.
f= (++b)*b – a
v.
c= a - (b++)*(- - a)
3. Suppose a, b, c are integers and a=3, b=6, c=-5 and x, y, z
are floating point variables where x=8.8, y=3.5, z=-5.2
Determine the value of the following expressions.
i.
a % c
ii.
a*b/c
iii.
(a*c)%b
iv.
x/y
v.
x/(x + y)
vi.
int (x) % int (y)
4. Wap to input a number. If the number is even then print its
square otherwise print its cube. (do it using conditional operator)
5. Wap to input a number. If the number is even and positive
then print its square root otherwise print its cube.
6. Wap to enter any two numbers from the user other then zero
and also any arithmetic operator (+, - , *, /). Then it should produce the
arithmetic operation between the two numbers and finally displays the result.
7. Wap to enter any year from the keyboard and display weather
it is a leap year or non- leap year..
8. Find the output of the question numbers 11 and 12 of chapter
no.10 page no.266 and 267 of Sumita Arora book .
belated happy dussehra puja sir
ReplyDeleteTHANK YOU AND SAME TO YOU...
ReplyDeleteques no 5,6 and7 also using conditional operator or another method?
ReplyDeletequestion 5 can be done using conditonal operator but 6,7 can't try using nested if else/ if- else - if ladder.
ReplyDelete