Introduction to Coding
Introduction to Coding
Based on the transcript, here’s a complete set of study material, broken into:
1. Integer (int)
• An integer is a whole number.
• It can be positive, negative, or zero.
• No decimal points.
Examples:
age = 15 # age is an integer
score = -3 # negative integer
students = 0 # zero is also an integer
2. Float (float)
• A float is a number with a decimal point.
• Useful for precise values like measurements, money, etc.
Examples:
price = 9.99 # float with decimal
temperature = -12.5
pi = 3.14
3. Character (char)
• A character is a single letter, digit, or symbol.
• Written in single quotes in some languages like C or Java.
Examples:
letter = 'A' # a single letter
digit = '5' # a single number as character
symbol = '#' # a symbol
In Python, characters are treated as 1-character strings.
4. String (str)
• A string is a collection of characters.
• Can be letters, numbers, symbols, spaces — anything in quotes.
Examples:
name = "Alice" # string of letters
greeting = "Hello, World!" # string with punctuation
password = "abc123!" # mix of letters, numbers, and symbols
5. Boolean (bool)
• A boolean holds only two possible values:
o True or False
• Useful for conditions, decisions, logic.
Examples:
is_logged_in = True
is_raining = False
Summary Table
Data Type What It Holds Example
Integer Whole numbers 10, -2, 0
Float Decimal numbers 3.14, -0.5
Character A single letter/symbol 'A', '9', '#'
String Text (one or more characters) "Hello", "123"
Boolean True/False values True, False
Operators
• Arithmetic: +, −, ×, ÷, %.
• Assignment: Used to assign values to variables (e.g., a = 10).
Practice Questions
MCQs
1. What is coding?
o a) Writing books
o b) Giving computers step-by-step instructions
o c) Speaking to machines
o d) Drawing diagrams
Answer: b
2. Which of the following is a programming language?
o a) HTML
o b) Python
o c) Excel
o d) Word
Answer: b
3. What symbol represents a decision in a flowchart?
o a) Oval
o b) Rectangle
o c) Diamond
o d) Arrow
Answer: c
4. Which tool is used for block coding in the document?
o a) Scratch
o b) Excel
o c) MakeCode Arcade
o d) VS Code
Answer: c
True or False
1. Coding helps develop analytical and creative thinking.
True
2. Pseudocode must follow strict syntax rules.
False
3. A string can only hold numbers.
False
4. Microsoft MakeCode Arcade is used for creating movies.
False
Short Q&A
Q1. What is programming/coding?
A: Programming is the process of giving step-by-step instructions to a computer to perform tasks or
solve problems.
Q2. List three benefits of learning coding.
A:
• Enhances problem-solving skills
• Boosts creativity and logical thinking
• Prepares students for tech careers
Q3. What is a flowchart and why is it useful?
A: A flowchart is a visual representation of an algorithm. It helps in understanding and debugging the
logic of a program.
Q4. Define a variable with an example.
A: A variable is a memory location used to store values. For example, profit = SP - CP.
Q5. What is pseudocode?
A: Pseudocode is writing code-like instructions in plain English to plan a program without worrying
about syntax.
True or False
1. Coding can help develop persistence and patience.
True
2. Syntax rules in coding are optional.
False
3. In a flowchart, arrows show the flow of steps.
True
4. Block coding requires memorization of syntax.
False
5. The MakeCode Arcade environment is used to design mobile apps.
False
6. A string can be made of multiple characters.
True
7. Arithmetic operators are only used in mathematics, not in programming.
False