COMPUTER LESSON5,6,7
LESSON-5
Fill in the
Blanks
- r a n g e function
returns a sequence of numbers.
- w h i l e loop is used
for executing statements while a given condition is TRUE.
- f o r loop executes
a sequence of statements multiple times.
- b r e a k . A keyword can
stop the loop before it has looped through all the items.
- c o n t i n u e keyword can
skip the remaining part of the code and pass control to the beginning of
the loop.
State True
or False
- pass statement
is used as a placeholder for future code.. -True
- range functions
can have float values as parameters. -False
- A continue statement
passes control to the beginning of the loop. -True
- Loop
control statements are used to change the flow of execution inside a loop.
-True
- for loop
can’t be used for iterating through elements of a sequence. -False
Match the
Following
|
Iterations. |
|
|
Go to the beginning of the loop. |
|
|
Exit loop. |
|
|
Return a sequence of numbers. |
|
|
No operation. |
|
Multiple
choice questions
- What
is the term for one execution of a loop?
1. counter
2. function
3. Run
4. Iteration
- What
is the output of the following code ?
for x in range(5) :
print(x,
end=” “)
4. None of the above
- Which
of the following sequences will be generated by the following line of
code?
range
(10, 0 , -5)
1. 10 5
2. -5 0 5 1 0
3. 0 5 10
4. 10 5 0 -5
- What
is the output of the following code?
n = 0
while
n < 4:
n
= n + 1
print
(“value of n is “, n)
1. value of n is 2
2. value of n is 3
3. value of n is 4
4. value of n is 5
- What
is the result of the execution of the following code?
for letter in “word”:
print
(letter, end=””)
4. word
Answer in
one word or one sentence
- What
is a break statement in Python?
The break statement is used to exit the loop
- Write
a Python code to execute an infinite loop.
while True:
print("hello")
- What
is a pass statement in Python?
The pass statement is used as a placeholder for future code.
- What
is a nested loop?
A loop inside another loop is called a nested loop
- What
is range function?
The range function generates a sequence of numbers within a specified
range.
Answer the
following
- What
is the use of Loop in Python.
A loop in Python is used to execute a block of code repeatedly. It
allows you to perform the same actions multiple times without having to write
the code again and again.
- What
are the loops available in Python?
·
while: A while loop repeatedly executes
a target statement as long as a given condition is true.
·
for: for loop is generally used when
you know how many times you have to repeat a task.
- What
is a range function in python?
The range() function returns a sequence of numbers, starting from 0 by
default, increments by 1 (by default), and ends at a specified number.
- What
are loop control statements in Python?
Loop control statements in Python, like break, continue, and pass, help manage the flow of loops. break stops
the loop entirely, continue skips the current iteration, and pass is a
placeholder for future code.
- Write
a program to print all the numbers below 50 which are divisible by 7 ?
for num in range(0,50):
if num % 7 == 0:
print(num)
LESSON-6
Answers of textbook exercises
Fill in the Blanks
1. With N u m P y package, we can create a multi dimensional array.
2. p i p installs Python packages in any environment.
3. D o c k e r is a tool designed to make it easier to create, deploy,
and run applications by using containers.
4. G r a f a n a allows users to understand better, the metrics of
their data through queries, informative visualizations, and alerts.
5. P y t h o n is one of the most preferred languages for developing
AI applications.
State True or False
1. pip installs any package in any environment. -False
2. We cannot create multi-dimensional arrays using numpy. -False
3. NumPy is a Python package for scientific computing -True
4. Grafana is an open-source web application. -True
5. Docker is a programming language for creating AI
applications.-False
Match the Following
1. Docker Container
2. Numpy Scientific computing
3. Grafana Analytics & visualization
4. Jupyter Open source
5. pip Python package manager
Multiple choice questions
1. How do you choose a programming language to create an
application?
a. Device in which application is used.
b. Size of the application.
c. Number of users of the application.
d. All of the above.
2. Which of the following programming language(s) is (are)used to
develop AI applications?
a. Lisp
b. R
c. Python
d. All of the above
3. The Jupyter Notebook is:
a. Open-source
b. Contains live codes, equations, visualizations and
narrative text.
c. Web application
d. All of the above.
4. Grafana is used in:
a. Industrial sensors
b. Home automation
c. Process control
d. All of the above
5. Which of the following is not a Python library?
a. NumPy
b. C++
c. Pybrain
d. SciPy
Answer in one word or one sentence
1. Write down the command to install Jupyter.
pip install jupyter
2. Write down the command to install Numpy.
pip install numpy
3. What is Numpy ?
NumPy is a Python package for scientific computing.
4. What is Jupyter?
Jupyter Notebook is a web app for creating and sharing
documents with live code, equations, visualizations, and text.
5. What is Grafana?
Grafana is an open source matrix analytics & visualization suite.
Answer the following
1. What is Numpy? How can you install it and what are the uses?
NumPy is a Python library for numerical computations. You can
install it using "pip install numpy" command. It's used for
creating and manipulating arrays, performing mathematical
operations, and working with large datasets efficiently.
2. What is Jupyter? How can you install it and what are the
uses?
The Jupyter Notebook is an open-source web application that
allows you to write and run code in a web browser. You can get it
by using "pip install jupyter" in the command line. It helps in
data cleaning and transformation, Numerical simulation, Data
visualization & Machine learning
3. What is a Grafana? How can you install it and what are the
uses?
Grafana is an open source metric analytics & visualization suite.
Grafana can be downloaded and installed from its website or it can
be set up on a docker. It is used for visualizing time series data for
infrastructure and application analytics.
4. How will you select the right programming language for
developing an application?
The important factors that influence choosing the right
programming languages are where and who will use the
application. The size of the application and the number of users of
the application.
5. Python programming language is preferred for developing AI
applications, Why ?.
Python is simple to learn, easy to implement and platform agnostic.
It contains pre-built libraries and it supports object oriented and
procedural style of programming.
Comments
Post a Comment