ICS 111 Midterm 1 Review. This class is ICS111 1.True 2.False.

Slides:



Advertisements
Similar presentations
What type of data can a variable hold?
Advertisements

IT 325 OPERATING SYSTEM C programming language. Why use C instead of Java Intermediate-level language:  Low-level features like bit operations  High-level.
CSCI 160 Midterm Review Rasanjalee DM.
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL Adrian Ilie COMP 14 Introduction to Programming Adrian Ilie July 5, 2005.
Copyright 2008 by Pearson Education 1 Building Java Programs Chapter 2 Lecture 2-2: The for Loop reading: 2.3 self-check: exercises: 2-14 videos:
Loops – While, Do, For Repetition Statements Introduction to Arrays
Loops Repeat after me …. Loops A loop is a control structure in which a statement or set of statements execute repeatedly How many times the statements.
1 Data types, operations, and expressions Overview l Format of a Java Application l Primitive Data Types l Variable Declaration l Arithmetic Operations.
COMP 14 Introduction to Programming Miguel A. Otaduy May 20, 2004.
© 2004 Pearson Addison-Wesley. All rights reserved5-1 Iterations/ Loops The while Statement Other Repetition Statements.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter Repetition Statements.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter Chapter 6 Repetition Statements.
ECE122 L9: While loops March 1, 2007 ECE 122 Engineering Problem Solving with Java Lecture 9 While Loops.
Python. What is Python? A programming language we can use to communicate with the computer and solve problems We give the computer instructions that it.
While Loops and Do Loops. Suppose you wanted to repeat the same code over and over again? System.out.println(“text”); System.out.println(“text”); System.out.println(“text”);
Introduction to C++ - How C++ Evolved Most popular languages currently: COBOL, Fortran, C, C++, Java (script) C was developed in 1970s at AT&T (Richie)
Chapter 6 – Repetition Statements : Objectives After you have read and studied this chapter, you should be able to Implement repetition control in a program.
Review Review Review. Concepts Comments: definition, example, different types of comments Class: definition, example Object: definition, example Data.
Basic Java Programming CSCI 392 Week Two. Stuff that is the same as C++ for loops and while loops for (int i=0; i
Java means Coffee Java Coffee Beans The name “JAVA” was taken from a cup of coffee.
Flow Control in Java. Controlling which instruction to execute next Sequential  Similar to walking, one step after another Branching  Similar to a fork.
Hello.java Program Output 1 public class Hello { 2 public static void main( String [] args ) 3 { 4 System.out.println( “Hello!" ); 5 } // end method main.
Chapter 5 Loops.
Using Shortcut Arithmetic Operators Accumulator: A variable that is used to total. Its value is repeatedly increased by some amount. Java provides shortcuts.
Session Three Review & Conditional Control Flow. Java File Hierarchy Projects Packages Classes Methods.
***** SWTJC STEM ***** Chapter 3-1 cg 39 Math Class The Math class provides a convenient way to access higher math functions. The Math class is automatically.
Control Structures II Repetition (Loops). Why Is Repetition Needed? How can you solve the following problem: What is the sum of all the numbers from 1.
Functions. Built-in functions You’ve used several functions already >>> len("ATGGTCA")‏ 7 >>> abs(-6)‏ 6 >>> float("3.1415")‏ >>>
CHAPTER 4 GC 101 Data types. DATA TYPES  For all data, assign a name (identifier) and a data type  Data type tells compiler:  How much memory to allocate.
Flow Control in Java. Controlling which instruction to execute next Sequential  Similar to walking, one step after another Branching  Similar to a fork.
Looping and Counting Lecture 3 Hartmut Kaiser
Repetition Statements while and do while loops
Xin Liu Feb 4, * Use midterm questions for previous 231/217 midterms for practices * ams
1 EMT 101 – Engineering Programming Dr. Farzad Ismail School of Aerospace Engineering Universiti Sains Malaysia Nibong Tebal Pulau Pinang Week 2.
BEGINNING PROGRAMMING.  Literally – giving instructions to a computer so that it does what you want  Practically – using a programming language (such.
CSC 1051 – Data Structures and Algorithms I Dr. Mary-Angela Papalaskari Department of Computing Sciences Villanova University Course website:
JAVA: An Introduction to Problem Solving & Programming, 7 th Ed. By Walter Savitch ISBN © 2015 Pearson Education, Inc., Upper Saddle River,
Introduction to Computing Concepts Note Set 15. JOptionPane.showMessageDialog Message Dialog Allows you to give a brief message to the user Can be used.
School of Computer Science & Information Technology G6DICP - Lecture 4 Variables, data types & decision making.
Programming Kickstart Monday – Friday 10:50am – 12:35pm Chalmers 304 June 17-July 5 (not July 4) 2013 Ms. Paula Evans Jake Saferstein.
Chapter 9 Control Structures.
1 Class Chapter Objectives Use a while loop to repeat a series of statements Get data from user through an input dialog box Add error checking.
Midterm Exam Topics (Prof. Chang's section) CMSC 201.
CMSC 150 LOOPS CS 150: Fri 20 Jan Representing DNA AGTCCAGTGTCAA.
Python Basics  Values, Types, Variables, Expressions  Assignments  I/O  Control Structures.
Chapter 2 Wrap Up 2/18/16 & 2/22/16. Topics Review for Exam I DecimalFormat More Style Conventions Debugging using eclipse The Java API.
1 Flow of Control Chapter 5. 2 Objectives You will be able to: Use the Java "if" statement to control flow of control within your program.  Use the Java.
Sudeshna Sarkar, IIT Kharagpur 1 Programming and Data Structure Sudeshna Sarkar Lecture 3.
Functions with Arguments and Return Values, Oh My! CS303E: Elements of Computers and Programming.
CPSC 233 Tutorial January 21 st /22 nd, Linux Commands.
Chapter 9 Repetition.
CprE 185: Intro to Problem Solving (using C)
Chapter 2 Basic Computation
Chapter 4 Repetition Statements (loops)
Chapter 5: Control Structures II
CiS 260: App Dev I Chapter 4: Control Structures II.
OUTPUT STATEMENTS GC 201.
Chapter 5 Repetition.
For Loops October 12, 2017.
Chapter 4 LOOPS © Bobby Hoggard, Department of Computer Science, East Carolina University / These slides may not be used or duplicated without permission.
Arrays, For loop While loop Do while loop
Outline Altering flow of control Boolean expressions
Chapter 9 Control Structures.
Python programming exercise
CHAPTER 6: Control Flow Tools (for and while loops)
Unit 3: Variables in Java
Building Java Programs
More Strings.
Presentation transcript:

ICS 111 Midterm 1 Review

This class is ICS111 1.True 2.False

Variable names should be descriptive and readable 1.True 2.False

line of Java code “// System.out.println("Hello");” will 1.do nothing 2.cause "Hello" to be output 3.cause a syntax error 4.cause "(Hello)" to be output 5.there is no way to know without executing this line of code

Is this a valid Java identifier? RESULT 1.Yes 2.No 3.Yes but it doesn’t follow the Java coding standards 4.What is an identifier?

Is this a valid Java identifier? black&white 1.Yes 2.No 3.Yes but it doesn’t follow the Java coding standards

The // comment runs to the end of the line only. 1.Yes 2.No

What output is produced by the following statement? System.out.println(“50 plus 25 ” ); 1.50 plus plus There will be an error

What output is produced by the following statement? System.out.println(“50 plus 25 ” + (50+25)); 1.50 plus plus There will be an error

What value is contained in the int variable size after this is executed: size = 18; size = size + 12; size = size/4; 1.This will generate an error

What value is contained in the float variable depth after the following statements are executed? depth = 2.4; depth = 20 – depth; There will be an error

int iResult; int num1 = 25; int num4 = 5; iResult = num1/num4; No idea 

int iResult; int num1 = 25; int num4 = 5; iResult = num4/num1; No idea , again…

float fResult = 0; int num1 = 25; int num4 = 5; fResult = num1/num4; error

float fResult = 0; int num1 = 25; int num4 = 5; fResult = num4/num1; error

float fResult = 0; int num1 = 25; int num4 = 5; fResult = (double)num4/num1 ; error

float fResult = 0; int num1 = 25; int num4 = 5; fResult = (float)num4/num1; error

int num3 = 21; int num4 = 5; int iResult =0; int iResult = num3%num4; error

I like this class. 1.Yes 2.No

I am learning UNIX 1.Yes 2.No

I will recommend my friends to take this class 1.Yes 2.No way Jose 3.I’m waiting for the first midterm exam result.

String s = “Hello World”; s.substring(3); System.out.print(s); //what will be printed? 1.llo World 2.lo World 3.l 4.Hello World

String s = “Hello World”; System.out.print(s.substring(3)); //what will be printed? 1.llo World 2.lo World 3.l 4.I have no clue.

String s = “Hello World”; System.out.print(s.substring(0)); //what will be printed? 1.Hello World 2.elloWord 3.An error will occur 4.I don’t want to think right now.

String s = “Hello World”; System.out.print(s.length( )); //what will be printed? I’m sleeping…zzzz

String s = “Hello World”; System.out.print(s.indexOf(‘a’)); //what will be printed? 1.There will be an error

String s = “Hello World”; System.out.print(s.substring(3,4)); //what will be printed? 1.llo World 2.lo World 3.l 4.Please, stop it!!!

String s = “Hello World”; System.out.print(s.charAt(0)); //what will be printed? 1.H 2.d 3.l 4.There will be an error

String s = “Hello World”; System.out.print(s.charAt(-1)); //what will be printed? 1.H 2.d 3.A blank 4.There will be an error An IndexOutOfBoundsException

We import packages (Java libraries) so that we do not have to re-invent the wheel. 1.True 2.False

When using the DecimalFormat class, using # and using 0 is the same 1.True 2.False

When using the DecimalFormat we can even add units to the numbers that we are formatting 1.True 2.False

Random gen = new Random( ); int num; num = gen.nextInt( ); 1.Will generate a number between 0 and the highest int number. 2.Will generate a number within the whole int range 3.Will generate a number between 0 and 1

Random gen = new Random( ); int num; num = gen.nextInt(20); //will generate a number between: 1.0 and and and and 20 5.Can’t count now. Java is zero based

Random gen = new Random( ); int num; num = gen.nextInt(20)+5; //will generate a number between: 1.5 and and and and and 25

Are you ready for the midterm now? 1.Yes 2.No 3.Just a little bit 4.Now I know that I don’t know. 5.What midterm?