In: Computer Science
1- The best choice for a data type used to store the grade to be
recorded at the end of the term for this course would be a(n)
____________. Valid values would be A, B, C, D, or F, no A- or B+
would be permitted, instead a single value will be stored.
2-
The best choice for a data type used to store the name of the city
where you currently live would be in a(n) [a].
3-The best choice for a data type used to store the cost of a pair
of shoes would be in a(n) ____________. Hint: For your answer enter
the default data type.
4-________ would be stored in x after the following statement
(x++), assuming there was a compile time initialization of x
defined as int x = 15;
5-If you had three integers defined, x, y and answer, an assignment
statement to add the two value together would look like:
____________.
6- The best choice for a data type used to store a counter for the
number of courses that you are currently enrolled is a(n)
____________.
Assuming the program language considered here is C++ or Java
Answers for all the questions are same in C++ and Java except for Question # 2
================================================================================
1. char (char always store a single letter or character)
============================================
In C++
2. string or char[] ( we can either use string or char
array)
In Java
Its String
============================================
3. float (cost can be integer or float hence using
float)
============================================
4. x will be 16 (after x++ value will be incremented by
1)
============================================
5. int sum = x+y; ( here we create a varaible of type int and
store the sum of x an y to it)
============================================
6. int (we count things in integer, so the data type should be
an int type)
============================================
thank You !