MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

MACHINE LEARNING

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
A variable in a program holds the current score of a game. Which of the following is the most appropriate data type for the variable?
A
Boolean
B
String
C
Float
D
Integer
Explanation: 

Detailed explanation-1: -Integer and String are two very common data types. This would create a variable called score. The computer would now know that whole numbers (integers) can be stored within the score variable.

Detailed explanation-2: -Answer: A letter grade on an exam: we will use char data type since letter grape will be alphabets and character data type is the best option here. C) The average marks of your class: we will use here double data type since average marks can be in decimal and can long depend on the total marks and number of students.

Detailed explanation-3: -String (str or text) It is a sequence of characters and the most commonly used data type to store text.

Detailed explanation-4: -’ Global variables are declared by starting the variable name with the dollar sign ( $ ). These variables are available throughout your entire app, overriding all scope boundaries.

There is 1 question to complete.