1. What’s a computer program?
Answers
· A set of languages available in the computer
· A process for getting duplicate values removed from a list
· A list of instructions that the computer has to follow to reach a goal
· A file that gets copied to all machines in the network
Explanation: A computer program may be thought of as a collection of instructions that a computer follows in order to complete a task. It's a string of instructions written in code that tells the computer how to carry out a certain activity or set of operations. Imagine it as a recipe that you provide to your computer, informing it how to process and change data in order to get the result that you want.
2. What’s the syntax of a language?
Answers
· The rules of how to express things in that language
· The subject of a sentence
· The difference between one language and another
· The meaning of the words
Explanation: The term "syntax" is used to refer to the rules that are used in programming languages to determine how programs should be constructed. The syntax of a programming language may be compared to this. The syntax is what specifies the appropriate order of symbols, keywords, and other components that go into the construction of a good program.
3. What’s the difference between a program and a script?
Answers
· There’s not much difference, but scripts are usually simpler and shorter.
· Scripts are only written in Python.
· Scripts can only be used for simple tasks.
· Programs are written by software engineers; scripts are written by system administrators.
Explanation: There is a difference that should be made, despite the fact that the words "program" and "script" are often used interchangeably with one another.
A collection of instructions or code that is developed to do a particular job on a computer is referred to as a program. It is a more general phrase that refers to a wide variety of software, such as applications, system software, and utilities. It covers all of these categories. Before being run, programs are often converted into machine code or an intermediate code. Compilation occurs before execution.
On the other hand, a script is a kind of computer program that is interpreted rather than compiled. Scripts are often used in web-based applications. Scripts are often created in scripting languages such as Ruby, Python, or JavaScript. They are often used for the purposes of automating processes, carrying out duties related to system management, or extending functionality to other applications. Scripts are often understandable by humans and may be modified on the fly, eliminating the need for a separate process to compile the changes.
To reduce it all the way down to its most fundamental level, every program is a script, but not every script is a program. The difference is in the manner in which they are carried out, namely, either via compilation or interpretation.
4. Which of these scenarios are good candidates for automation? Select all that apply.
Answers
· Generating a sales report, split by region and product type
· Creating your own startup company
· Helping a user who’s having network troubles
· Copying a file to all computers in a company
· Interviewing a candidate for a job
· Investigating the root cause of a machine failing to boot
5. What are semantics when applied to programming code?
Answers
· The rules for how a programming instruction is written
· The difference in number values in one instance of a script compared to another
· The intended meaning or logic of coded statements
· The end result of a programming instruction
6. Fill in the correct Python command to put “My first Python program” onto the screen.
_____("My first Python program")
Answers
· print(“My first Python program”)
7. Python is an example of what type of programming language?
Answers
· General purpose scripting language
· Machine Language
· Platform-specific scripting language
· Client-side scripting language
Explanation: Python is an example of a programming language that is high-level, interpreted, and designed for general-purpose use. It is meant to be understandable and has a clear syntax, which makes it approachable for novices while also having the capacity to satisfy specialists. In addition, Python is compatible with a number of other programming paradigms, such as procedural, object-oriented, and functional programming.
8. Convert this Bash command into Python:
echo Have a nice day
Answers
· print(“Have a nice day”)
9. Fill in the correct Python commands to put “This is fun!” onto the screen 5 times.
for i in range(5):
_____("This is fun!")
Answers
· for i in range(5):
print(“This is fun!”)
10. Why is Python relevant to IT? Select all that apply.
Answers
· Python is used in fast-growing areas of IT, like machine learning and data analytics.
· Python works well as a scripting language for IT automation.
· Python scripts run on IT servers only.
· Python can be used to calculate statistics, run e-commerce sites, process images, interact with web services, and more.
Explanation: Python is a flexible programming language that may be used for a wide range of tasks, including but not limited to web development, data analysis, artificial intelligence (AI), automation, scripting, and many more. Because of its adaptability, it may be used to do a broad variety of different IT jobs.
Because Python's syntax is straightforward and easy to comprehend, the programming language is well-suited for teaching novices. This is helpful in circumstances where people may come from a variety of different backgrounds and have varying degrees of expertise.
11. What are functions in Python?
Answers
· Functions let us use Python as a calculator.
· Functions are pieces of code that perform a unit of work.
· unctions are only used to print messages to the screen.
· Functions are how we tell if our program is functioning or not.
Explanation: In Python, a function is a section of code that may be reused and is designed to carry out a certain operation. The def keyword comes first, then the function name, then the arguments encased in parentheses, and finally a colon. This is how functions are defined. The code that will be run whenever the function is invoked may be found in the indented "body" of the function, which is formatted using tabs.
12. What are keywords in Python?
Answers
· Keywords are reserved words that are used to construct instructions.
· Keywords are used to calculate mathematical operations.
· Keywords are used to print messages like “Hello World!” to the screen.
· Keywords are the words that we need to memorize to program in Python.
Explanation: Because they are considered to be part of the syntax of the language, keywords in Python are words that cannot be used as identifiers (variable names, function names, etc.) even if they have specific meanings associated with them. The Python programming language's syntax and semantics are both specified by these terms.
13. What does the print function do in Python?
Answers
· The print function generates PDFs and sends it to the nearest printer.
· The print function stores values provided by the user.
· The print function outputs messages to the screen
· The print function calculates mathematical operations.
14. Output a message that says "Programming in Python is fun!" to the screen.
Answers
· print(“Programming in Python is fun!”)
15. Replace the ___ placeholder and calculate the Golden ratio: 1+√5/2
Tip: to calculate the square root of a number x, you can use x**(1/2).
ratio = ___
print(ratio)
Answers
· ratio = (1 + 5**(1/2)) / 2
print(ratio)
16. Once you have learned the basics of a programming language, how does this affect your ability to learn and use a second programming language?"
Answers
· You should only code in one language.
· It’s easier to learn and use a second language.
· It’s difficult to learn and use a second language.
· The syntax and semantics will be the same.
17. What is a shorter piece code, typically used to automate a specific task?
Answers
· Variable
· Syntax
· Script
· Markup
Answers
· Updating specific files on multiple computers
· Detecting and removing duplicate data
· Interviewing and hiring employees
· Haircuts and styling
Answers
· Format
· Semantics
· Syntax
· Grammar
Answers
· Linker
· Interpreter
· Translator
· Compiler
# Enter code here:
_____
# Should print: Automating with Python is fun!
Answers
· print(“Automating with Python is fun!”)
print((6-2)/(5*(1+4))+3)
Answers
· 3.16
· 50.0
· 12.0
· 5.0
# Enter code here:
_____
# Should print 525600
Answers
· minutes_in_hour = 60
hours_in_day = 24
days_in_year = 365
minutes_in_year = minutes_in_hour * hours_in_day * days_in_year
print(minutes_in_year)
# Enter code here:
____
# Should print 100000000
Answers
· numerals = 10
password_length = 8
possible_passwords = numerals ** password_length
print(possible_passwords)
In a managed computing environment, there are 200 remote computers that must download 200 MB (megabytes) of updates each month. There are 1024 KB (kilobytes) in each MB.
Fill in the blank in the code below to compute the number of total kilobytes downloaded by these computers from the remote update server each month.
download_size_kb = 200*1024
total_computers = 200
total_kbs = ____
print(total_kbs) # Should print 40960000.0
Answers
· download_size_kb * total_computers
Answers
· The beginning of a program defining who wrote it and why
· A reusable block of code that performs a specific task
· A document describing a software project
· The task a program is written to accomplish
27. What are some of the benefits of automation? Select all that apply.
Answers
· Consistency
· Can accomplish creative tasks
· More cost-effective for complex, seldom-done tasks
· Doesn’t get tired
Answers
· Syntax
· Grammar
· Format
· Semantics
print(6*2-5/(1+4)+3**2)
Answers
· 49.0
· 0.28
· 20.0
· 19.36
Answers
· A file that gets printed by the Python interpreter.
· The syntax and semantics of a programming language.
· The overview of what the computer will have to do to solve an automation problem.
· Step-by-step instructions on how to complete a set of tasks, to be executed by a computer.
Typically, the goal of developing a computer program is to provide a solution to a certain issue or to automate a particular procedure. It is made up of directives, or statements, as well as functions and algorithms, which lay out the steps that need to be carried out by the computer. The term "program" may refer to anything from a short script that executes a single command to a complex piece of software that consists of a number of interconnected modules.
A computer program's primary function is to mediate communication between the human user and the computer hardware, therefore empowering the latter to carry out the actions specified by the former (the programmer).
Answers
· Python is cross-platform compatible
· Python is used in a wide variety of applications
· Python has many platform-specific tools, like Bash or Powershell
· Python is an object-oriented language not fit for general purpose scripting
Answers
· Syntax is a set of rules for how statements are constructed. Semantics refers to the intended meaning or effect of statements.
· Syntax is the effect the instructions have on the system and semantics are how to write the instructions.
· Syntax is the tool that executes a computer program and semantics is the development environment.
· Syntax refers to computer programs and semantics is another word for scripts.
39. What is automation?
Answers
· The inputs and outputs of a program
· The process of replacing a manual step with an automated step
· The rules of a programming language
· The process of designing a solution to a problem
Explanation: The term "automation" refers to the use of machinery, computer systems, or specialized software to carry out activities or procedures that would otherwise need the participation of a human worker. The purpose of automation is to simplify and improve the performance of labor-intensive or repetitive tasks in order to achieve higher levels of productivity, accuracy, and efficiency. Automation is useful in many different spheres, such as the manufacturing industry, the information technology industry, corporate procedures, and even in daily life.
40. What is a property of Python that makes it easier to understand than some other programming languages?
Answers
· Basic guidelines can be given and it will write the code.
· You can use Python code in any other language.
· Python doesn’t have a defined syntax.
· Code is similar to the English language.
41. Which Python function will output text, or other value, to the screen?
Answers
· echo
· print()
· output()
· console.out
42. What should be the output of the expression below?
print(15+5+(3*2)/4**2+(3-7)*7)
Answers
· 15.0
· 81.0
· -7.625
· 6.0