APCSA pop quiz potential questions

docx

School

San Francisco State University *

*We aren’t endorsed by this school

Course

99

Subject

Computer Science

Date

Dec 6, 2023

Type

docx

Pages

4

Uploaded by JudgeKudu1768

Report
1) Create a method called SUM that takes in two ints as arguments. Return the sum of the two numbers. 2)Create a method called EVEN that takes in an intas an argument. Return the number if it is even. If it is not even, return -1 3)Create method called BIGGER that takes in 3 ints as parameters. Return the number that is greatest.
If the two or three biggest numbers are equal, return any of them. 4)Create a method called BETWEEN that takes in two ints as arguments. You can assume the first number is smaller than the second number. Create a loop that prints (horizontally) all the numbers between the two ints (inclusively). 5)Create a method called ODDBETWEEN that takes in two ints. Create a loop that prints all the ODD numbers between the two numbers (inclusively).
6) Create a method called SIX that takes in an int as an argument . Return the number multiplied by 6. 7)Create a method called OKAY that takes in three ints as arguments. Return the average as a double. 8) Create a method called GRADE that takes in a double. Print A if the number is greater than 3.9, B if the number is between 3.0 and 3.9, C if the number is between 2 and 2.9, D if the number is between 1 and 1.9, and F if the number is 0. 9. Create a methodk called looper that takes in an int and a string as arguments. Print (vertically) the word that number of times. 10. Create a method that takes in two strings. Return the word with the least amount of letters. If both strings have the same amount of letters, report both strings (in any order).
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
11. Create a method called WORDLENGTH that takes in a string and an int. If the word has as many letters as the number, return the word. If not, return “no”. 12. Create a method called EVENWORD that takes in a string as an argument. If the string has an even amount of letters, return the string. If it does not, return “No”.