Q1. What are the main types of C++ data types? Write data types of each type.
Q2. What do you mean by fundamental data types? How many fundamental data types does C++ provide?
Q3. The data type char is used to represent characters. Then why is it often termed as an integer type?
Q4. How are the following statements in the same set different?
i. char pcode = 75;
char pcode = ‘K’;
ii. char pcode = 75;
short pcode = 75;
iii. const int a = 5;
const a =5;
Q5. If value is an identifier of int type and is holding value 200, is the following statement correct?
char code = value;
Q6. What are the advantages of floating-point numbers over integers?
Q7. How many ways can a floating-point be written into?
Q8. Write 147.9205 into exponent form and 2.4901E04 into fractional form.
Q9. Suppose value is an identifier of int type having value 25. After the statement
float chks = value;
what does the variable chks store?
Q10. Why is float type preferred for real quantities? When should the type double be preferred over the shorter type float?
Q11. The data type double is another floating-point type. Then why is it treated as a distinct data type?
Q12. “The floating-point numbers should always be stored in the largest type long double because it saves us form the headache of consulting the minimal ranges these data types support.” Comment upon this statement.
Q13. What is the use of void data type?
Q14. Why does C++ have type modifiers?
Q15. What is wrong with the following C++ statement:
long float x; ?
Q16. Using a 7-byte unit, how many different values can be represented?
Q17. On a machine, short integer is 2 bytes long. What can be the possible size for int integer, short integer and long integer on the same machine, keeping in mind C++ standard?
Q18. If short integer on a machine is 4 bytes long, what will be the size of unsigned short and signed short on the same machine?
Q19. What are the variations in char type? How are the variations of char type different from one another?
Q20. What are the variations in floating-point type? How are the variations of floating-point types different from one another?
Q21. Arrange the following data types from smallest to largest:
float, char, double, long double, long, short, int.
Q22. Explain the difference among 0, ‘0’, ‘\0’ and “0”.
Q23. What is the distinction between 33L and 33?
Q24. Write the statements you would use in C++ to find out which character the code 86 represents.
Q25. What do you understand by the following:
Q26. What is a reference variable? How is it defined in C++?
Q27. What is wrong with the following statement?
const int y;
Q28. What do you understand by a class in C++? What does a structure represent in C++?
Q29. What are the similarities and differences between an array and a structure?
Q30. What are the similarities and differences between an class and a structure?
Q31. Given the following definitions:
int inal = 1024;
char ch = 70;
int i = ‘a’;
const int ic =i;
Which of the following statements are illegal? Why?
- i = ic;
- ic = i;
- ch = i;
- i = ch;
- ch = ival;
- ch = ‘10’;
Q32. Find errors, if any, in the following C++ statements:
Q33. What are derived data types? Name the user defined data types in C++?
Q34. What is a variable? In C++, two values are associated with a symbolic variable. What are these?
Q35. Why is a variable called symbolic variable?
Q36. Write declarations for
Q37. Define the following:
Q38. What do you mean by dynamic initialization of a variable? Give an example.
Q39. What is the impact of access modifier const over a variable?