Lab Exercise 2 - Copy
Post on 12-Oct-2015
Embed Size (px)
Lab Exercise 2 VARIABLES AND CONSTANTS
1. Name the best data type for the following variables: ( integer, float, char, string )
a) Area of a circle in square inches b) Number of cars passing by c) CGPA d) Age e) Salary f) Student Name g) Body Weight h) Height i) Distance j) Number of Cars k) Car Plate Number l) Book Price m) Dividend Calculation n) Grade ( A, B, C, D )
2. Which variables below are syntactically correct? ( cannot start with no, cannot be keyword, cannot contain other than digit, alphabet and underscore )
a) income b) 1time c) intToms d) Two fold e) c3po f) income#1 g) item
3. Which of the following is not a datatype in C.
A. bool B. char C. float D. double 4. What happen when you declare a variable?
A. The variable can no longer be used. B. The data type can no longer be used. C. The variable MUST be used in the program. D. Memory is reserved for that variable.
5. What happen when you initialize a variable?
A. You make it constant for the first time. B. The value is printed for the first time. C. You give it a value for the first time. D. You give it a value for the last time.