ShmoopTube

Where Monty Python meets your 10th grade teacher.

Search Thousands of Shmoop Videos


Computer Science Videos 112 videos

AP Computer Science 1.2 GridWorld Case Study and APIs
493 Views

AP Computer Science 1.2 GridWorld Case Study and APIs. What is the direction of the actor?

AP Computer Science 1.4 Standard Algorithms
200 Views

AP Computer Science 1.4 Standard Algorithms. How many times will mystery be called for mystery(n) for n > 1?

AP Computer Science 2.3 Classes and Objects
191 Views

AP Computer Science 2.3 Classes and Objects. Which of the following is correct implementation of the Country class?

See All

AP Computer Science 2.1 Review of the Basics 230 Views


Share It!


Description:

APCS: Review of the Basics Drill 2, Problem 1. What is the output of the code segment?

Language:
English Language

Transcript

00:00

Thank you We sneak and here's your shmoop du jour

00:05

brought to you by a lack of case But that's

00:09

the least of your problems right now Okay what is

00:14

the output of the following code segment and hear the

00:17

potential answers came through All right oz waiver and let's

00:24

roll Right Well to answer this bad boy we should

00:27

know the difference between print and print line statements Know

00:31

how to use relational operators and know what exactly is

00:35

returned when we knew so Operational operators are extremely useful

00:39

Incoming A variety of flavors for every situation way Use

00:42

them to determine if one piece of data is greater

00:45

than less than equal to or not equal to another

00:48

and return a true or false feather you depending on

00:50

the outcome But most of them are selfish Planter let's

00:53

Take a quick tour too Equal signs checks like two

00:57

operations are equal In other words you can use it

01:01

on strings in andrew's practically whatever an exclamation point and

01:06

an equal sign checks If two operandi are not evil

01:11

greater than and less than on there you go You've

01:13

already met can driven or equal to and less than

01:17

or equal tio r yet right here That's it All

01:20

right Well in the case of this question we've got

01:22

a couple of fairly simple mathematical statements To compare his

01:25

hundred twenty six less than three hundred fourteen months one

01:28

thousand three hundred thirty seven one part will the result

01:32

of a mod operation Thiss kind of mod operation is

01:36

the remainder after division that is one hundred five by

01:39

twenty six used three with the remainder of twenty two

01:43

So there's our value for the left side of the

01:46

comparison Three hundred fourteen minus two thousand three hundred seven

01:49

is your negative One thousand twenty three So bottom line

01:53

is twenty two less than negative one thousand twenty three

01:57

We'll not even close pal We're gonna get a false

02:00

shmoop That leaves us with c and d And the

02:04

difference between the two is a line break between rick

02:07

Cake is and false The code snap It has two

02:11

different types of prints taken The first is we print

02:14

which simply prints its contents to the console screen There

02:18

thie invisible cursor remains at the end of the statement

02:21

The second is a print line statement which prince its

02:23

contents then starts a new line Shocking it's Useful for

02:27

keeping an ongoing log advance to scroll through for example

02:31

All right So which is it security Since print line

02:34

starts the new line at the end of the statement

02:36

the new line won't begin until after false has been

02:40

printed He tried to trick us by suggesting that the

02:43

new line starts before the statement But we cannot be 00:02:46.913 --> [endTime] so easily fooled So we're going with me

Related Videos

AP Computer Science 1.2 GridWorld Case Study and APIs
493 Views

AP Computer Science 1.2 GridWorld Case Study and APIs. What is the direction of the actor?

AP Computer Science 1.4 Standard Algorithms
200 Views

AP Computer Science 1.4 Standard Algorithms. How many times will mystery be called for mystery(n) for n > 1?

AP Computer Science 2.3 Classes and Objects
191 Views

AP Computer Science 2.3 Classes and Objects. Which of the following is correct implementation of the Country class?

AP Computer Science 3.4 Inheritance, Abstraction, and Polymorphism
204 Views

AP Computer Science 3.4 Inheritance, Abstraction, and Polymorphism. Which of the following will satisfy the conditional if statement for boo, str,...

AP Computer Science 4.2 Standard Algorithms
191 Views

AP Computer Science 4.2 Standard Algorithms. What kind of algorithm is the following?