FUNDAMENTALS OF COMPUTER

COMPUTER PROGRAMMING FUNDAMENTALS

WHAT IS PROGRAMMING

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
In order to store True or False values we can use a
A
Integer variable
B
Boolean variable
C
Date variable
D
None of the above
Explanation: 

Detailed explanation-1: -In general, a Boolean variable can have only two values-True or False. Or in other words, if a variable can have only these two values, we say that it’s a Boolean variable. It’s often used to represent the Truth value of any given expression. Numerically, True is equal to 1 and False is equal to 0.

Detailed explanation-2: -The BOOLEAN data type stores TRUE or FALSE data values as a single byte. The following table shows internal and literal representations of the BOOLEAN data type. You can compare two BOOLEAN values to test for equality or inequality. You can also compare a BOOLEAN value to the Boolean literals ‘ t ‘ and ‘ f ‘.

Detailed explanation-3: -A variable of the primitive data type boolean can have two values: true and false (Boolean literals). or off. Boolean expressions use relational and logical operators. The result of a Boolean expression is either true or false.

Detailed explanation-4: -Boolean values are not actually stored in Boolean variables as the words “true” or “false”. Instead, they are stored as integers: true becomes the integer 1, and false becomes the integer 0. Similarly, when Boolean values are evaluated, they don’t actually evaluate to “true” or “false”.

Detailed explanation-5: -Boolean variables are displayed as either True or False. Like C, when other numeric data types are converted to Boolean values then a 0 becomes False and any other values become True. When Boolean values are converted to other data types, False becomes 0 while True becomes –1.

There is 1 question to complete.