Chapter 1 Variables in Real Life
Chapter 1 Variables in Real Life
Answer: Initialization
Answer: 2bad
Reason: Variable names cannot start with an integer, because it can cause some problems in the program.
https://www.netexplanations.com/cbse-coding-class-7-solution-student-handbook-chapter-1-ethical-practices-in-coding/ 1/6
08/09/2024, 23:06 CBSE Coding Class 7 Solution Student Handbook Chapter 1 Variables in Real Life
statement?
variable = expression;
Answer: An expression is a combination of literals, operators, variables, and parentheses used to calculate a value.
Reason: An expression is a combination of values, variables, operators, and calls to functions. Expressions need to be
evaluated.
(2 – 6) / 2 + 9
Answer: 7
Reason: First we solve the brackets and then divide it by 2 and then add
9 and result is 7.
Standard Questions
Answer: The process of assigning values in a variable at the time of declaration is called variable initialization. =
symbol is used to initialize a variable. A single variable name must appear on the left side of the = symbol. All
variables should be initialized to avoid any problem.
https://www.netexplanations.com/cbse-coding-class-7-solution-student-handbook-chapter-1-ethical-practices-in-coding/ 2/6
08/09/2024, 23:06 CBSE Coding Class 7 Solution Student Handbook Chapter 1 Variables in Real Life
A = 34
B = “hello”
Here A is the variable name and 34 is the value assigned to that variable.
Answer: Whenever we create a variable in with a specific data type we expect user to input a certain value in the data
type but sometimes it could throw some error if the user enters a value of different data type and to avoid any error
during program execution, we need to validate user input first.
4.) What are your opinions on naming convention of variables declared in programming? Write down five best
practices that you think one should follow while declaring variables.
Answer: Naming conventions of variables are really important because while naming conventions provide us a set of
rules for choosing a sequence of characters to identify variables. It helps us improve the clarity of the code and it
looks more systematic.
Both uppercase and lowercase letters can be used for naming variables.
Answer:
https://www.netexplanations.com/cbse-coding-class-7-solution-student-handbook-chapter-1-ethical-practices-in-coding/ 3/6
08/09/2024, 23:06 CBSE Coding Class 7 Solution Student Handbook Chapter 1 Variables in Real Life
2.) Write a program to count the occurrence of the letter “a” in string “We are a family”.
Answer:
https://www.netexplanations.com/cbse-coding-class-7-solution-student-handbook-chapter-1-ethical-practices-in-coding/ 4/6
08/09/2024, 23:06 CBSE Coding Class 7 Solution Student Handbook Chapter 1 Variables in Real Life
Applied Project
https://www.netexplanations.com/cbse-coding-class-7-solution-student-handbook-chapter-1-ethical-practices-in-coding/ 5/6