Вы находитесь на странице: 1из 4

WORKSHEET FOR 11th STANDARD COMPUTER SCIENCE

Chapter 8- Operators And Expressions

1.What is the function of increment /decrement operators? How many varieties do they come in?
How are these two varieties different from one another?

2.What are arithmetic operators in C++?Distinguish between unary & binary arithmetic operators.

3.How are relational operators and logical operators related to one another?

4.What are unary ,binary and ternary operators? Classify the operators you have so far into these three
categories.

5.What will be the result of following 2 expressions if i=10 initially? i) ++i <= 10 ii) i++ <=10

6.Write arithmetic type conversion rules for float types and int types.

7.Write the C++ equivalent expressions for the following:

a. volume=3.1459 r2 h/3 b. Fn=0.5 if x=30 c. fn =0.9 if x=60

8.Discuss the role and importance of C++ shorthand’s. Do you see any benefit from them?

9.What role do the relational operators play? How is relational operators ++ different from=?

10.Give the following set of identifiers


char ch;
short sh;
int intval;
Long longval;
float fl;
Identify the data types of following expressions :
a) ‘a’-3 b) intval *longval-ch c) fl+longval/sh
11.Discuss the function of conditional operators, sizeof operators and comma operators with
examples.
12.What is the function of type conversion ? Write the standard conversion rules of C++.
13.Write a C++ program to input a number. If the number n is odd and positive ,print its square root
otherwise print n5?
14.Write a C++ program to input three integers and print the largest of three.
15.Evaluate a += a + ++a if a=20 initially
16. Discus the function of conditional operators, sizeof operator & comma operators with examples
17.The value of e is known to be 2.71828 Using this value ,write a program to determine the value of
the expressions 2-ye 2y+ 4 y, obtain value of y from user.
18.Write a C++ program to input a number .if the number is even ,print its square otherwise print its
cube.
19.Write a C++ program to input choice(1 or 2)
If choice is 1,print the area of circle otherwise print the perimeter of circle. Accept the radius of circle
from user.
20.Write a program that reads in a character<char>from the keyboard and then displays one of the
following messages:
i) if<char> is a lower case letter ,the message “the upper case character corresponding to <char> is
…”.
ii) if<char> is a upper case letter ,the message “the lower case character corresponding to <char> is
…”.
iii) if <char> is not a letter ,the message <char> is not a letter”.
Hint: You will need to refer to a table of ASCII characters. Lowercase letters have ASCII value
range 97-122.Uppercase letter have ASCII value range 65-90.
21. What types of expressions can be formed in C++?Discuss each one of them with examples.
Chapter 9- C++ as per latest C++11 Standard
1.List all fundamental data types as per C++11.
2.What are the size modifiers available for numeric data types as per C++11?
3.What are widths offered by different data types of C++11 standard?
Chapter 10-Flow of Control
1.Convert the following if else to a single conditional statement:
If(qty >=20)
order =max+5;
else
order =max;
2.What is the output of the program segment below?
int num=3
switch(num)
{
case 1:
case 2:
case 3:cout<<”was 1 to 3\n”;
case 4:cout<<”was 4\n”;
default :cout<<”unknown”; }
2.What will be the output of following code fragment if the input is:
i.a ii.c iii.d iv.h v.b ?
:
cin>>ch;
switch(ch) { case ‘a’:cout <<”It is a.\n”;
case ‘b’:cout<<”It is b.\n”;
case ‘c’ :cout<<”It is c.\n”;
break;
case ‘d’:cout<<”It is d.\n”;
break;
default:cout<<”Not a,b,c,d.”
}
:
3.Write a C++ program that prints 1 2 4 8 16 32 64 128.
4. Rewrite the following statement using if else: n=((a<b)? a:b);
5.What is the output of the program segment below?
int x=0;
if(x =1)
cout<<”Was equal”;
else
cout<<”Not equal”;
cout<<”***”;
6.What is the output of the program segment below?
int x=3;
if(x<=3)
if(x<3)
cout<<”Less than”;
else
cout<<”Greater than”;
cout<<”Done”;
7.What is the problem of dangling else? When does it arise? What is the default dangling else
matching and how it can be overridden?
8.Compare an if and a ?: operator.
9.write a C++ program to print Fibonacci series i.e. 0,1,1,2,3,5,8……
10.Write the syntax and purpose of a switch statement.
11.Write a C++ program to print table of a given number.
12.Rewrite the following code fragments using switch:
if(ch== ‘E’)
eastern++;
if(ch ==’W’)
western++;
if(ch==’N’)
northern++;
if(ch==’S’)
southern;
else
unknown++;
13.Write a C++ program to find out whether a year (entered in 4 digit number representing it is a leap
year.

Вам также может понравиться