SOLVED QUESTIONS-DH

Q1. What are data types? What are all predefined data types in C++?

Q2. Generally there are said to be four integer types, each of which can be signed or unsigned. Write named of all four integer data types.

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

Q4. What are the advantages and disadvantages of floating-point numbers over integers?

Q5. What are data type modifiers? How do they affect a base data type?

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

 Q7. Write definition for a class employee that can hold information like employee no, name, design, dept, basic salary and have associated for printing payslips, modifying as employee’s details, printing an employee’s work report.

Q8. How is structure different from an array?

Q9. How is a structure different from a class?

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

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

Q12. Consider the following two C++ statements. Are they equivalent?

              char grade = 65;

               char grade = ‘A’;

Q13.  What is the difference between 25L and 25?

Q14. Write a C++ program to compute the area of a square. Make assumption on your own.

Q15. What type of variable declaration the following program is using?

              :

              :

int main()

{

       int area, length=10,width=12,perimeter;

       area=length*width;

       perimeter=2*(length+width);

       :

       :

}

Q16. Modify the last program to have dynamic initialization for variables area and perimeter.

Q17. Write a C++ program to convert a given number of days into years, weeks and days.

Q18. Identify the errors in the following code segment:

              :

int main()

{

       cout<<”Enter two numbers: “;

       cin>>num>>auto;

       float area=length*breath;

}

Q19. Write a C++ program that accepts a character between A to J and prints next 4 characters.

Q20. An unsigned int can be twice as large as the signed int.  Explain how.

 

 

 

 

%d bloggers like this: