0% found this document useful (0 votes)
15 views

CBSE Class 6 Computer NCERT

Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views

CBSE Class 6 Computer NCERT

Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

Here are 50 questions and answers based on the CBSE Class 6 Computer

Science NCERT syllabus you provided, focusing on Flowcharts and Pseudocode


and Introduction to Python:

Section A: Flowcharts and Pseudocode

1. What is a flowchart?

o A flowchart is a diagrammatic representation of an algorithm.

2. What is a pseudocode?

o Pseudocode is a structured way of writing program instructions using plain


English.

3. What are the basic symbols used in flowcharts?

o The basic symbols include:

 Start/Stop symbol (oval)

 Process symbol (rectangle)

 Input/Output symbol (parallelogram)

 Decision symbol (diamond)

 Flowline (arrow)

4. What is an algorithm?

o An algorithm is a step-by-step procedure to solve a problem.

5. How do flowcharts and pseudocode help in programming?

o They help in visualizing and understanding the logic of a program before


writing the actual code.

6. What is a decision in a flowchart?

o A decision is a point where the flow of the program can take different paths
based on a condition.

7. What is a loop in a flowchart?

o A loop is a set of instructions that are repeated until a certain condition is


met.

8. What are the types of loops?

o The types of loops are:

 For loop

 While loop

 Do-while loop

9. What is the difference between a flowchart and a pseudocode?

o A flowchart is a visual representation, while pseudocode is a textual


representation.

Sensitivity Label: General


10. How do you write a pseudocode for a simple program to add two
numbers?

 Start

 Input two numbers

 Add the numbers

 Print the result

 End

Section B: Introduction to Python

11. What is Python?

 Python is a high-level, interpreted programming language.

12. What are the basic data types in Python?

 The basic data types are:

o Integer

o Float

o String

o Boolean

13. What are variables in Python?

 Variables are used to store data values.

14. How do you declare a variable in Python?

 You simply assign a value to a variable name.

15. What are operators in Python?

 Operators are symbols used to perform operations on variables and values.

16. What are the types of operators in Python?

 The types of operators are:

o Arithmetic operators

o Comparison operators

o Logical operators

o Assignment operators

17. What is an expression in Python?

 An expression is a combination of values, variables, and operators.

18. What is a statement in Python?

 A statement is a single instruction that the Python interpreter executes.

Sensitivity Label: General


19. What is a comment in Python?

 A comment is a piece of text that is ignored by the interpreter.

20. How do you write a comment in Python?

 You use the # symbol to write a single-line comment and triple quotes (''') for
multi-line comments.

Input and Output Statements in Python

 Input: The input() function is used to take input from the user. It reads a line of
text from the console and returns it as a string.

Python

name = input("Enter your name: ")

age = int(input("Enter your age: "))

Use code with caution.

 Output: The print() function is used to display output on the console.

Python

print("Hello, " + name + "!")

print("You are", age, "years old.")

Use code with caution.

Conditional Statements in Python

 if statement: Executes a block of code if a condition is true.

Python

if age >= 18:

print("You are an adult.")

Use code with caution.

 if-else statement: Executes one block of code if a condition is true, and another
block if it's false.

Python

if age >= 18:

print("You are an adult.")

else:

print("You are a minor.")

Use code with caution.

 if-elif-else statement: Allows for multiple conditions to be checked.

Python

if age < 18:

Sensitivity Label: General


print("You are a minor.")

elif age >= 18 and age < 65:

print("You are an adult.")

else:

print("You are a senior citizen.")

Use code with caution.

Loops in Python

 for loop: Used to iterate over a sequence of values.

Python

for i in range(5):

print(i)

Use code with caution.

 while loop: Used to repeat a block of code as long as a condition is true.

Python

i=0

while i < 5:

print(i)

i += 1

Use code with caution.

Functions in Python

 A function is a block of code that performs a specific task.

 It can take input parameters and return a value.

 It helps in modularizing code and reusing it.

Defining a Function in Python

Python

def greet(name):

print("Hello, " + name + "!")

greet("Alice")

Use code with caution.

Recursion

 Recursion is a programming technique where a function calls itself directly or


indirectly.

 It's often used to solve problems that can be broken down into smaller, similar
subproblems.

Sensitivity Label: General


Modules and Packages

 Modules: A Python file containing functions and variables.

 Packages: A collection of modules organized into a hierarchical structure.

Object-Oriented Programming (OOP)

 OOP is a programming paradigm that models real-world entities as objects.

 Key concepts:

o Classes: Blueprints for creating objects.

o Objects: Instances of classes.

o Inheritance: Creating new classes based on existing ones.

o Polymorphism: The ability of objects to take on many forms.

o Encapsulation: Bundling data and methods within a class.

Handling Errors and Exceptions

 Use try-except blocks to handle exceptions and prevent program crashes.

Python

try:

x = int(input("Enter a number: "))

y = 10 / x

print(y)

except ZeroDivisionError:

print("Error: Division by zero")

Use code with caution.

File Handling

 Reading files: Use the open() function to open a file and the read() method to
read its contents.

 Writing files: Use the open() function with the 'w' mode to create a file and the
write() method to write to it.

Regular Expressions

 Regular expressions are patterns used to match and manipulate text.

 The re module in Python provides functions for working with regular expressions.

Database Programming with Python

 Connecting to a database: Use modules like sqlite3 or MySQLdb to connect to


a database.

 Executing SQL queries: Use the execute() method to execute SQL queries.

 Fetching results: Use the fetchall() or fetchone() methods to fetch results from
the database.

Sensitivity Label: General


Web Development with Python

 Frameworks: Django and Flask are popular frameworks for web development in
Python.

 Web Development Tasks:

o Building web applications

o Designing web interfaces

o Handling HTTP requests and responses

o Working with databases

Data Science and Machine Learning with Python

 Popular libraries: NumPy, Pandas, Matplotlib, Scikit-learn, TensorFlow, PyTorch

 Applications:

o Data analysis and visualization

o Machine learning models

o Predictive analytics

o Natural language processing

o Computer vision

Python's Role in Artificial Intelligence

 Python is widely used for AI and machine learning due to its simplicity and
powerful libraries.

Future of Python

 Python's popularity continues to grow, and it's expected to remain a dominant


language for years to come.

Python in Everyday Life

 Data analysis

 Web development

 Game development

 Education

 Building command-line tools

Sensitivity Label: General

You might also like