Top Banner
12

· PDF fileheight , main , rollno-5 , my address , 2day , class 3. What is the difference between ‘5’ , ... Downloaded from . TOPIC: DATA HANDLING

Mar 24, 2018

Download

Documents

dangtram
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1:   · PDF fileheight , main , rollno-5 , my address , 2day , class 3. What is the difference between ‘5’ , ... Downloaded from  . TOPIC: DATA HANDLING
Page 2:   · PDF fileheight , main , rollno-5 , my address , 2day , class 3. What is the difference between ‘5’ , ... Downloaded from  . TOPIC: DATA HANDLING
Page 3:   · PDF fileheight , main , rollno-5 , my address , 2day , class 3. What is the difference between ‘5’ , ... Downloaded from  . TOPIC: DATA HANDLING
Page 4:   · PDF fileheight , main , rollno-5 , my address , 2day , class 3. What is the difference between ‘5’ , ... Downloaded from  . TOPIC: DATA HANDLING
Page 5:   · PDF fileheight , main , rollno-5 , my address , 2day , class 3. What is the difference between ‘5’ , ... Downloaded from  . TOPIC: DATA HANDLING
Page 6:   · PDF fileheight , main , rollno-5 , my address , 2day , class 3. What is the difference between ‘5’ , ... Downloaded from  . TOPIC: DATA HANDLING
Page 7:   · PDF fileheight , main , rollno-5 , my address , 2day , class 3. What is the difference between ‘5’ , ... Downloaded from  . TOPIC: DATA HANDLING
Page 8:   · PDF fileheight , main , rollno-5 , my address , 2day , class 3. What is the difference between ‘5’ , ... Downloaded from  . TOPIC: DATA HANDLING

Page 1 of 1

TOPIC: GETTING STARTED WITH C++

1. What are keywords in C++? Give two examples.

2. What are the rules to be followed while naming an identifier?

3. What is a variable? How many values are associated with it?

4. List the three types of integer constants supported by C++.

5. What is the difference between ‘B’ and “B” in C++?

6. What are Escape sequences? Give two examples.

7. What are floating point constants?

8. What do you mean by ‘code generation’?

9. Classify the following into valid and invalid identifiers: i) Mybook ii) _DK iii) Break iv) new

10. What is the purpose of comment and indentation in a program? In how many

ways comments can be given in C++? Explain.

11. What are literals? How many types of literals are available in C++?

12. Explain:-

i) Syntax Error ii) Logical Error iii) Semantic Error iv) Run time Error

13. Find out the errors, if any, in the following C++ statements:

i) cout<< “c=” c ; ii) cin>> “\n” >> y ; iii) cin>> y ; >> j

iv) cout>> “\n abc” ; v) x = y + z ;

14. Why it is important to include iostream.h in every C++ program?

15. What are the predefined stream objects in I/O library?

Downloaded from www.studiestoday.com

Downloaded from www.studiestoday.com

Page 9:   · PDF fileheight , main , rollno-5 , my address , 2day , class 3. What is the difference between ‘5’ , ... Downloaded from  . TOPIC: DATA HANDLING

Assignment # 1

Chapter 7:Getting Started with C++

1. What are literals ? Explain the different types of literals being used in C++.

2. Which of the following are valid/ invalid operands :

height , main , rollno-5 , my address , 2day , class

3. What is the difference between ‘5’ , 5 and “ 5” ?

4. Identify the errors in the following program :

void main()

{

int x

charendl;

x=3;

cin>>endl;

cout<<x<<3

}

5. Explain the two different ways to give comments in C++.

6. Differentiate between ‘<<’ and ‘>>’ operators.

7. ‘Every C++ program must have a main().’ Why ?

8. What will be the output of the following code :

(i) cout<<” #\n**\n###\n****\n “;

(ii) char a= ‘@’;

cout<< a;

cout<<’a’;

PROGRAMS

( to be done in the lab during practical periods )

1. To create a formatted output screen as given in the lab.

2. Write a C++ program that accepts marks and displays the percentage.Assume maximum marks is

50.

3. Write a program that accepts the temperature in percentage and displays in Fahrenheit

4. Write a program that accepts length , breadth and then displays the area and perimeter of a

rectangle.

Note :

1. All programs must have a comment entry on the top indicating what exactly the program is

about.

2. Proper messages should be given for input and output operations.

3. All programs should be properly indented.

Downloaded from www.studiestoday.com

Downloaded from www.studiestoday.com

Page 10:   · PDF fileheight , main , rollno-5 , my address , 2day , class 3. What is the difference between ‘5’ , ... Downloaded from  . TOPIC: DATA HANDLING

TOPIC: DATA HANDLING

1. Why is char often treated as integer data type?

2. What are advantages and disadvantages of floating point numbers over integer?

3. What is a reference variable? What is its usage?

4. How is structure different from an array?

5. How is structure different from a class?

6. What is a variable? How many values are associated with it?

7. In how many ways a variable can be declared in C++?

8. Explain the difference among 0,„0‟, „\0‟, “0”.

9. What is the impact of access modifier const over a variable?

Downloaded from www.studiestoday.com

Downloaded from www.studiestoday.com

Page 11:   · PDF fileheight , main , rollno-5 , my address , 2day , class 3. What is the difference between ‘5’ , ... Downloaded from  . TOPIC: DATA HANDLING

ISM/CLASS-11/COMPUTER SCIENCE/APRIL-2016 Page 1 of 1

TOPIC: OPERATOR & EXPRESSIONS: CONDITIONAL OPERATOR

1. Write a program to input a number. If it is even, double and print the number otherwise

print its half.

2. Write a program to input a character. Print whether it is an alphabet or not using

conditional operator.

3. Write a program to input co-efficients of a, b and c of a quadratic equation

ax2 + bx + c = 0 ,where a = 0. Discriminant, D = b

2- 4ac.If discriminant is 0 then print

there is exactly one real root, if discriminant is positive then print there are two distinct

roots, if discriminant is negative then print then there are no real roots.

4. Write a program to input income of a person. Calculate tax using following criteria. If

income is more than 20000, tax is 15%. Else if income is in the range 5000-20000, tax is

10%. If income is less than 5000, tax is nil.

5. Write program to input three numbers. Print the largest of the three.

Downloaded from www.studiestoday.com

Downloaded from www.studiestoday.com

Page 12:   · PDF fileheight , main , rollno-5 , my address , 2day , class 3. What is the difference between ‘5’ , ... Downloaded from  . TOPIC: DATA HANDLING

TOPIC: OPERATORS AND EXPRESSIONS

1. What will be the output of the following code?

(i) int ch = 20 (ii) int ch = 20

cout<<++ch << “\n”<< ch<< “\n” ; cout<< ch+1<< “\n”<< ch<< “\n” ; 2. What will be the result of the following two expressions if i =15 initially?

(i) ++i <= 15 (ii) i++ <= 15

3. Write the corresponding C++ expressions for the following mathematical expressions. (i) e x-x (ii) (R+S)4 (iii) 2-4y*(p + q)2 (iv) (A+B)2 + (C+D)4

4. Given the value of a, b and c evaluate the following expression

a = 10, b = 5, c = 11

(a >= b) || (!c == b) && (c < a)

5. Determine the output of the following code segment: a = 2; b = ++a cout<< a; cout<< b; cout<< a++; cout<< ++a; 6. What is the difference between num = 10 and num= =10 ? 7. What is the output of the following statement? Int i = 20 cout<< I << i++ << ++i ;

Downloaded from www.studiestoday.com

Downloaded from www.studiestoday.com