Exercise 1 (Fundamentals of Programming in C++) : Confidential JN2012 / SET A / TSE1034
Exercise 1 (Fundamentals of Programming in C++) : Confidential JN2012 / SET A / TSE1034
TOTAL MARKS
60
_________________________________________________________________________________ INSTRUCTION: ANSWER ALL QUESTIONS IN THIS QUESTION PAPER. a. Explain the following terms with an example: i. Local variable ii. Constant iii. Reserved Word iv. Comment (8 Marks)
b.
Indicate whether the name of these identifiers are valid or invalid i. Int ii. int iii. _Cu Ti iv. 18apr05 v. apr18_05 (5 Marks)
c.
Given the following entities: 1. 2. 3. 4. 5. 6. 7. 8. i. Age of a person Income of an employee The grade of student result The name of a country The true/false value of login validation The length and width of a rectangle The population of a city The car registration number.
ii.
Write the declaration statement for the entire variable answered in Question C(i). (16 Marks)
[1]
AIDAHANI
CONFIDENTIAL
d.
Write a C++ statement for the following situation: i. Declare myno as an integer. ii. Assign value 18 to myno. iii. Write a comment This program is my exercise 2 iv. A declaration of constant integer of CHA that holds value 13. v. Display the output as given: Welcome to C++ Programming Language vi. Display the name entered by user as sample output below: Login: NUR HADI NAQUIDDIN (15 Marks)
e.
The following C++ statement contains error, circle the error and correct it. i. cout<< THE VALUE IS << define; ii. cout << THEN WE NEED TO INSERT NEW VALUE; iii. cin << value; (3 Marks)
f.
Identify the output for the following code statement: i. cout<< I LIKE C++ VERY MUCH << \n THANK YOU ; ii. cout<< \n\n\t MY NAME IS AHMAD HAFEZUDDIN; (5 Marks) (TOTAL: 60 MARKS)
[2]
AIDAHANI