AP Computer Science - Midterm Exam

in #tutorials7 years ago (edited)

Hey Steemers! Feel Free to use this. It is original and can teach you or your kids if you take the time to learn!

APCSLogo.png

True/False:

_____ 1. There are 8 bytes in a bit.
_____ 2. An example of an output device would be a monitor.
_____ 3. An interpreter or compiler translates a source program into a readable output for the user.
_____ 4. An integer can have the type double in Java.
_____ 5. This line in a program will display the number 45 for its output… System.out.println("9*5");
_____ 6. Keyboards are considered software.
_____ 7. In Java, // This is an appropriate symbol to make a comment.
_____ 8. A Java program is executed from the main method in the class.
_____ 9. double $tarter$; // This could be an identifier or variable.
_____ 10. double 4star; // This could be an identifier or variable.
_____ 11. System.out.printf("%.2f" + 25.444); will print 25.44
_____ 12. System.out.printf("%.2f%10s”, 2.2, “Hello"); will display: 2.20 Hello
_____ 13. If you want a number formatted in scientific notation you use %e.
_____ 14. Strings can be inserted into the formatting method by concatenating with +’s.
_____ 15. String is known as a primitive data type in Java.
_____ 16. char would be the best data type to input a letter grade (A, B, C…).
_____ 17. 3 + 2*5 – 1 would give the output 24.
_____ 18. If x=2 and z=3, the following will be false: (x <= z && x > 20)
_____ 19. The short circuit operations are true && (anything) and false || (anything).
_____ 20. Math.pow(Math.abs(3-6), Math.sqrt(4)) yields 9.

Short Answer:

Problem 1

Determine if the following are equivalent using truth tables:

AB~(A and B)~A or ~B
TT--
TF--
FT--
FF--

Circle: Yes or No

Problem 2

Write a for loop that displays the following: 0 3 6 9 12 15 18 21 24
for ( _____ ; _____ ; _____ )
System.out.print( ___________________________________ );

Problem 3

Write the output (as the computer would) of the following program section:
int number = 0;
for ( i = 1; i <=4; i++) {
while ( i <= 2 ) { number = number * 2; }
System.out.print(number + “ ”);
number = number + 2;
}
ANSWER:

Problem 4

Draw a Venn Diagram for (A && !B) || !(A || B)

Problem 5

Write the output (as the computer would) for: System.out.printf(“%.2f%6s\n%s”,24.5624,”Hello”,”GoodBye”);
ANSWER:

Vocabulary:

_____ 1. Boolean
_____ 2. Syntax
_____ 3. Truncate
_____ 4. Constructor
_____ 5. Class
_____ 6. final
_____ 7. Object
_____ 8. for
_____ 9. Method
_____ 10. while

Vocabulary Bank:

a. The section of a code in which a variable exists.
b. A set of code which is referred to by name and can be called (invoked) at any point in a program simply by utilizing its name.
c. Used when you know how many times you need to loop.
d. A collection of data items, all the same type, in which each item's position is uniquely designated by an integer.
e. The blueprint for which individual objects are created.
f. The rules of combining words to create statements, in other words how a Java program is written and interpreted.
g. The expression in an if or else-if statement must be of this type.
h. Creates new objects, has the same name as the class, and has no return type.
i. To shorten or cut off part of.
j. Used to loop until an event occurs.
k. A keyword in Java that declares a variable that cannot change.
l. A value of a class type.
Bonus: Identify the definitions that were not used by circling the letter and giving the definition.

Free Response

Finish the program where indicated:

public abstract class Shape {
private String name;
// Constructor
public Shape(String shapeName)
{ name = shapeName; }
public String getName()
{ return name; }
public abstract double area();
public abstract double perimeter();
public double semiPerimeter()
{ return perimeter()/2; }
}

public class Square extends Shape {
private double side;
// Constructor
public Square(double squareSide, String squareName) {
super(squareName);
side = squareSide;
}
public double perimeter()
{
// Write a return statement for perimeter
}
public double area()
{
// Write a return statement for area.
}
}

public class MAIN {
public static void main(String[] args) {
// Create (one line) a Square Object side length of 4 named “MySquare”.
// Hint: SUPERCLASS name = new SUBCLASS(side, “name”);
// Print the perimeter, semiperimeter, area, and name of the new object in four separate print statements that also describe what it is printing.
}
}

SteemWave.gif

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 Exam 1

Computer Science

1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14

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,

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! Your pal ~ hansenator

STMEdu.gif

LogoPicSteemit.png

Sort:  

Thank you for posting @hansenator.

Always appreciate these Math posts.....bringing what you know best to Steemit.

Wishing you and yours a Happy Christ-mas. Cheers.

Thank you bleyjay! Glad to hear from you! By the way... My engineering club just got the underwater robot finished! It's pretty cool. In January I will share a video. I have to keep up the daily Steemit routine again. Shouldn't have stopped. Haha.

Greetings @hansenator.

What a detailed post......appreciated the technical vocabulary being presented as well.

Cheers.

Thank you bentlycapital. Always do what I can!

This post has received a 100% upvote worth $0.25 from @minnowspower thanks to: @theguruasia

MinnowsPower is not a bot, I am a Crowdfunding Hybrid
One small UpVote of Yours build MinnowsPower and MinnowsPower will Not Forget Your Support...!!!

I think I prefer the posts about breweries and stuff like that. These posts are not easy reading.

Haha. I'll get one for you Jeezle! Very soon!

great hansenator

Thanks kishore1988! Glad to hear from you!

@hansenator,
Ops it reminds me my uni times :D Sometimes I was flatten by those questions and when some one asked me how is the exam I said, questions were well printed there lol :D

Cheers~

Haha. Yeah theguruasia. The kids won't like me after this. They got their butts kicked.

Very good educational post @hansenator. Thanks a lot

No problem! I have plenty more where this came from! Lol

Coin Marketplace

STEEM 0.20
TRX 0.13
JST 0.030
BTC 65306.74
ETH 3488.89
USDT 1.00
SBD 2.51