0% found this document useful (0 votes)
28 views

Exercise 1 (Fundamentals of Programming in C++) : Confidential JN2012 / SET A / TSE1034

This document contains an exercise on fundamentals of programming in C++ with 6 questions and various sub-questions. It tests understanding of concepts like local variables, constants, reserved words, comments [Question A]; valid and invalid identifiers [Question B]; defining identifiers to represent various entities [Question C]; writing declaration statements [Question Cii]; writing C++ statements for tasks like declaring variables, assigning values, comments, output [Question D]; identifying and correcting errors in C++ statements [Question E]; and identifying the output of code statements [Question F]. The document provides instructions to answer all questions and the total marks for the exercise is 60.
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views

Exercise 1 (Fundamentals of Programming in C++) : Confidential JN2012 / SET A / TSE1034

This document contains an exercise on fundamentals of programming in C++ with 6 questions and various sub-questions. It tests understanding of concepts like local variables, constants, reserved words, comments [Question A]; valid and invalid identifiers [Question B]; defining identifiers to represent various entities [Question C]; writing declaration statements [Question Cii]; writing C++ statements for tasks like declaring variables, assigning values, comments, output [Question D]; identifying and correcting errors in C++ statements [Question E]; and identifying the output of code statements [Question F]. The document provides instructions to answer all questions and the total marks for the exercise is 60.
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

CONFIDENTIAL

JN2012 / SET A / TSE1034

EXERCISE 1 [Fundamentals of Programming in C++]


NAME CLASS/ SECTION LECTURER DATE : ______________________________________ : ______________________________________ : ______________________________________ : ______________________________________

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.

Define identifiers to represent the entities. (8 Marks)

ii.

Write the declaration statement for the entire variable answered in Question C(i). (16 Marks)

KOLEJ POLY- TECH MARA BATU PAHAT

[1]

AIDAHANI

CONFIDENTIAL

JN2012 / SET A / TSE1034

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)

KOLEJ POLY- TECH MARA BATU PAHAT

[2]

AIDAHANI

You might also like