CBSE Coding Class 7 Solution – Hello World With Code
CBSE Coding Class 7 Solution Student Handbook Chapter 5 Hello World With Code all Questions and Answers Solution by Coding Teacher. Net Ex. Here provided all Coding Solution for Class 7.
1.) Low level languages are user friendly
Answer: False
Reason: Low level languages are computer user friendly , they are made to communicate with machine code.
2.) Which of the following is a valid data type?
Answer: All the above
Reason: String, float, integer are all valid data type.
3.) Which of the following is a valid arithmetic operation?
Answer: All the above
Reason: Addition, Modulus and Multiplication are all valid arithmetic operation.
4.) Which of the following is NOT a string type?
Answer: speed = 70
Reason: speed variable that contain value 70, which is an integer data type.
5.) In computer science, variables:
Answer: are placeholders for storing information
Reason: Variables are used to store information of different data types whether it being integer, float, string etc.
6.) Translator which is used to convert codes of assembly language into machine language is termed as
Answer: Assembler
Reason: Assembler is used to convert any low-level programming language i.e to convert from assembly code to machine code.
7.) Language in which single statements can be written to accomplish substantial tasks is termed as
Answer: High Level Language
Reason: High Level language is used to help humans communicate with the computer to perform specific tasks.
Standard Questions
1.) What are High Level and Low-Level Languages in Computers?
Answer: Programming languages are of two types, high-level languages and low-level languages. Both high-level and low-level languages have their own applications, so it is important to understand the difference between the two types of languages.
A low-level programming language is one that is made to be easily understood by the computer. It is very difficult to learn write understand and debug the program. Due to which it creates more chances of errors while writing programs. And the code could be very lengthy As well which makes them time consuming. They include machine code and assembly language.
A high-level programming language is made to help human programmers communicate easily to the computer. They are easy to learn understand and write debug programs. Programs are usually shorter than low level languages. Good examples of high-level programming languages include C, Java, Python. These languages are usually compiled or converted into low-level programming languages so that they can be executed directly.
2.) What is the Syntax to declare a String variable in Python?
Answer: An array of Character is called string which means it is a sequence of characters enclosed in either single or double or triple quotes. The characters can be alphabets of any language or symbols. Strings are also called str in short.
Example: Text = “This is a string variable.”
3.) What are different Mathematical Operations that we can perform on variables in Python?
Answer: You can do several Mathematical operations with floats and integers. Some common operations with floats and integers are:
- Addition
- Subtraction
- Multiplication
- Division
- Modulus
4.) Explain different data types used in Python with the help of its syntax
Answer: Below are some basic data types available in Python:
1.) Integer
2.) Floating-Point Number
3.) String
4.) Boolean
5.) Explain what are variables and why are they used in programming?
Answer: Variables are used to store information which contain values. Whenever a variable is created, Python assigns a spot to it so that its value can be stored till the program runs. We can store lots of different types of information in a variable like numbers characters etc. Variables are useful for several purposes like counting how many times an event occurs, saving inputs from users, and performing complex calculations.
For example: we can store a number, text, or a list of items. We can also change the value assigned to a variable while the program is running.
6.) Research and name five programming languages. Categorize them in the buckets of high-level programming language and low-level programming language
Answer:
High Level Languages are: |
Low level languages are: |
1. C++ |
1. Machine language. |
2.Python |
2. Assembly language. |
3.Java |
7.) Give one example where you can use mathematical operators in Python to build a program that will help you in day-to-day chores.
Answer: There are plenty of examples where we can use mathematical operations in day-to-day life to create a program and one of those examples is Calculator, we use calculator for many things while calculation something or making budgets for shopping etc.
Python program to create a calculator:
while True:
print(“Addition”)
print(“substraction”)
print(“Multiplication”)
print(“Division”)
print(“Enter q or Q to exit”)
choice = input(“Enter your choice: “)
if choice == “q” or choice == “Q”:
break
num1 = float(input(“Enter number 1: “))
num2 = float(input(“Enter number 2: “))
if choice == “1”:
result = num1 + num2
print(“Sum of “,num1,”+”,num2,”is = “,result)
elif choice == “2”:
result = num1 – num2
print(“Substraction of “,num1,”-“,num2,”is = “,result)
elif choice == “3”:
result = num1 * num2
print(“Multiplication of “,num1,”*”,num2,”is = “,result)
elif choice == “4”:
if num2 == 0:
print(“Number can not be divided by zero”)
else:
result = num1 / num2
print(“Division of “,num1,”/”,num2,”is = “,result)
else:
print(“please select a valid choice”)
Higher Order Thinking Skills (HOTS)
1.) Draw a flowchart to explain the flow of selection sort technique in programming.
Answer:
Flow Chart Class 72.) Write an algorithm to sort the below list in descending order using Selection Sort Technique:
A = [10, 21, 45, 67, 12]
Answer: Steps to sort an algorithm in descending order using Selection Sort Technique:
Step 1: Create a variable Max and Set Max to location 0 i.e. Max = A [0] Step 2: Search the maximum element in the list
Step 3: Swap with value at location Max
Step 4: Increment Max to point to next element Step 5: Repeat until list is sorted in descending order
Working of Selection Sort:
1.) Set the first element of the array as Maximum.
10 |
21 | 45 | 67 |
12 |
2.) Now we have to Compare maximum number in the array with the second element. Check If the second element is bigger than maximum, if true then swap both elements and assign the second element as maximum.
21 |
10 | 45 | 67 |
12 |
Same with third element, the process goes on until the last element. And Compare maximum with the remaining elements
45 |
10 | 21 | 67 |
12 |
3.) After each iteration, maximum element is placed in front of the array. Swap the first element with maximum.
4.) For every iteration, indexing of array starts from the first element. We have to repeat Step 1 to 3 until all the elements are placed at their correct positions in the descending order.
67 |
45 | 21 | 12 |
10 |
Applied Project
Create a program in Arcade to perform Modulus operation on two variables
Answer: