Unit 1: Beginning in Computer Science

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

In the next five years there are expected to be over _____________ unfilled jobs in the US in computer science.

1 million

What is output by the following? print ("she sells \nseashells")print ("by the seashore")

she sells seashells by the seashore

What is output by the following? print ("/\\")print ("\\/")

/\ \/

The symbol used to create a comment is:

#

Which of the following is NOT a legal variable name?

%information

Assume the user types in 7 and 10. What is output by the following? num1 = input ("Enter a number: ") num2 = input ("Enter a number: ") print (num1 + num2)

710

What is output by the following? print(type("95"))

<class 'str'>

Computer science allows people to:

All of the above!

Which of the following is true about strings?

An input (unless otherwise specified) will be stored as a string

____________ are special output characters marked with a \.

Escape characters

The print command in Python can be written as PRINT or print.

False

What is output by the following? print("Twinkle, \ttwinkle, \tlittle star")

Twinkle, twinkle, little star

A name given to a spot in memory is called:

Variable

Consider the following code: x = "apple"y = xz = "banana" print(x + " " + y + "\n" + z) What is output?

apple apple banana

Consider the following code: print("computer" + "science") What is output?

computerscience

What is output by the following line of code? print (5 + 9*2)

23

In the previous lesson, we learned about different data types. The type function returns the type of data that you pass into it. For example, if a is a string, then print(type(a)) will print <class 'str'>. What is output by the following code? print(type("67")) print(type(67)) print(type("sixty-seven"))

<class 'str'> <class 'int'> <class 'str'>

_____________ data is what is translated to digital format so it can be stored in a computer.

Analog

Which of the following carries out the commands in programs?

CPU

Which of the following is NOT an output device?

Camera

What is the correct order for the steps the compiler uses in translating code?

Check for mistakes, Translate commands to machine language, Run the commands

What do we call notes in computer code for the programmer that are ignored by the compiler?

Comments

Which of the following about computers is NOT true?

Computing devices translate digital to analog information in order to process the information.

True or False: When running the print command as seen in the code below, the text that is output will be displayed in quotation marks. print("Hello there!")

False

____________ is based on a set of very specific rules for communicating.

Formal Language

____________ is designed to be very clear and work consistently every time it is used.

Formal Language

What would be output by the following code? print("Hello", end="")print(" Jackson")

Hello Jackson

What is output by the following lines of code if we input the name "Sally"? n = input("What is your name?")print("Hello there " + n)

Hello there Sally

What is output by the following? Assume the user enters Sally and John. x = input ("What is your name? ")y = input ("What is your friend's name? ")print ("Hi " + x + " and " + y)

Hi Sally and John

What is output by the following line of code? print ("I\tLove Python")

I Love Python

What is wrong with the following line of code? print(Hello World)

It needs " around Hello World

What is wrong with the following code? num1 = int (input("Enter a number: ")) num2 = int (input("Enter a number: ")) num3 = int (input("Enter a number: ")) print ("The average is: " + (num1 + num2 + num3)/3)

It needs a str() command

Which of the following is true about main and secondary memory?

Main memory is short term memory used by the CPU in processing commands, secondary memory is more permanent and used for storage.

___________ is what we use to communicate day to day.

Natural Language

Instructions written in code that a computer follows are called:

Program

What is input?

Putting information into the computer

The programs that run on a computer are called:

Software

What is one downside of converting analog information to a digital format?

Some information may be lost when it is converted.

The two basic categories of variable data types are:

Strings and numbers

What is the CPU?

The central processing unit, it acts as the brain of the computer and carries out commands.

This code accepts a word as input, and then prints that word to the screen. w = input("Enter a word: ") print(w) What happens if you type in a number instead of a word?

The number is printed.

Which of the following is NOT true about variables?

The value stored by a variable cannot be changed after it is assigned.

What is output by the following? Assume the user enters 5 and 4. x = input("Enter a number: ") y = input("Enter a number: ") print("Values: " + x + y)

Values: 54

When do we use numbers instead of strings?

When you need to do calculations

Consider the following code: x = input("What year is it?") print(x) The value stored in x is:

a string

Using a microphone to record a sound on your computer is an example of:

analog to digital conversion

1.8 Code Practice

animal = input("Enter an animal: ") sound = input ("Enter a sound: ") e = "E" print ("Old Macdonald had a farm, " + "E-I-E-I-O") print ("And on his farm he had a " + animal + ", " + "E-I-E-I-O") print ("With a " + sound + "-" + sound + " here and a " + sound + "-" + sound + " there") print ("Here a "+ sound+ " there a " +sound) print ("Everywhere a " + sound + "-" + sound ) print ("Old Macdonald had a farm, " + "E-I-E-I-O")

Using an LCD projector to show an online video to a group of people is an example of:

digital to analog conversion

1.6 Code Practice: Question 1

first = input("Enter a word: ") second = input("Enter a word: ") print(first + " " + second)

1.6 Code Practice: Question 2

first_name = input("Please input your first name: ") last_name = input("Please input your last name: ") print(last_name + ", " + first_name)

_____________ is information the user sends to the computer.

input

What command is used to change a string into a number?

int

Which of the following is a correct variable name?

low_Temperature

Short term memory used by the CPU.

main memory

Which of the following lines of code correctly inputs a number?

n = int(input ("Enter a value: "))

Which of the following correctly inputs two numbers and prints the sum?

n1 = int(input("Enter a number: ")) n2 = int(input("Enter a number: ")) print("The answer is: " + str(n1 + n2))

1.7 Code Practice: Question 1

num = int(input("Enter a number: ")) print(num * 8)

1.7 Code Practice: Question 2

num = int(input("Enter a number:")) print(num * 12)

Which of the following controls computer memory?

operating system

When the computer translates digital information to information humans can use, it is called _____________.

output

What is the Python command that can be used to display text and numbers on the screen?

print

1.5 Code Practice: Question 4

print(" )") print(" ( ") print(" ^ )") print(" / \ ---") print(" / \| |") print(" / _ \ |") print(" / (_) \|") print(" / \\") print(" /| _ _ \\") print(" | | | | | \\") print(" | |_| |_| |\\") print(" | __ __ |") print(" | | | | || #") print(" | | @| |__|| ###") print(" | | | | #####") print(" \/\/\/\/\/\/\/\/\/\/\/\/\/")

1.3 Code Practice: Question 3

print(" ^ ^") print("( o o )") print(" v")

1.4 Code Practice: Question 1

print(" _ _") print("(,)_(,)") print(" | ''|") print("=| @|=") print(" ---")

1.4 Code Practice: Question 2

print(" __") print(" ('')") print(" ( (") print(" ) )") print(" ( (") print(" ) )") print(" ( (") print(" ) )") print(" ( (") print(" ) )") print(" V")

1.5 Code Practice: Question 2

print("**********") print("* *") print("* PYTHON *") print("* *") print("**********")

1.5 Code Practice: Question 1

print("A lightning flash:\nbetween the forest trees \nI have seen water. \n\t- Shiki")

1.3 Code Practice: Question 2

print("Hello ") print("There")

1.2 Code Practice

print("Hello world")

Assignment 1: Silly Sentences

print("Let\'s play Silly Sentences!\n") name = input("Enter a name: ") adj = input("Enter an adjective: ") adj_two = input("Enter an adjective: ") adverb = input("Enter an adverb: ") food = input("Enter a food: ") food_two = input("Enter another food: ") noun = input("Enter a noun: ") place = input("Enter a place: ") verb = input("Enter a verb: ") print("\n" + name + " was planning a dream vacation to " + place + ".") print(name + " was especially looking forward to trying the local") print("cuisine, including " + adj + " " + food + " and " + food_two + ".\n") print("\n" + name + " will have to practice the language " + adverb + " to ") print("make it easier to " + verb + " with people.") print("\n" + name + " has a long list of sights to see, including the ") print(noun + " museum and the " + adj_two + " park.")

1.3 Code Practice: Question 1

print("Welcome " + "to " + "Computer " + "Science!")

1.5 Code Practice: Question 3

print("\"Computer Science is no more about computers\"" "\n\"than astronomy is about telescopes\"") print("- Edsger W. Dijkstra")

Which of the following is NOT an input device?

printer

Which of the following will correctly output: I know there's a proverb which that says "To err is human," but a human error is nothing to what a computer can do if it tries. - Agatha Christie Note: This is a direct quote from Agatha Christie's novel, Hallowe'en Party. The grammar shown here is as it is written in the novel.

quote = "\"To err is human,\"" print("I know there's a proverb which that says \n" + quote + "\nbut") print("a human error is nothing to what a computer") print("can do if it tries.\n\n- Agatha Christie")

Programs that run on hardware are called:

software

Which command converts a number to a string?

str

Which of the following is a legal variable name?

temperatureAM


Set pelajaran terkait

ALGEBRA 1: FOUNDATIONS FOR ALGEBRA

View Set

Nurs 204 - Chapter 15: Head and Neck (3)

View Set

Chap. 7 Organization, Teamwork, and Communication

View Set

The Art of Public Speaking, Ch. 11-14, 16-19

View Set

Leadership Exam 2: Ch 8- Power and Influence

View Set

CYSE 300- Introduction to Cybersecurity

View Set