1-Chapter 5 Advanced Programming
1-Chapter 5 Advanced Programming
b. C++ d. Java
a. C c. Visual basic
4. The language best suited for GUIs and web-based gaming is?
b. C d. None of them
a. + c. *
b. – d. All of them
a. DECLARE c. STORE
a. int c. string
b. float d. char
8. %= is an example of:
4. The code of Python is executed line by line; hence it is called interpreted language .
• C++
• JavaScript
• Python
• Java
• C
3. Click create
5. To run the code, right click and select Run main or press ctrl+shift+F10
d. Can you give some examples of different types of blocks that are available in
Scratch?
2. Looks block: allows to change the color, size and costume of the sprite.
3. Sound block: allows to add sounds to your program. You can add sound from
5. Control block: provides options such as wait, use loops or conditional Statement
6. Sensing: they are used to detect things such as position of mouse pointer on the
screen.
7. Operators: allows to perform calculations on both numbers and text also known
as strings.
8. Variables: allow to save the variables that are used in the program.
9. My blocks: allow to create your own blocks for a sprite. You can name this block
and define what the new block does using other scratch blocks.
Lab Activity
Q No 5: Answer the following.
1. Write the script in Python to enter the marks of English, Mathematics, and
Science. Find the total and the percentage.
English = int(input())
Mathematics = int(input())
Science = int(input())
sum = English+Mathematics+Science
print(perc)
2. Write the script in Python to create a variable and assign a value to it. Then
add 255 using the assignment operator.
my_variable = 100
my_variable += 255
print("The new value of the variable is:", my_variable)
3. Write the script in Python to print the table of TWO using the assignment
operator.
number = 2
for i in range(1, 11):
result = number
result *= i
print(f"{number} x {i} = {result}")
Used in banking
It is high level programming
language. applications
C++ It is portable language Data structures
It is rich in library Software engineering
It locate errors and rectifiy Web browser games
Python is preferred for its simplicity, versatility, and ease of use. Key features include:
a = 10
b=2
2 c=a–b 8
print ( c )
a=5
b=3
3 c=a*b 15
print ( c )
a = 10
b=2
4 c=a/b 5
print ( c )
a = 10
a += 5
5 print ( a ) 15
a=9
a -= 5
6 print ( a ) 4
b=5
b *= 2 10
7 print ( b )
a = 10
a /= 5 2
8 print ( a )
c = 11
c %= 2 1
9 print ( c )