New User Special Price Expires in

Let's log you in.

Sign in with Facebook


Don't have a StudySoup account? Create one here!


Create a StudySoup account

Be part of our community, it's free to join!

Sign up with Facebook


Create your account
By creating an account you agree to StudySoup's terms and conditions and privacy policy

Already have a StudySoup account? Login here

Exam 1 Study Guide COSC 236

by: Kelsey Voelker

Exam 1 Study Guide COSC 236 COSC 236

Marketplace > Towson University > Computer science > COSC 236 > Exam 1 Study Guide COSC 236
Kelsey Voelker

Preview These Notes for FREE

Get a free preview of these Notes, just enter your email below.

Unlock Preview
Unlock Preview

Preview these materials now for free

Why put in your email? Get access to more of this material and other relevant free materials for your school

View Preview

About this Document

Here is a study guide for the basics we have covered in class. Also read over textbook chapters, and class lecture notes for more help.
Intro to Computer Science 1
Dr. Alkharouf
Study Guide
50 ?




Popular in Intro to Computer Science 1

Popular in Computer science

This 5 page Study Guide was uploaded by Kelsey Voelker on Wednesday September 28, 2016. The Study Guide belongs to COSC 236 at Towson University taught by Dr. Alkharouf in Fall 2016. Since its upload, it has received 49 views. For similar materials see Intro to Computer Science 1 in Computer science at Towson University.

Similar to COSC 236 at Towson

Popular in Computer science


Reviews for Exam 1 Study Guide COSC 236


Report this Material


What is Karma?


Karma is the currency of StudySoup.

You can buy or earn more Karma at anytime and redeem it for class notes, study guides, flashcards, and more!

Date Created: 09/28/16
COSC 236 Study guide Exam 1 Exam 1 Study Guide (java fundamentals & Decision structures)  *Must have a java class o public class (name)  Must have a method o public static void main(String[] args) o code goes between curly braces { }  Statements o End in ; o System.out.printin prints output to the screen  Special Characters o // comments (for users view only) o () use in method header to mark parameter list o {}  encloses group of statements as the contents of a class or method o “ “ enclose strings o ; completes statements o n\  moves the curser to a new line o \t tabs o \b  backspace o \\  backslash o \’ single quote o \”  double quote o \r  carriage return (goes to beginning of current line)  Console output o Printin: “enters” after the string text o Print: strings printed on same line  Variables o A named storage ‘box’ located in the computer’s memory  How you are able to store data into memory locations o Declaring the variable actually creates it (reserves a box in memory for it) o Assigning the variable actually puts value or something into the box  Value = 5 (value gets 5) o Literal a value that is written into the code of a program o If two word variable, second word gets capitalized.  hiThere  The ‘+’ operator o Used two ways  A concatenation operator (puts two things next to each other)  An addition operator  Ex.  “hello” + “world”  hello world  Identifiers o Programmer-defined names for:  Classes, methods, and variables o Cannot be JAVA keywords o RULES:  May only have…  Letters a-z, A-Z  Digits 0-9  Underscores  The dollar sign  First character may NOT be a digit  Case sensitive  CANNOT include spaces  Primitive Data Types (in order from smallest largest) o Byte (1 byte) o Short (2 bytes) o Int (4 bytes) o Long (8 bytes)  * all are whole numbers o float (4 bytes) o double (8 bytes)  *fractions or decimal points o Boolean  True or false  Character (char) use single ‘ ‘  Arithmetic Operators o + addition o – subtraction o * multiplication o / division o % modoulus (stores remainder) 10%3 remainder = 1  integer division o in Java program 1 divided by 2 = 0 o the interger division will Truncate any decimal remainder (Int does whole numbers) o *instead declare as a float or double  Operator Precedence (order of operations LR) o Parenthesis = highest o – (negations) o * / % (left to right if same precedence) o + -  Combined Assignment Operators  Constants o Data that will not be changed o To declare put final in front of it  Ex. Final double, final int  Scope o The part of a program that has access to a variable’s contents o The way it lives/where & the way you see it DECISION STRUCTURES  Interactive programs o Written programs that print console output o It is possible to read input from the console  The user types the input into the console  We can capture the input and use it in our program  Input & o We print output using an object named System.out  This object has methods named println and print o We read input using an object named o Constructing a scanner object to read console input  Scanner <name> = new Scanner(;  Scanner Methods o nextInt()  reads integers from the keyboard o nextDouble() reads decimals o next () reads strings o each of these methods pauses your program until the user types input and presses enter  then the value typed is returned to your program o import java.util.*;  If statements o The if statement evaluates a Boolean expression o Decides whether a section of code will be executed or not o If (Boolean expression is true) execute next statement  Ex. Is it cold outside? yes wear a coat  Relational operators o < > >= <= == !=  If-else statement o The if-else statement adds the ability to conditionally execute code when the if condition is false o *also nested if statements (inside a bigger if statements)  if-else-statements o if multiple expressions true execute codes o else if if first part is not true, and this o else if nothing above is true, goes here  Logical operators o Java provides two binary logical operators o AND (&&) o OR(||) o NOT (!)  Order of precedence o ! comes first o * / % o + - o < > <= >= o == != o && o = += -= *= /+ %=  The switch statement o The if-else statement allows you to make true/false branches  Switch statement makes this easier/looks nicer o The switch statement allows you to use an ordinal value to determine how program will branch o The switch statement can evaluate and integer type or character type variable  Switch (SwitchExpression)  The printf method (for formatted printing) o Takes a format string and an argument list o Method to perform formatted console outpout o General format:  System.out.printf(formatString, arglist); EXAMPLE QUESTIONS  Examples o 1. A byte is a collection of:  eight bits o 2. Variables are:  symbolic names made up by the programmer that represents locations in the computer’s RAM o 3. Byte code instructions are:  read and interpreted by the JVM (machine language, after compiling) o 4. A Java program must have at least one of these:  class definition o 5. What would be printed out as a result of the following code? System.out.println (“The quick brown fox” + “jumped over the \n” “slow moving hen”)  which of the following is invalid? o Float y; double z; o Z= 934.21 y=z  cant put a double inside of a float (a double is bigger)  What is the result of the following expression o 10 + 5 *3-20 o order of precedents o 25/4 + 4 * 10 % 3  integer division.  5+4*10%3 = 6+1 = 7  what will the value of z be as a result of executing the code o int x = 5, y = 28 o float z; o z =(float) (y/x); o answer: 5.0


Buy Material

Are you sure you want to buy this material for

50 Karma

Buy Material

BOOM! Enjoy Your Free Notes!

We've added these Notes to your profile, click here to view them now.


You're already Subscribed!

Looks like you've already subscribed to StudySoup, you won't need to purchase another subscription to get this material. To access this material simply click 'View Full Document'

Why people love StudySoup

Steve Martinelli UC Los Angeles

"There's no way I would have passed my Organic Chemistry class this semester without the notes and study guides I got from StudySoup."

Allison Fischer University of Alabama

"I signed up to be an Elite Notetaker with 2 of my sorority sisters this semester. We just posted our notes weekly and were each making over $600 per month. I LOVE StudySoup!"

Jim McGreen Ohio University

"Knowing I can count on the Elite Notetaker in my class allows me to focus on what the professor is saying instead of just scribbling notes the whole time and falling behind."

Parker Thompson 500 Startups

"It's a great way for students to improve their educational experience and it seemed like a product that everybody wants, so all the people participating are winning."

Become an Elite Notetaker and start selling your notes online!

Refund Policy


All subscriptions to StudySoup are paid in full at the time of subscribing. To change your credit card information or to cancel your subscription, go to "Edit Settings". All credit card information will be available there. If you should decide to cancel your subscription, it will continue to be valid until the next payment period, as all payments for the current period were made in advance. For special circumstances, please email


StudySoup has more than 1 million course-specific study resources to help students study smarter. If you’re having trouble finding what you’re looking for, our customer support team can help you find what you need! Feel free to contact them here:

Recurring Subscriptions: If you have canceled your recurring subscription on the day of renewal and have not downloaded any documents, you may request a refund by submitting an email to

Satisfaction Guarantee: If you’re not satisfied with your subscription, you can contact us for further help. Contact must be made within 3 business days of your subscription purchase and your refund request will be subject for review.

Please Note: Refunds can never be provided more than 30 days after the initial purchase date regardless of your activity on the site.