
compareTo and Math.random
Presentation
•
Computers
•
10th Grade - University
•
Hard
Brian Ciavarella
Used 2+ times
FREE Resource
5 Slides • 8 Questions
1
compareTo method for String class
2
Multiple Choice
Given that str1 has a value of: "Galaga", and str2 has a value of: "The Legend of Zelda", what is the returned value of str1.compareTo(str2)?
Positive
Negative
3
Multiple Choice
Given that str1 has a value of: "Bubble Bobble", and str2 has a value of: "The Legend of Zelda", what is the returned value of str2.compareTo(str1)?
Positive
Negative
4
Multiple Choice
Given that str1 has a value of: "Tetris", and str2 has a value of: "Donkey Kong Country", what is the returned value of str1.compareTo(str2)?
Positive
Negative
5
Multiple Choice
Given that str1 has a value of: "Mike Tyson's Punch Out!!", and str2 has a value of: "Doom", what is the returned value of str1.compareTo(str2)?
Positive
Negative
6
Multiple Choice
What type of value is returned by: "Contra".compareTo("Sonic the Hedgehog") ?
Positive
Negative
Error, you can only use compare to on variables that hold Strings.
7
Random Integers with Math.random()
Review
8
Random Integers with Math.random()
Math.random() -> [0 ,1)
(int)Math.random() -> 0
(int)(Math.random() * a) -> [0 , a) = [0 , a-1]
(int)(Math.random() * a + b) -> [b , a + b) = [b , a + b - 1]
(int)(Math.random() * (max - min + 1) + min) -> [min , max]
9
Multiple Choice
What is the range of possible integers generated by:
(int)(Math.random() * 3 + 1)?
[0 , 4]
[1 , 4]
[1 , 3]
[1 , 2]
10
Fill in the Blanks
Type answer...
11
Fill in the Blanks
Type answer...
12
Escape the Room...
random integer edition
https://docs.google.com/forms/d/e/1FAIpQLSc1LPu_sTPlIjdFAf-McrE-uh4of2DFgqtx9QawUy29-iHB7w/viewform?authuser=0
13
Escape the Room... random integer edition
https://docs.google.com/forms/d/e/1FAIpQLSc1LPu_sTPlIjdFAf-McrE-uh4of2DFgqtx9QawUy29-iHB7w/viewform?authuser=0
compareTo method for String class
Show answer
Auto Play
Slide 1 / 13
SLIDE
Similar Resources on Wayground
10 questions
MATERI 4 : PAIRED CONJUCTION
Presentation
•
10th Grade
10 questions
SRI Notes - The STEM Portfolio
Presentation
•
9th Grade - University
12 questions
Microsoft Access, Database Basics 01
Presentation
•
9th - 12th Grade
12 questions
AP Computer Science Principles Procedures
Presentation
•
9th - 12th Grade
12 questions
Introduction to C/C++ Programing
Presentation
•
KG - University
10 questions
Информатика
Presentation
•
9th - 12th Grade
10 questions
Componenta hardware a unui PC
Presentation
•
9th - 12th Grade
12 questions
Domain 2 Lesson 1
Presentation
•
9th - 12th Grade
Popular Resources on Wayground
10 questions
HCS SCI 03 Summer School Review 4
Quiz
•
3rd Grade
11 questions
HSMS - Standard Response Protocol
Quiz
•
6th - 8th Grade
16 questions
1.1-1.2 Quiz Review
Quiz
•
9th - 12th Grade
12 questions
Exponent Expressions
Quiz
•
6th Grade
20 questions
Adding and Subtracting Integers
Quiz
•
6th - 7th Grade
11 questions
Northeast States
Quiz
•
3rd - 4th Grade
10 questions
Characterization
Quiz
•
3rd - 7th Grade
10 questions
Common Denominators
Quiz
•
5th Grade