SHORT QUESTIONS-DH

Q1. What is the difference between fundamental data types and derived types? Explain with example.

Q2. Explain fundamental data types and their purpose.

Q3. What main integer types are offered by C++?

Q4. When are unsigned integers preferred over signed integers? What is the advantage of unsigned integers over signed integers?

Q5. Explain floating point types offered by C++ along with the minimal ranges and digit of precision they support.

Q6. Explain the concept of a pointer and its purpose.

Q7. What is the significance of a reference variable? Explain with example.

Q8. Explain with example the concept of constant variable.

Q9. Write declaration for a class that holds properties of a branch. The class holds information like branch-number, area, number of employees, head and the operations associated like branch report printing, branch data modification, pending work reporting, forecast reporting.

Q10. Write declaration for a structure that holds same information as that of the class mentioned in question 9.

Q11. Write declaration for a structure that holds information of a student like roll no, name, class, marks and grade.

Q12. Write declaration for a class that holds the information of Q11. For associated operations, make suitable assumptions.

Q13. Explain the function and usage of a union giving an example.

Q14. Why are so many data types provided in C++?

Q15. Explain the function and usage of variables with example.

Q16. How many ways can a variable be initialized into? Give examples for each types of initialization.

Q17. Explain the impact of access modifier const over variables. Support your answer with examples.

Q18. “Comments are useful and easy way to enhance readability and understand-ability of a program.” Elaborate with examples.

Q19. Write a short program that asks for your height in centimeters and then converts your heights to feet and inches. (1 foot = 12 inches, 1 inch = 2.54 cm).

Q20. An electricity board charges according to following rates:
For the first 100 units – 40 P per unit  (P-Paise)

For the next 200 units – 50 P per unit

Beyond 300 units – 60 P per unit.

All users are charged meter charge also which is R50/-.

Write a program to read the names of users and number of units consumed, and print out the charges with names.

Q21. Write a program to read a number n and print n2, n3, n4 and n5.

Q22. Write a program to find area of a triangle.

Q23. Write a program to find whether a given number is even or odd.

Q24. Write a program to accept three digits (that is, 0-9) and print all possible combinations from these digits. (For example, if the three digits are 1, 2 and 3 then all possible combinations are 123, 132, 231, 213, 312 and 321).

Q25. Write a program to convert given inches into its equivalent yards, feet and inches.

(1 yard = 36 inches, 1 foot = 12 inches)

Q26. Write a program to read two numbers and print their quotient and remainder.

Q27. Write a program to compute simple interest and compound interest.

Q28. Write a program to

(Hint: Store escape sequence for backspace in an integer variable).

 

%d bloggers like this: