Computer Science, asked by mamtakumariraj, 6 months ago

write five valid variable names to store students marks.

Please give right answer
Give the answer if you know​

Answers

Answered by nitinkumars74
3

Answer:A variable is a symbolic name for (or reference to) information. The variable's name represents what information the variable contains. They are called variables because the represented information can change but the operations on the variable remain the same. In general, a program should be written with "Symbolic" notation, such that a statement is always true symbolically. For example if I want to know the average of two grades, We can write "average = (grade_1 + grade_2) / 2.0;" and the variable average will then contain the average grade regardless of the scores stored in the variables, grade_1 and grade_2

Explanation:Variables in a computer program are analogous to "Buckets" or "Envelopes" where information can be maintained and referenced. On the outside of the bucket is a name. When referring to the bucket, we use the name of the bucket, not the data stored in the bucket.

Variables are "Symbolic Names". This means the variable "stands in" for any possible values. This is similar to mathematics, where it is always true that if given two positive numbers (lets use the symbols 'a' and 'b' to represent them):

a + b > a

(i.e., if you add any two numbers, the sum is greater than one of the numbers by itself).

This is called Symbolic Expression, again meaning, when any possible (valid) values are used in place of the variables, the expression is still true.

Another example, if we want to find the sum of ANY TWO NUMBERS we can write:

result = a + b;

Both 'a' and 'b' are variables. They are symbolic representations of any numbers. For example, the variable 'a' could contain the number 5 and the variable 'b' could contain the number 10. During execution of the program, the statement "a + b" is replaced by the Actual Values "5 + 10" and the result becomes 15. The beauty (and responsibility) of variables is that the symbolic operation should be true for any values.

Another example, if we want to find out how many centimeters tall a person is, we could use the following formula: height in centimeters = height in inches * 2.54.

This formula is always true. It doesn't matter if its Joe's height in inches or Jane's height in inches. The formula works regardless. In computer terminology we would use:

         

         

height_in_centimeters = height_in_inches * 2.54;  

 

% the variable height_in_centimeters is assigned a  

% new value based on the current value of "height_in_inches"  

% multiplied by 2.54  

       

     

Variable actions

There are only a few things you can do with a variable:

Create one (with a nice name). A variable should be named to represent all possible values that it might contain. Some examples are: midterm_score, midterm_scores, data_points, course_name, etc.

Put some information into it (destroying whatever was there before).

We "put" information into a variable using the assignment operator, e.g., midterm_score = 93;

Get a copy of the information out of it (leaving a copy inside)

We "get" the information out by simply writing the name of the variable, the computer does the rest for us, e.g., average = (grade_1 + grade_2) / 2.

Similar questions