AP Computer Science - Methods and Loops Quiz

in #tutorials7 years ago

APCSLogo.png

Hello Everyone!
It has been a month since I have posted, so today I am going to celebrate my 1000 followers by posting this and making a new logo and celebration post. Today's lesson for CS includes my most recent quiz and the solutions I typed out with the class. Any teachers that wish to use it may very well do so! Best wishes to all of you! I hope you enjoy!

Number 1

What is the output of the following subcode:
int x = 1; while (x < 50) { x *= 2 } System.out.print(x + “is the output.”);

Number 2

How many times does the inner while loop execute?
int j = 0, x = 0;
while ( j++ < 100 ) {
int k = 100;
while ( k - - > 0 ) {
x++;
}
}

Number 3

Write a loop that simulates a countdown from 60 seconds down to zero. Your product should output: Countdown: 60… 59… 58… (and so on to)… Blast-off!

Number 4

Write a main method that asks the user for the side length of a square, prints the perimeter, and prints the area. Use two helper methods that calculate perimeter and area. Do not do it in the main method.

Number 5

Consider the following method and fill in the blank (//Your Code):
public void arithmetic (int a1, int d, int an) { // Your Code }
Implement a code that mimics the following examples:
arithmetic (3,5,40) would print 3 8 13 18 23 28 33 38
arithmetic (-10, 7, 25) would print -10 -3 4 11 18 25

Solution 1

Solution 2

Solution 3

Solution 4

Solution 5


BAR.png

All SteemitEducation Posts

Physics

Kinematics Video, Circular Motion Video, Forces in 1 & 2 Dimensions Videos, Kinematics Full Lesson, Circular Motion and Gravitation Full Lesson, Kinematics and Forces Quiz, Forces in 1-Dimension, Forces in 2-Dimensions, Basic Physics, Kinematics, and Forces Review, AP Physics Midterm Exam, AP Physics Midterm Exam Solutions , Kinematics and Forces Quiz, Another Kinematics and Energy Quiz, Momentum Lesson

Computer Science

1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18

SAT

Asymptotes, Composite Functions, Contest 1 - Area, Contest 1 – Winners and Solution, PEMDAS, Systems of Equations, Functions, Exponents, Contest 2 - More Functions, Contest 2 – Winners and Solution, Percents, The Interest Equation, All About Division, Contest 3 - Factoring, Contest 3 – Winners and Solution, Fractional and Negative Exponents, Basic Trig, Contest 4 - Math Vocab, Contest - 5, Contest 5 – Winners and Solution, Contest 6, Contest 6 – Winners and Solution

General Math

Basics of Algebra, Trigonometry Video, Proof of Quadratic Formula, Factoring Video, Unions and Intersections, Surface Area of a Cylinder, Substitution Video, Combinatorics Basics

Graphing from Algebra to Calculus

Algebra 1, Algebra 2, Pre-Calculus, Calculus

Piloting Airplanes

Introduction, Preflight, Requirements, Instruments, Take-Offs and Landings, Why a Plane Can Fly, Reading the Runway, Maneuvers

Other

Engineering (Isometric) Drawing, Pressure & SCUBA Diving

BAR.png

Thank you for your views Steemers! The support is much appreciated! Learn much and best wishes!

STMEdu.gif

ColorGIF.gif

Sort:  

This post has received 100% upvote from @minnowspower thanks to: @theguruasia

MinnowsPower is not a bot, I am a Crowdfunding Hybrid

oh this is cool :)

Thank you steemclaira! Glad to see you once again!

I like your education blog and your all logos. @hansenator
DQmatYXgKe2Rtmxp1sKrvBtMB47MuxfReLoKngRYas2nKjr.png

your inspiring post very beautiful, (hansenator )thanks