11 IP Solutions
11 IP Solutions
CD DVD
CD stands for Compact Disc. DVD stands for Digital Versatile Disc.
CDs are made of a polycarbonate disc DVDs are made of a polycarbonate disc
with a reflective aluminum layer on one with a reflective aluminum layer on both
side. sides.
Question 19
Explain the statement, "Functioning of a computer is similar to the way the
human brain functions."
Answer
The statement "Functioning of a computer is similar to the way the human brain
functions" compares how both systems process information. Computers use
input devices like keyboards and mice to receive data, and output devices like
monitors and printers to present results. Similarly, the human brain receives
input through sensory organs such as the eyes, ears, and skin, and produces
responses through actions and speech. Both systems use internal processes—
computers use the CPU and memory for data handling, while the brain processes
sensory information and stores memories.
Question 20
Explain in brief the basic architecture of a computer.
Answer
A computer system comprises of five basic components:
1. Input Unit — An input unit takes the input and converts it into binary form
so that it can be understood by the computer. For example, keyboard,
mouse etc.
2. Output Unit — It converts the output in binary form to human readable
form. For example, monitor, speakers etc.
3. Central Processing Unit (CPU) — It is responsible for processing the data
and instructions. It consists of two parts:
i. Arithmetic and Logic Unit (ALU) — It performs all the four arithmetic
operations (addition, subtraction, multiplication and division) and
some logical operations (less than, greater than, less than equal to,
greater than equal to, equal to, not equal to).
ii. Control Unit (CU) — It acts as a supervisor by controlling and
guiding the operation taking place.
4. Primary Memory — It is the internal volatile memory where data and
instructions are stored during processing. It is of two types: Random
Access Memory (RAM) and Read Only Memory (ROM).
5. Secondary Storage Unit — It refers to the external storage devices which
provide permanent memory to the computer system. For example, hard
disk, compact disk, flash drive etc.
Question 21
What is an input unit? Give its significance.
Answer
An input unit takes the input and converts it into binary form which is directly
understood by the computer.
Computers only understand binary language that uses just two symbols: 1 for ON
and 0 for OFF. The input unit translates raw data from external sources into
binary language that the computer understands. Without this conversion, the
computer would not be able to understand or process the data provided.
Question 22
List and briefly explain all the components of a CPU.
Answer
There are mainly three components of a CPU:
1. Arithmetic and Logical Unit (ALU) — All calculations and comparisons
are made in this unit. The ALU performs the arithmetic (+, -, *, /) and
logical (AND, OR, NOT, XOR) operations sent from the memory, performs
specific operations (addition, subtraction etc) and the result is returned to
the memory. The result of the logical operations is either true or false and
helps the computer in decision-making.
2. Control Unit (CU) — The CU controls the flow of data from input devices
to memory and from memory to output devices. It controls and guides the
interpretation, flow and manipulation of all data and information. It does
not actually process the data, instead, it sends control signals to ALU and
memory for carrying out the required operations.
3. Registers — These are high-speed temporary storage areas found in CPU.
Registers work as per the instructions given by the control unit (CU),
storing instructions and data immediately required for performing an
operation. The CPU places the highest priority jobs/data inside registers for
faster execution/processing. Registers can be of different sizes (16 bits, 32
bits, 64 bits and so on) and each register inside the CPU has a specific
function like storing data, storing an instruction, storing address of a
location in memory etc.
Question 23
Why is a control unit referred to as the central controller of a computer?
Answer
A control unit is referred to as the central controller of a computer because it
controls the flow of data from input devices to memory and from memory to
output devices. It controls and guides the interpretation, flow, and manipulation
of all data and information, sending control signals to the Arithmetic Logic Unit
(ALU) and memory to execute the required operations effectively.
Question 24
Does an ALU work independently or in coordination with some other unit? Give
reasons.
Answer
Arithmetic Logic Unit (ALU) does not work independently; it operates in
coordination with the control unit and memory. The control unit fetches
instructions from memory and decodes them, directing the ALU to perform
specific operations such as addition, subtraction, or logical comparisons. The
results produced by the ALU are then stored back in memory or used by other
components of the computer system.
Question 25
Compare data and information.
Answer
Data Information
Question 26
Give the difference between an impact printer and a non-impact printer.
Answer
Question 27
Discuss the following devices:
(a) Light Pen
(b) CD-ROM
(c) DVD
Answer
(a) Light Pen — A light pen is a pointing device, basically a stylus, that can be
used to select anything on the computer screen by simply pointing at it or for
drawing figures directly on the screen. It consists of a photocell mounted on a
pen-shaped tube and is capable of sensing a position on the screen when its tip
touches the screen. Clicking is performed by pressing the pen on the screen. A
light pen is mostly used by engineers, architects or designers.
(b) CD-ROM — Compact Disc is a thin optical disc which is commonly used to
store audio and video data. The capacity of a standard 120 mm CD is 700 MB.
Originally, CD-ROM drives had transfer rates of only 150 KB/sec which was
considered very slow. The newest CD-ROM drives can transfer up to 72x, i.e.,
10800 KB/sec.
(c) DVD — Digital Versatile Disc or Digital Video Disc is an optical disc storage
device. It can be recorded on single side or on both sides. Its capacity may range
from 4.7 GB to 17.08 GB.
Question 28
Describe the terms hardware and software along with their components.
Answer
Hardware are physical tangible (which can be touched) components of a
computer like motherboard, memory devices, monitor, keyboard, etc. while
software are a set of programs or instructions, intangible components of a
computer like operating system, application software, utility software, etc.
Question 29
Write a short note on Freeware software.
Answer
The term freeware is generally used for software, which is available free of cost
and which allows copying and further distribution, but not modification and
whose source code is not available. The right to use the software is limited to
certain types of users for instance, for private and non-commercial purposes.
For example, TeamViewer, VLC Media Player etc.
Question 30
Discuss the various categories of a printer.
Answer
The various categories of printer are as follows:
1. Impact Printers — In impact printers there is a mechanical contact
between printer head and paper.
i. Dot Matrix Printer — A dot matrix printer also known as Serial
printer, prints one character at a time. It uses dots to create an
image. This printer prints characters by striking an ink-soaked
ribbon against the paper which produces sound and is termed as
impact printer. It has low operating cost and can be used to
generate carbon copies also. This printer prints one line of text at a
time and can only print low-resolution graphics.
2. Non-impact Printers — In non-impact printers there is no mechanical
contact between printer head and paper.
i. Inkjet/Deskjet/Bubble Jet Printers — An inkjet printer is the
most common type of low-cost printer. It uses the technique of
spreading quick-dry ink on paper. The ink is stored in the form of
cartridges of different colors (red, green, black etc). These printers
generate high-quality prints and are ideal for small offices and
homes.
ii. Laser Printers — These printers use laser technology to produce
printed documents. They use dry form of ink called toner which is
made up of tiny particles. They are very fast and are used for high-
quality prints.
3. 3D Printers — They are used to build 3D models. 3D printing, also known
as additive manufacturing, is a method of creating a three-dimensional
object layer by layer using a computer-aided design.
Question 31
What is the need of RAM? How does it differ from ROM?
Answer
RAM (Random Access Memory) is used for primary storage in computes to hold
active information of data and instructions.
Difference Between RAM and ROM:
RAM ROM
It stands for Random Access Memory. It stands for Read Only Memory.
It is a non-volatile or permanent
It is a volatile or temporary memory.
memory.
Data gets erased when the power is switched off. Data is stored permanently.
Question 32
Differentiate between proprietary software and freeware software. Name two
software of each type.
Answer
Its use is regulated and further distribution This allows copying and further
and modification is either forbidden or distribution, but not modification.
Proprietary software Freeware software
Question 33
What are memory cards? Discuss their types.
Answer
Memory cards are small, portable storage devices used to store data, such as
photos, videos, music, and other files, in electronic devices like cameras,
smartphones, tablets, and laptops and are also called flash cards.
The types of memory cards are as follows:
1. Secure Digital (SD) cards — SD cards are widely used in cameras,
smartphones, and other devices. They come in various capacities, from a
few hundred megabytes to several gigabytes.
2. MicroSD cards — A smaller version of SD cards, microSD cards are used in
devices like smartphones, tablets, and action cameras.
3. CompactFlash (CF) cards — CF cards are larger and faster than SD cards,
making them suitable for professional photographers and high-end
cameras.
Question 34
Convert the following into bytes:
(a) 2 MB
(b) 3.7 GB
(c) 1.2 TB
Answer
(a) 2 MB — 2 MB * 1024 KB/MB * 1024 bytes/KB = 2 * 1024 * 1024 =
2,097,152 bytes
(b) 3.7 GB — 3.7 GB * 1024 MB/GB * 1024 KB/MB * 1024 bytes/KB = 3.7 * 1024 *
1024 * 1024 = 3,973,078,528 bytes
(c) 1.2 TB — 1.2 TB * 1024 GB/TB * 1024 MB/GB * 1024 KB/MB * 1024 bytes/KB =
1.2 * 1024 * 1024 * 1024 * 1024 = 1,319,843,208,192 bytes
Question 35
What are the security threats involved when we throw away electronic gadgets
that are non-functional?
Answer
Discarding non-functional electronic gadgets without properly deleting the stored
data permanently by proper tools can lead to significant security risks, including
potential data breaches where personal and sensitive information can be
recovered and exploited, resulting in identity theft and data leaks.
Question 36
Write down the type of memory needed to do the following:
1. To store data permanently,
2. To execute a program,
3. To store instructions which cannot be overwritten.
Answer
1. To store data permanently — Secondary memory (e.g., Hard Disk Drive
(HDD), Solid State Drive (SSD), Flash Memory)
2. To execute a program — Random Access Memory (RAM)
3. To store instructions which cannot be overwritten — Read-Only Memory
(ROM)
Python
Fill in the Blanks
Question 1
Programs are the set of instructions given to a computer to perform a particular
task.
Question 2
Python was developed by Guido Van Rossum.
Question 3
Python is called a/an interpreted language.
Question 4
Python is a/an case-sensitive language in terms of its syntax.
Question 5
In Python, a syntax error is detected by the interpreter at runtime.
Question 6
Python is a/an platform independent language.
Question 7
To start Python from the command prompt, use the python command.
Question 8
Python programs are saved using the .py or .pyw extension.
Question 9
Python programming can be done in interactive and script modes.
Question 10
Interactive mode does not save the commands entered by you in the form of a
program.
Question 11
The shortcut key to run Python script is F5.
State True or False
Question 1
Python is a dynamically typed language.
Answer
True
Reason — Python is a dynamically typed language because variables do not
need to be declared with a specific type. Instead, the type of a variable is
determined at runtime based on the value assigned to it.
Question 2
Alt+R is used to repeat the last typed command in Python shell.
Answer
False
Reason — For repeating or recalling the last command in the Python shell, the
correct key is the up arrow key (↑).
Question 3
Print and print are same in Python.
Answer
False
Reason — In Python, print and Print are not the same because Python is a case-
sensitive language.
Question 4
The sep argument is used with print() method.
Answer
True
Reason — The sep argument in the print() function is used to specify a string
that separates the objects being printed. The default separator is a space.
Question 5
Python is a compiled high-level language.
Answer
False
Reason — Python is an interpreted high-level language.
Question 6
Python is a cross-platform language.
Answer
True
Reason — Python is a cross-platform language because it can run on various
operating systems, such as Windows, macOS, Linux, etc.
Question 7
Python is an interpreted language, not a compiled language.
Answer
True
Reason — Python is an interpreted language, not a compiled language. This
means that Python code is executed line by line at runtime by an interpreter,
without the need for a separate compilation step to machine code.
Question 8
Python is a free, open-source and portable language.
Answer
True
Reason — Python is free and open-source, meaning anyone can freely use,
distribute, and modify it. It is also highly portable, running on various platforms
such as Windows, macOS, Linux, and others.
Question 9
Python Editor refers to Script mode in Python.
Answer
True
Reason — Python Editor refers to a mode in IDLE where we can write and run
Python scripts, also known as Script mode.
Question 10
Ctrl+Q shortcut key combination is used to exit Python.
Answer
True
Reason — Ctrl+Q shortcut key combination is used to exit Python.
Multiple Choice Questions
Question 1
Python was developed by ............... .
1. Charles Babbage
2. Guido van Rossum
3. Tim Berners Lee
4. Robert E. Kahn
Answer
Guido van Rossum
Reason — Python was developed by Guido van Rossum.
Question 2
Which of the following is syntactically correct text?
1. "This is great!"
2. 'she shouted 'HELLO' loudly'
3. "Goodbye'
4. "This "course" is good"
Answer
"This is great!"
Reason — The "This is great!" text uses double quotes (") to properly enclose
the entire string. In Python, strings enclosed in either single quotes (') or double
quotes (") are valid, but the entire string must be enclosed in the same type of
quote. The other options have mismatched quotes, which cause syntax errors in
Python.
Question 3
Python language is ............... .
1. Free
2. Open Source
3. Free and Open Source
4. Proprietary
Answer
Free and Open Source
Reason — Python is a free and open-source language.
Question 4
Identify the correct print() statement:
1. print(Hello)
2. print("Hello")
3. print('Hello")
4. print("Hello')
Answer
print("Hello")
Reason — In Python, when using the print() function, strings must be enclosed
in matching pairs of either single (') or double quotes ("). Therefore, the correct
statement is print("Hello").
Question 5
Which of the following is the shortcut key combination for exiting Python shell?
1. F5
2. Alt+F1
3. Ctrl+E
4. Ctrl+Q
Answer
Ctrl+Q
Reason — The shortcut key combination for exiting Python shell is Ctrl+Q.
Question 6
The extension for a Python file is given as:
1. .pt
2. .pwy
3. .py or .pyw
4. .yppy
Answer
.py or .pyw
Reason — The extension for a Python file is .py or .pyw.
Question 7
Python is a/an ............... language.
1. Compiled
2. Interpreted
3. Compiled & Interpreted
4. None of these
Answer
Interpreted
Reason — Python is an interpreted language. This means that Python code is
executed line by line at runtime by an interpreter, without the need for a
separate compilation step to machine code.
Question 8
The interactive interpreter of Python is termed as ............... .
1. Python shell
2. Python Script mode
3. Python Editor mode
4. Python command line
Answer
Python shell
Reason — The interactive interpreter of Python is termed as Python shell.
Question 9
The three greater than signs (>>>) are called the Python ............... .
1. Cursor
2. Command prompt
3. Pointer
4. Blinking cursor
Answer
Command prompt
Reason — The three greater than signs (>>>) are called the Python command
prompt or interactive prompt.
Question 10
Single-line comments in Python begin with ............... symbol.
1. %
2. "
3. '''
4. #
Answer
#
Reason — The # symbol in Python indicates the start of a single-line comment,
which extends from the # to the end of the line.
Question 11
Which of the following codes is correct?
1.
print("Programming is fun")
print("Python")
print("Computer Science")
2.
print ("Programming is fun)
print("Python")
print("Computer Science)
3.
Print("Programming is fun")
print("Python")
print("Computer Science")
4.
Print("Programming is fun")
Print("Python")
Print("Computer Science")
Answer
print("Programming is fun")
print("Python")
print("Computer Science")
Reason — In Python, the print() function is written in lowercase (print) and
strings must be enclosed in matching pairs of either single (') or double quotes
("). Therefore, the correct code would be :
print("Programming is fun")
print("Python")
print("Computer Science")
Question 12
Python is a case-sensitive language. This means ............... .
1. Capital and small letters are same for Python
2. Python doesn't care about the case of alphabets
3. Python treats capital and small letters as different
4. Python automatically capitalizes the small letters
Answer
Python treats capital and small letters as different
Reason — Python is a case-sensitive language. This means that Python
differentiates between capital and small alphabets.
Question 13
............... mode of Python gives instant result of typed statement.
1. Interactive mode
2. Script mode
3. Both Interactive and Script mode
4. None of these
Answer
Interactive mode
Reason — Interactive mode of Python gives instant result of typed statement.
Assertions and Reasons
Question 1
Assertion (A): Python is an object-oriented programming language.
Reasoning (R): Using Python, any software can be designed. Everything in
Python is an object.
1. Both A and R are true and R is the correct explanation of A.
2. Both A and R are true but R is not the correct explanation of A.
3. A is true but R is false.
4. A is false but R is true.
Answer
Both A and R are true and R is the correct explanation of A.
Explanation
Python is an object-oriented programming language, which means it supports
the concepts of classes and objects. In Python, everything is treated as an object,
including integers, strings, functions, and even modules and packages. Using
Python, any software can be designed.
Question 2
Assertion (A): Python uses an interpreter to convert source code to object
code.
Reasoning (R): Python interpreter is a special virtual engine that converts
machine code to source code.
1. Both A and R are true and R is the correct explanation of A.
2. Both A and R are true but R is not the correct explanation of A.
3. A is true but R is false.
4. A is false but R is true.
Answer
A is true but R is false.
Explanation
Python uses an interpreter to convert source code to object code. The Python
interpreter is a special virtual engine that converts source code (written in
Python) to machine code that can be executed by the computer.
Question 3
Assertion (A): To print the value of a variable, Python uses print() method.
Reasoning (R): print() method displays the content on the system screen or
console.
1. Both A and R are true and R is the correct explanation of A.
2. Both A and R are true but R is not the correct explanation of A.
3. A is true but R is false.
4. A is false but R is true.
Answer
Both A and R are true and R is the correct explanation of A.
Explanation
The print() function is a built-in function in Python that displays the content on
the system screen or console. To print the value of a variable, Python uses
the print() function.
Question 4
Assertion (A): Python is a cross-platform language.
Reasoning (R): Python code can run on a variety of platforms such as windows,
Macintosh and Apple.
1. Both A and R are true and R is the correct explanation of A.
2. Both A and R are true but R is not the correct explanation of A.
3. A is true but R is false.
4. A is false but R is true.
Answer
Both A and R are true and R is the correct explanation of A.
Explanation
Python is a cross-platform language because it can run on various operating
systems, such as Windows, Macintosh, Apple, Linux etc.
Question 5
Assertion (A): Python is a dynamically typed language.
Reasoning (R): Python interpreter assigns variables a data type at runtime
based on the variable's value at that time.
1. Both A and R are true and R is the correct explanation of A.
2. Both A and R are true but R is not the correct explanation of A.
3. A is true but R is false.
4. A is false but R is true.
Answer
Both A and R are true and R is the correct explanation of A.
Explanation
Python is a dynamically typed language because variables do not need to be
declared with a specific type. Instead, the type of a variable is determined at
runtime based on the value assigned to it.
Question 6
Assertion (A): Python is the fastest language.
Reasoning (R): Python is an interpreted language.
1. Both A and R are true and R is the correct explanation of A.
2. Both A and R are true but R is not the correct explanation of A.
3. A is true but R is false.
4. A is false but R is true.
Answer
A is false but R is true.
Explanation
Python is not considered the fastest programming language as it is slower than
many compiled languages such as C or C++ because it is interpreted rather than
compiled. Python is an interpreted language, which means that Python code is
executed line by line at runtime by an interpreter, without the need for a
separate compilation step to machine code.
Question 7
Assertion (A): Python IDLE or Interpreter provides two modes to work with,
create and run the scripts or code.
Reasoning (R): Interactive mode comprises Python prompt '>>>' where you
can simply start typing the command and display output, and script window,
where you can write Python program in a file and execute it to display output.
1. Both A and R are true and R is the correct explanation of A.
2. Both A and R are true but R is not the correct explanation of A.
3. A is true but R is false.
4. A is false but R is true.
Answer
Both A and R are true and R is the correct explanation of A.
Explanation
Python's Integrated Development and Learning Environment (IDLE) or interpreter
provides two modes to work with: interactive mode and script mode. Interactive
mode comprises the Python prompt '>>>' where we can start typing commands
and see the output immediately. In script mode, we can write a Python program
in a file and execute it to display the output.
Question 8
Assertion (A): Python is a general-purpose language, meaning it can be used to
create a variety of different programs.
Reasoning (R): Python is used to build websites and software, automate tasks
and conduct data analysis.
1. Both A and R are true and R is the correct explanation of A.
2. Both A and R are true but R is not the correct explanation of A.
3. A is true but R is false.
4. A is false but R is true.
Answer
Both A and R are true and R is the correct explanation of A.
Explanation
Python is a general-purpose language, meaning it is versatile and can be used to
create a variety of programs. Python is an object-oriented language used to build
websites and software, automate tasks, and conduct data analysis.
Solutions to Unsolved Questions
Question 1
When was Python introduced?
Answer
Python was developed in February 1991.
Question 2
Who developed Python and which two languages contributed to Python as a
programming language?
Answer
Guido Van Rossum is the developer of Python. ABC language and Modula-3
contributed to Python as a programming language.
Question 3
Python is free and open-source. What do you understand by this feature?
Answer
Python is free and open-source means that it is available to anyone at no cost,
and its source code can be freely accessed, modified, and distributed by anyone.
Question 4
Is Python case-sensitive?
Answer
Yes, Python is a case-sensitive language. This means that Python differentiates
between uppercase (capital) and lowercase (small) letters.
Question 5
What is IDLE?
Answer
IDLE is a simple Integrated Development and Learning Environment that comes
with Python. The most important feature of IDLE is that it is a program that
allows the user to edit, run, browse and debug a Python program from a single
interface.
Question 6
Differentiate between displaying and printing method in Python.
Answer
Printing in Python refers to using the print() function to output information to the
console. The print() function takes one or more arguments, converts each
argument to a string (if necessary), and displays them as text. On the other
hand, displaying can be a more general term that encompasses presenting
information or output in various forms, not limited to just text output in the
console.
Question 7
Briefly explain the salient features of Python.
Answer
The salient features of Python are as follows:
1. Python is an interpreted, interactive, directly executed language with a
pre-compiled code. This means that it is processed at runtime by the
interpreter and we need not compile our program before executing it.
2. It is a loosely type object-oriented programming language with a few
keywords, simple English-like structure and is easy to learn.
3. It is a free, open-source and portable language having a large repository of
libraries.
4. It takes less time to develop as Python programs are typically 3 to 5 times
shorter than the equivalent programming languages. This is because of its
built-in, high-level data types and its dynamic typing.
5. It is extensible/extendable and highly efficient as there is no wastage of
time in declaring the types of variables or arguments.
6. It supports GUI (Graphical User Interface) and garbage collection (better
memory management).
7. It is easily compatible with other languages like C, C++, Core Java etc.
8. Python is used for both scientific and non-scientific programming.
Question 8
What do you understand by cross-platform software with respect to Python?
Answer
Python is platform-independent and a cross-platform language because it can
run on various operating systems, such as Windows, macOS, Linux etc.
Question 9
What are the advantages of Python programming language?
Answer
Advantages of Python programming language are:
1. Easy to Use — Python is compact, programmer-friendly and very easy to
use object oriented language with very simple syntax rules.
2. Expressive Language — Python is an expressive language, it takes
fewer lines of codes to represent the same syntax.
3. Interpreted Language — Python is an interpreted language, not a
compiled language. It makes Python an easy-to-debug language and thus
suitable for beginners to advanced users.
4. Completeness — Python has a rich standard library that provides
modules for most types of required functionality like emails, web-pages,
databases, GUI development, network connections, etc.
5. Cross-platform Language — Python can run equally well on variety of
platforms — Windows, Linux/UNIX, Macintosh, supercomputers, smart
phones, etc.
6. Free and Open Source — Python language is freely available along with
its source-code.
7. Variety of Usage/Applications — Python has evolved into a powerful,
complete and useful language over these years. These days Python is
being used in many diverse fields/applications, some of which are
Scripting, Web Applications, Game development, Database Applications,
System Administrations, Rapid Prototyping, GUI Programs.
Question 10
In how many different ways can you work in Python?
Answer
We can work in Python in two ways:
1. Interactive mode (also called Immediate mode)
2. Script mode
Question 11
What are the advantages/disadvantages of working in Interactive mode in
Python?
Answer
Interactive mode is useful for testing code. We can type the commands one by
one and get the result of error immediately for each command. Disadvantages of
Interactive mode are that it does not save commands in form of a program and
also output is sandwiched between commands.
Question 12
Write some limitations of Python.
Answer
Some limitations of Python programming language are:
1. Not the Fastest Language — As Python is an interpreted language so its
execution-times are not that fast compared to some compiled languages.
2. Lesser Libraries than C, Java, Perl — Library collection of C, Java, Perl is
better than Python.
3. Not strong on Type-Binding — Python interpreter is not very strong on
catching 'Type-Mismatch' issues.
4. Not easily convertible — Translating Python programs to other languages
is difficult due to its lack of syntax.
Question 13
What is the difference between Script mode and Interactive mode in Python?
Answer
In script mode, we write a Python program in a file and execute it to display the
output and in interactive mode, we use the Python prompt '>>>' to start typing
commands and see immediate output.
Question 14
Write instructions to the Interactive mode for the following:
(a) To display sum of 3, 8.0, 6 * 12
(b) To print sum of 16, 5.0, 44.0
Answer
(a)
>>> 3 + 8.0 + 6 * 12
(b)
>>> print(16 + 5.0 + 44.0)
Question 15
Write the output of the following:
num1 = 4
num2 = num1 + 1
num1 = 2
print(num1, num2)
Answer
Output
25
Explanation
In the above code, num1 is initially assigned the value 4. Then, num2 is set
to num1 + 1, resulting in num2 being 5. Subsequently, num1 is reassigned the
value 2, changing its original value from 4 to 2. When print(num1, num2) is
executed, it displays the current values of num1 and num2, which are 2 and 5,
respectively.
Question 16
Consider the statements given below and write Python command to display
these statements in both Interactive and Script mode.
Python is easy to learn and write.
It allows us to work in two modes: Interactive mode and Script mode.
Interactive mode is also known as Python Shell and Script mode is also known as
Python Editor.
It is a platform-independent language.
We find it interesting to work with Python.
Answer
Interactive Mode:
>>> print("Python is easy to learn and write.")
>>> print("It allows us to work in two modes: Interactive mode and Script
mode.")
>>> print("Interactive mode is also known as Python Shell and Script mode is
also known as Python Editor.")
>>> print("It is a platform-independent language.")
>>> print("We find it interesting to work with Python.")
Script Mode:
print("Python is easy to learn and write.")
print("It allows us to work in two modes: Interactive mode and Script mode.")
print("Interactive mode is also known as Python Shell and Script mode is also
known as Python Editor.")
print("It is a platform-independent language.")
print("We find it interesting to work with Python.")
Question 17
Write a code that prints your full name and your birthday as separate strings.
Answer
full_name = "Jeevika Sharma"
birthday = "January 17, 2000"