Final Exam. CSC 121 Fall Lecturer: Howard Rosenthal. Dec. 13, 2017
|
|
- Spencer Wood
- 5 years ago
- Views:
Transcription
1 Your Name: Final Exam. CSC 121 Fall 2017 Lecturer: Howard Rosenthal Dec. 13, 2017 The following questions (or parts of questions) in numbers 1-17 are all worth 2 points each. The programs have indicated point values. There are 2 programs to write. There are 114 points on this test which means you can earn up to 14 extra points towards your test average. Remember that only the Command Box and Notepad++ with no other programs available may be open until you are ready to the programs. You are allowed to bring 1 double-sided or 2 single-sided sheets into the test with you. On the last sheets you will find the ASCII character to decimal conversion, and some common String methods. You will also find model code that you can use for input and output from files. You can detach these sheets for easier use. 1. Answer the following as true or false. _T_ a. Objects created from the String class are immutable. _T_ b. double and long variables use the same number of bytes. _F_ c. ( JOHN.equals( John ) ) evaluates as true. _T_ d. (false&&(true false)) always evaluates as false. _T_ e. An object is instantiated from a class. _F_ f. Array indices can be expressed as boolean values since arrays sometimes store boolean values. _F_ g. When an array of String objects is created every cell is initialized to the integer 0. _F_ h. Every method must return a value. _T_ i. ((65 + B ) == ( A + B )) evaluates as true. _T_ j. An if-else block can be nested inside a for loop block. _F_ k. A reference variable for an object is always initialized to null when it is created. 1
2 2. What is the decimal value of ? Write -79 in two s complement using 8 bits flipped bits after adding 1 4. The object-oriented language feature that packages attributes and behaviors into a single unit is called encapsulation 5. Given the following array: int [][] table =1,4,7,9,11, 1,2, 1,2,0, 4,9,8,6,3,16; What is the value of table[3].length? 6 6. In which package is the PrintWriter class found? java.io 7. If String text = MyNameIsAnakin then the value of text.substring(2,7) is _NameI. 8. How many bytes does the following statement reserve for the cells in the array called strarray: String[] strarray = new String[8]; 64 2
3 9. Provide examples of two different ways that methods can be overloaded a. b. public static void mymethod1(int x) public static void mymethod1(double x) public static double mymethod2(int x, int [] xray) public static double mymethod2(int [] xray) 10. The java compiler produces a file with the extension.class that is used as input to the JVM. 11. Write a method header for a method called cointoss with two formal parameters int number and String str that returns a boolean value. public static boolean(int number, String str) 12. The value of ( ABCD.length() + e.length()) is 5. 3
4 13. What is the output of the following code fragment? for ( int i = 6; i < 10; i++ ) for (int j=3; j<=5; j++) System.out.printf( %d, (i%j) ); What is the printout from the following code segment: String growth = ABC ; char letter = d ; for (int i=0; i <4; i++) growth = growth + letter; letter = (char)(letter+2); System.out.printf( %s\n, growth); ABCdfhj 4
5 15. Assume the Random class has been imported and that Random randy = new Random(); Write a statement that randomly selects an integer from 2,3,4,5,6,7,8 and assigns it to the variable int number. You must use the randy object to do this. int number = randy.nextint(7) +2; 16. How many String objects are created by executing the following code fragment? String str1 = Dog ; String str2 = new String ( Dog ); String str3 = Dog ; String str4 = str3; 2 5
6 Programs: It is important to follow the instructions in each problem. two.java files to Do not mail these files until you are done with the entire exam. No second mailing will be allowed. Note: Use the method names I have suggested. The array names and other variables don t need to be the same, although it may make it easier for you as you write your programs. They just made it easier to explain subsequent steps. 1. UpperAlphaCount (24 points) Write a program with two methods. main: (12) Prompts for the number of String(s) to read in. Read in a String using nextline() before entering the loop in order to move to the next line. This simply moves you to the next line so you can start reading in full lines. For each String to be read in: Prompts the user to enter a String that is read into the row corresponding to that iteration of the loop. Hint: use nextline() Passes the String reference to the method countuppercase, and accepts an int returned by countuppercase. Prints the : The String str has num upper case alpha characters. countuppercase: (12) Accepts a reference to a String. Counts the number of upper case alpha characters in the String. (This sentence requires a loop to implement). (Hint: Remember the range for apha upper case letters in ASCII). Return the count of upper case alpha characters. Please enter the number of Strings to test: 5 Please enter a line of text: I am Fine! The String "I am Fine!" has 2 upper case alpha characters. Please enter a line of text: xxx nnn The String "xxx nnn" has 0 upper case alpha characters. Please enter a line of text: I AM FINE. The String "I AM FINE." has 7 upper case alpha characters. Please enter a line of text: UPPER lower UPPer The String "UPPER lower UPPer" has 8 upper case alpha characters. Please enter a line of text: 1234abc The String "1234abc" has 0 upper case alpha characters. 6
7 2. SearchForName (36 Points) Write a program that does the following. Use the model program segments for creating Scanner and PrintWriter objects. Remember that some of the inputs and outputs come directly from the keyboard and to the terminal. main: (13) Calls createarray and accepts as a return value a reference to a one-dimensional String array called namelist with length 100. Prompts for the name of a file with a list of up to 100 names, with only one name on each row. You will need to create a file with one name per row in the same directory that your program is in. You may assume that there are no more than 100 names in the list, and that each name has no more than 9 characters. Sets up a Scanner to read from the input file. If the file doesn t exist there should be a soft exit. Prompts for the name of an output file. Sets up a PrintWriter so that it can write to that output file. Reads in a list of names from the input file into the String array namelist. (Hint: need to keep track of the cell in the array you are writing into within this loop, starting from 0, and the total number of cells that you have read into) Requests a name to search from the user via the terminal. (Use next() instead of nextline() to avoid any problem here) Calls the method called findname with three parameters: - a reference to the String array strarray - a reference to the String with name being searched for - an int parameter with the number of names that have been read into the String array Accepts back from findname a boolean value. Prints out a line to the screen that says: It is true/false that the name is found in the list of names in filename. Finally, main writes the capitalized version of each of the names in the array into the output file, along with its length, with each pair on its own line. A line in the output file might look like this if the input lines were Felix Leonard Then the output file would look like this FELIX 5 LEONARD 7 createarray: (10) Creates a one-dimensional String array of length 100, and return a reference to the array. findname: (13) Accepts three parameters including: - a reference to a one-dimensional String array strarray - a reference to the String with name being searched for - an int parameter with the number of names that have been read into the String array Searches to determine if the name is found in the list of names. Returns true if the name is found on the list, false otherwise. Ignore capitalization when doing your compares, i.e. Elmer and ELmER should be considered a match. 7
8 Please enter name of file to read the names from: names.txt Please enter name of file to write the output list of names to: length.txt Please enter a name to search for: JOSE It is true that he JOSE is in the list of names in names.txt 8
9 9
10 Some or all of these pieces of code may prove helpful. //Required import files when using input and out files import java.util.scanner; import java.io.file; import java.io.printwriter; import java.io.ioexception; public static void main(string[] args) throws IOException //Input File Code Segment System.out.printf("Please enter name of file to encrypt: "); String inputfilename=keyboard.next(); File inputfile = new File(inputFileName); //housekeeping to create target file input scanner if(!inputfile.exists()) System.out.printf("Input File %s was not found.\n", inputfilename); System.exit(0); Scanner inputreader = new Scanner(inputFile); // Output File Code Segment System.out.printf("Please enter name of file to write encryption to: "); String outputfilename=keyboard.next(); File outputfile = new File (outputfilename); //housekeeping to create target file printer PrintWriter outputwriter = new PrintWriter(outputFile); //Possible Structure for reading in data while (inputreader.hasnext()) //You would have to put in code here //For Closing Files inputreader.close(); outputwriter.close(); 10
11 11
12 Common String Methods str.charat(k) str.substring(k) s.substring(k, n) str.indexof(s) str.indexof(s, k) str.startswith(s) str.startswith(s, k) str.equals(s) str.equalsignorecase(s) str.compareto(s) returns a char at position k in str. returns a substring from index k to the end of str returns a substring from index k to index n-1 of str returns an index of the first occurrence of String s in str; an unsuccessful search returns -1. returns an index of String s starting an index k in str; an unsuccessful search returns -1. returns true if str starts with s returns true if str starts with s at index k returns true if the two strings have equal values same as above ignoring case compares two strings s.comparetoignorecase(t) same as above ignoring case s.touppercase() Returns the String with all alpha characters in upper case 12
Final Exam. CSC 121 Fall Lecturer: Howard Rosenthal. Dec. 13, 2017
Your Name: Final Exam. CSC 121 Fall 2017 Lecturer: Howard Rosenthal Dec. 13, 2017 The following questions (or parts of questions) in numbers 1-17 are all worth 2 points each. The programs have indicated
More informationFinal Exam. CSC 121 Spring 2016 TTH. Lecturer: Howard Rosenthal. May 17, 2016
Your Name: Final Exam. CSC 121 Spring 2016 TTH Lecturer: Howard Rosenthal May 17, 2016 The following questions (or parts of questions) in numbers 1-17 are all worth 2 points each. The programs have indicated
More informationFinal Exam. CSC 121 Spring Lecturer: Howard Rosenthal. May 17, 2017
Final Exam. CSC 121 Spring 2017 Lecturer: Howard Rosenthal May 17, 2017 Your Name: Answer Key The following questions (or parts of questions) in numbers 1-17 are all worth 2 points each. The programs have
More informationExam 1 Answer Key CSC 123 Fall 2018 Lecturer: Howard Rosenthal Oct. 17, 2018
Your Name: Exam 1 Answer Key CSC 123 Fall 2018 Lecturer: Howard Rosenthal Oct. 17, 2018 The following questions in numbers 1-11 are all worth 3 points each (including each true and false). The programs
More informationFinal Exam. CSC 121 Fall 2015 TTH. Lecturer: Howard Rosenthal. Dec. 15, 2015
Final Exam. CSC 121 Fall 2015 TTH Lecturer: Howard Rosenthal Dec. 15, 2015 Your Name: Key The following questions (or parts of questions) in numbers 1-17 are all worth 2 points each. The programs have
More informationFinal Exam. CSC 121 Fall 2015 MW. Lecturer: Howard Rosenthal. Dec. 16, 2015
Your Name: Final Exam. CSC 121 Fall 2015 MW Lecturer: Howard Rosenthal Dec. 16, 2015 The following questions (or parts of questions) in numbers 1-17 are all worth 2 points each. The programs have indicated
More informationFile Input and Output Review CSC 123 Fall 2018 Howard Rosenthal
File Input and Output Review CSC 123 Fall 218 Howard Rosenthal Lesson Goals The File Class creating a File object Review FileWriter for appending to files Creating a Scanner object to read from a File
More informationExam 2. CSC 121 MW Class. Lecturer: Howard Rosenthal. April 26, 2017
Your Name: Exam 2. CSC 121 MW Class Lecturer: Howard Rosenthal April 26, 2017 The following questions (or parts of questions) in numbers 1-7 are all worth 3 points each. 1. Answer the following as true
More informationExam 2. CSC 121 MW Class. Lecturer: Howard Rosenthal. April 25, 2016
Your Name: Exam 2. CSC 121 MW Class Lecturer: Howard Rosenthal April 25, 2016 The following questions (or parts of questions) in numbers 1-7 are all worth 3 points each. 1. Answer the following as true
More informationExam 2. CSC 121 TTH Class. Lecturer: Howard Rosenthal. April 26, 2016
Your Name: Exam 2. CSC 121 TTH Class Lecturer: Howard Rosenthal April 26, 2016 The following questions (or parts of questions) in numbers 1-7 are all worth 3 points each. 1. Answer the following as true
More informationObjects and Classes 1: Encapsulation, Strings and Things CSC 121 Fall 2014 Howard Rosenthal
Objects and Classes 1: Encapsulation, Strings and Things CSC 121 Fall 2014 Howard Rosenthal Lesson Goals Understand objects and classes Understand Encapsulation Learn about additional Java classes The
More informationExam 1. CSC 121 Spring Lecturer: Howard Rosenthal. March 1, 2017
Exam 1. CSC 121 Spring 2017 Lecturer: Howard Rosenthal March 1, 2017 Your Name: Key 1. Fill in the following table for the 8 primitive data types. Spell the types exactly correctly. (16 points total) Data
More informationTest 1. CSC 121 Lecture Lecturer: Howard Rosenthal. March 4, 2014
1 Test 1. CSC 121 Lecture 21199 Lecturer: Howard Rosenthal March 4, 2014 Your Name: KEY The following questions (or parts of questions) in numbers 1-16 are all worth 2 points each. 1. Fill in the following
More informationMobile Computing Professor Pushpendra Singh Indraprastha Institute of Information Technology Delhi Java Basics Lecture 02
Mobile Computing Professor Pushpendra Singh Indraprastha Institute of Information Technology Delhi Java Basics Lecture 02 Hello, in this lecture we will learn about some fundamentals concepts of java.
More informationExpressions and Data Types CSC 121 Fall 2015 Howard Rosenthal
Expressions and Data Types CSC 121 Fall 2015 Howard Rosenthal Lesson Goals Understand the basic constructs of a Java Program Understand how to use basic identifiers Understand simple Java data types and
More informationPace University. Fundamental Concepts of CS121 1
Pace University Fundamental Concepts of CS121 1 Dr. Lixin Tao http://csis.pace.edu/~lixin Computer Science Department Pace University October 12, 2005 This document complements my tutorial Introduction
More informationFull file at
Chapter 1 Primitive Java Weiss 4 th Edition Solutions to Exercises (US Version) 1.1 Key Concepts and How To Teach Them This chapter introduces primitive features of Java found in all languages such as
More informationIntroduction to Programming Using Java (98-388)
Introduction to Programming Using Java (98-388) Understand Java fundamentals Describe the use of main in a Java application Signature of main, why it is static; how to consume an instance of your own class;
More informationCSE 1223: Introduction to Computer Programming in Java Chapter 7 File I/O
CSE 1223: Introduction to Computer Programming in Java Chapter 7 File I/O 1 Sending Output to a (Text) File import java.util.scanner; import java.io.*; public class TextFileOutputDemo1 public static void
More informationExpressions and Data Types CSC 121 Spring 2015 Howard Rosenthal
Expressions and Data Types CSC 121 Spring 2015 Howard Rosenthal Lesson Goals Understand the basic constructs of a Java Program Understand how to use basic identifiers Understand simple Java data types
More informationChapter 4: Loops and Files
Chapter 4: Loops and Files Chapter Topics Chapter 4 discusses the following main topics: The Increment and Decrement Operators The while Loop Using the while Loop for Input Validation The do-while Loop
More informationFiles & Exception Handling. CSE 1310 Introduction to Computers and Programming Vassilis Athitsos University of Texas at Arlington
Files & Exception Handling CSE 1310 Introduction to Computers and Programming Vassilis Athitsos University of Texas at Arlington 1 Exception Handling (try catch) Suppose that a line of code may make your
More informationFiles. CSE 1310 Introduction to Computers and Programming Vassilis Athitsos University of Texas at Arlington
Files CSE 1310 Introduction to Computers and Programming Vassilis Athitsos University of Texas at Arlington 1 Files and Text Files A file is a collection of data, that is saved on a hard drive. A text
More informationFiles. CSE 1310 Introduction to Computers and Programming Vassilis Athitsos University of Texas at Arlington
Files CSE 1310 Introduction to Computers and Programming Vassilis Athitsos University of Texas at Arlington 1 Files and Text Files A file is a collection of data, that is saved on a hard drive. A text
More informationArrays and Lists Review CSC 123 Fall 2018 Howard Rosenthal
Arrays and Lists Review CSC 123 Fall 2018 Howard Rosenthal Lesson Goals Review what an array is Review how to declare arrays Review what reference variables are Review how to pass arrays to methods Review
More informationH212 Introduction to Software Systems Honors
Introduction to Software Systems Honors Lecture #04: Fall 2015 1/20 Office hours Monday, Wednesday: 10:15 am to 12:00 noon Tuesday, Thursday: 2:00 to 3:45 pm Office: Lindley Hall, Room 401C 2/20 Printing
More informationDepartment of Computer Science Purdue University, West Lafayette
Department of Computer Science Purdue University, West Lafayette Fall 2011: CS 180 Problem Solving and OO Programming Exam 1 Solutions Q 1 Answer the questions below assuming that binary integers are represented
More informationObject-Oriented Programming in Java
CSCI/CMPE 3326 Object-Oriented Programming in Java Class, object, member field and method, final constant, format specifier, file I/O Dongchul Kim Department of Computer Science University of Texas Rio
More informationSelec%on and Decision Structures in Java: If Statements and Switch Statements CSC 121 Spring 2016 Howard Rosenthal
Selec%on and Decision Structures in Java: If Statements and Switch Statements CSC 121 Spring 2016 Howard Rosenthal Lesson Goals Understand Control Structures Understand how to control the flow of a program
More informationMethods CSC 121 Fall 2016 Howard Rosenthal
Methods CSC 121 Fall 2016 Howard Rosenthal Lesson Goals Understand what a method is in Java Understand Java s Math Class and how to use it Learn the syntax of method construction Learn both void methods
More informationCSC Java Programming, Fall Java Data Types and Control Constructs
CSC 243 - Java Programming, Fall 2016 Java Data Types and Control Constructs Java Types In general, a type is collection of possible values Main categories of Java types: Primitive/built-in Object/Reference
More informationCSCI 136 Written Exam #0 Fundamentals of Computer Science II Spring 2015
CSCI 136 Written Exam #0 Fundamentals of Computer Science II Spring 2015 Name: This exam consists of 6 problems on the following 7 pages. You may use your single-sided handwritten 8 ½ x 11 note sheet during
More informationRecitation: Loop Jul 7, 2008
Nested Loop Recitation: Loop Jul 7, 2008 1. What is the output of the following program? Use pen and paper only. The output is: ****** ***** **** *** ** * 2. Test this program in your computer 3. Use "for
More informationpublic class Q1 { public int x; public static void main(string[] args) { Q1 a = new Q1(17); Q1 b = new Q1(39); public Q1(int x) { this.
CS 201, Fall 2013 Oct 2nd Exam 1 Name: Question 1. [5 points] What output is printed by the following program (which begins on the left and continues on the right)? public class Q1 { public int x; public
More informationCS 61B Discussion 5: Inheritance II Fall 2014
CS 61B Discussion 5: Inheritance II Fall 2014 1 WeirdList Below is a partial solution to the WeirdList problem from homework 3 showing only the most important lines. Part A. Complete the implementation
More informationFile I/O Array Basics For-each loop
File I/O Array Basics For-each loop 178 Recap Use the Java API to look-up classes/method details: Math, Character, String, StringBuffer, Random, etc. The Random class gives us several ways to generate
More informationObjects and Classes 1: Encapsula3on, Strings and Things CSC 121 Fall 2016 Howard Rosenthal
Objects and Classes 1: Encapsula3on, Strings and Things CSC 121 Fall 2016 Howard Rosenthal Lesson Goals Understand objects and classes Understand Encapsulation Learn about additional Java classes The Random
More informationWentworth Institute of Technology. Engineering & Technology WIT COMP1000. File Input and Output
WIT COMP1000 File Input and Output I/O I/O stands for Input/Output So far, we've used a Scanner object based on System.in for all input (from the user's keyboard) and System.out for all output (to the
More informationProgramming with Java
Programming with Java Data Types & Input Statement Lecture 04 First stage Software Engineering Dep. Saman M. Omer 2017-2018 Objectives q By the end of this lecture you should be able to : ü Know rules
More informationMethods CSC 121 Spring 2017 Howard Rosenthal
Methods CSC 121 Spring 2017 Howard Rosenthal Lesson Goals Understand what a method is in Java Understand Java s Math Class and how to use it Learn the syntax of method construction Learn both void methods
More informationRepe$$on CSC 121 Spring 2017 Howard Rosenthal
Repe$$on CSC 121 Spring 2017 Howard Rosenthal Lesson Goals Learn the following three repetition structures in Java, their syntax, their similarities and differences, and how to avoid common errors when
More informationChapter 4: Loops and Files
Chapter 4: Loops and Files Starting Out with Java: From Control Structures through Objects Fifth Edition by Tony Gaddis Chapter Topics Chapter 4 discusses the following main topics: The Increment and Decrement
More informationGive one example where you might wish to use a three dimensional array
CS 110: INTRODUCTION TO COMPUTER SCIENCE SAMPLE TEST 3 TIME ALLOWED: 60 MINUTES Student s Name: MAXIMUM MARK 100 NOTE: Unless otherwise stated, the questions are with reference to the Java Programming
More informationSelec%on and Decision Structures in Java: If Statements and Switch Statements CSC 121 Fall 2016 Howard Rosenthal
Selec%on and Decision Structures in Java: If Statements and Switch Statements CSC 121 Fall 2016 Howard Rosenthal Lesson Goals Understand Control Structures Understand how to control the flow of a program
More informationRepe$$on CSC 121 Fall 2015 Howard Rosenthal
Repe$$on CSC 121 Fall 2015 Howard Rosenthal Lesson Goals Learn the following three repetition methods, their similarities and differences, and how to avoid common errors when using them: while do-while
More informationLesson 3: Accepting User Input and Using Different Methods for Output
Lesson 3: Accepting User Input and Using Different Methods for Output Introduction So far, you have had an overview of the basics in Java. This document will discuss how to put some power in your program
More informationLecture 7. File Processing
Lecture 7 File Processing 1 Data (i.e., numbers and strings) stored in variables, arrays, and objects are temporary. They are lost when the program terminates. To permanently store the data created in
More information2. Each element of an array is accessed by a number known as a(n) a. a. subscript b. size declarator c. address d. specifier
Lesson 4 Arrays and Lists Review CSC 123 Fall 2018 Answer Sheet Short Answers 1. In an array declaration, this indicates the number of elements that the array will have. b a. subscript b. size declarator
More informationArrays and Lists CSC 121 Fall 2014 Howard Rosenthal
Arrays and Lists CSC 121 Fall 2014 Howard Rosenthal Lesson Goals Understand what an array is Understand how to declare arrays Understand what reference variables are Understand how to pass arrays to methods
More informationMidterm Examination (MTA)
M105: Introduction to Programming with Java Midterm Examination (MTA) Spring 2013 / 2014 Question One: [6 marks] Choose the correct answer and write it on the external answer booklet. 1. Compilers and
More informationCIS 1068 Design and Abstraction Spring 2017 Midterm 1a
Spring 2017 Name: TUID: Page Points Score 1 28 2 18 3 12 4 12 5 15 6 15 Total: 100 Instructions The exam is closed book, closed notes. You may not use a calculator, cell phone, etc. i Some API Reminders
More informationQuestion: Total Points: Score:
CS 170 Exam 1 Section 003 Fall 2013 Name (print): Instructions: Keep your eyes on your own paper and do your best to prevent anyone else from seeing your work. Do NOT communicate with anyone other than
More informationText User Interfaces. Keyboard IO plus
Text User Interfaces Keyboard IO plus User Interface and Model Model: objects that solve problem at hand. User interface: interacts with user getting input from user giving output to user reporting on
More informationComputational Expression
Computational Expression Variables, Primitive Data Types, Expressions Janyl Jumadinova 28-30 January, 2019 Janyl Jumadinova Computational Expression 28-30 January, 2019 1 / 17 Variables Variable is a name
More informationCS 101 Fall 2006 Midterm 1 Name: ID:
You only need to write your name and e-mail ID on the first page. This exam is CLOSED text book, closed-notes, closed-calculator, closed-neighbor, etc. Questions are worth different amounts, so be sure
More informationObjects and Classes 1: Encapsula3on, Strings and Things CSC 121 Fall 2015 Howard Rosenthal
Objects and Classes 1: Encapsula3on, Strings and Things CSC 121 Fall 2015 Howard Rosenthal Lesson Goals Understand objects and classes Understand Encapsulation Learn about additional Java classes The Random
More informationArray. Prepared By - Rifat Shahriyar
Java More Details Array 2 Arrays A group of variables containing values that all have the same type Arrays are fixed length entities In Java, arrays are objects, so they are considered reference types
More informationCS 170 Java Programming 1. Week 10: Loops and Arrays
CS 170 Java Programming 1 Week 10: Loops and Arrays What s the Plan? Topic 1: A Little Review Use a counted loop to create graphical objects Write programs that use events and animation Topic 2: Advanced
More informationdata_type variable_name = value; Here value is optional because in java, you can declare the variable first and then later assign the value to it.
Introduction to JAVA JAVA is a programming language which is used in Android App Development. It is class based and object oriented programming whose syntax is influenced by C++. The primary goals of JAVA
More informationExam 1 Prep. Dr. Demetrios Glinos University of Central Florida. COP3330 Object Oriented Programming
Exam 1 Prep Dr. Demetrios Glinos University of Central Florida COP3330 Object Oriented Programming Progress Exam 1 is a Timed Webcourses Quiz You can find it from the "Assignments" link on Webcourses choose
More informationWOSO Source Code (Java)
WOSO 2017 - Source Code (Java) Q 1 - Which of the following is false about String? A. String is immutable. B. String can be created using new operator. C. String is a primary data type. D. None of the
More informationCheck out how to use the random number generator (introduced in section 4.11 of the text) to get a number between 1 and 6 to create the simulation.
Chapter 4 Lab Loops and Files Lab Objectives Be able to convert an algorithm using control structures into Java Be able to write a while loop Be able to write an do-while loop Be able to write a for loop
More informationSection 2.2 Your First Program in Java: Printing a Line of Text
Chapter 2 Introduction to Java Applications Section 2.2 Your First Program in Java: Printing a Line of Text 2.2 Q1: End-of-line comments that should be ignored by the compiler are denoted using a. Two
More informationCS 1331 Exam 1 ANSWER KEY
CS 1331 Exam 1 Fall 2016 ANSWER KEY Failure to properly fill in the information on this page will result in a deduction of up to 5 points from your exam score. Signing signifies you are aware of and in
More informationCOE 212 Engineering Programming. Welcome to Exam II Thursday April 21, Instructors: Dr. Salim Haddad Dr. Joe Tekli Dr. Wissam F.
1 COE 212 Engineering Programming Welcome to Exam II Thursday April 21, 2016 Instructors: Dr. Salim Haddad Dr. Joe Tekli Dr. Wissam F. Fawaz Name: Student ID: Instructions: 1. This exam is Closed Book.
More informationCSE 1223: Exam II Autumn 2016
CSE 1223: Exam II Autumn 2016 Name: Instructions: Do not open the exam before you are told to begin. This exam is closed book, closed notes. You may not use any calculators or any other kind of computing
More informationIntroduction to Java & Fundamental Data Types
Introduction to Java & Fundamental Data Types LECTURER: ATHENA TOUMBOURI How to Create a New Java Project in Eclipse Eclipse is one of the most popular development environments for Java, as it contains
More informationThe ArrayList class CSC 123 Fall 2018 Howard Rosenthal
The ArrayList class CSC 123 Fall 2018 Howard Rosenthal Lesson Goals Describe the ArrayList class Discuss important methods of this class Describe how it can be used in modeling Much of the information
More informationSTUDENT LESSON A12 Iterations
STUDENT LESSON A12 Iterations Java Curriculum for AP Computer Science, Student Lesson A12 1 STUDENT LESSON A12 Iterations INTRODUCTION: Solving problems on a computer very often requires a repetition of
More informationCS Introduction to Programming Midterm Exam #1 - Prof. Reed Fall 2009
CS 102 - Introduction to Programming Midterm Exam #1 - Prof. Reed Fall 2009 What is your name?: There are two sections: I. True/False..................... 60 points; ( 30 questions, 2 points each) II.
More informationBlueJ Demo. Topic 1: Basic Java. 1. Sequencing. Features of Structured Programming Languages
Topic 1: Basic Java Plan: this topic through next Friday (5 lectures) Required reading on web site I will not spell out all the details in lecture! BlueJ Demo BlueJ = Java IDE (Interactive Development
More informationVariables and Assignments CSC 121 Spring 2017 Howard Rosenthal
Variables and Assignments CSC 121 Spring 2017 Howard Rosenthal Lesson Goals Understand variables Understand how to declare and use variables in Java Programs Learn how to formulate assignment statements
More informationCS-201 Introduction to Programming with Java
CS-201 Introduction to Programming with Java California State University, Los Angeles Computer Science Department Lecture X: Methods II Passing Arguments Passing Arguments methods can accept outside information
More informationComputer Science 300 Sample Exam Today s Date 100 points (XX% of final grade) Instructor Name(s) (Family) Last Name: (Given) First Name:
Computer Science 300 Sample Exam Today s Date 100 points (XX% of final grade) Instructor Name(s) (Family) Last Name: (Given) First Name: CS Login Name: NetID (email): @wisc.edu Circle your Lecture: Lec001
More informationSchool of Computer Science CPS109 Course Notes 5 Alexander Ferworn Updated Fall 15
Table of Contents 1 INTRODUCTION... 1 2 IF... 1 2.1 BOOLEAN EXPRESSIONS... 3 2.2 BLOCKS... 3 2.3 IF-ELSE... 4 2.4 NESTING... 5 3 SWITCH (SOMETIMES KNOWN AS CASE )... 6 3.1 A BIT ABOUT BREAK... 7 4 CONDITIONAL
More informationCOMP-202: Foundations of Programming. Lecture 5: Arrays, Reference Type, and Methods Sandeep Manjanna, Summer 2015
COMP-202: Foundations of Programming Lecture 5: Arrays, Reference Type, and Methods Sandeep Manjanna, Summer 2015 Announcements Assignment 2 posted and due on 30 th of May (23:30). Extra class tomorrow
More informationRepetition CSC 121 Fall 2014 Howard Rosenthal
Repetition CSC 121 Fall 2014 Howard Rosenthal Lesson Goals Learn the following three repetition methods, their similarities and differences, and how to avoid common errors when using them: while do-while
More informationFundamentals of Programming Data Types & Methods
Fundamentals of Programming Data Types & Methods By Budditha Hettige Overview Summary (Previous Lesson) Java Data types Default values Variables Input data from keyboard Display results Methods Operators
More informationExpressions and Data Types CSC 121 Spring 2017 Howard Rosenthal
Expressions and Data Types CSC 121 Spring 2017 Howard Rosenthal Lesson Goals Understand the basic constructs of a Java Program Understand how to use basic identifiers Understand simple Java data types
More informationCSCI 136 Written Exam #1 Fundamentals of Computer Science II Spring 2014
CSCI 136 Written Exam #1 Fundamentals of Computer Science II Spring 2014 Name: This exam consists of 5 problems on the following 6 pages. You may use your double- sided hand- written 8 ½ x 11 note sheet
More informationChapter 3. Selections
Chapter 3 Selections 1 Outline 1. Flow of Control 2. Conditional Statements 3. The if Statement 4. The if-else Statement 5. The Conditional operator 6. The Switch Statement 7. Useful Hints 2 1. Flow of
More informationCOMP 250: Java Programming I. Carlos G. Oliver, Jérôme Waldispühl January 17-18, 2018 Slides adapted from M. Blanchette
COMP 250: Java Programming I Carlos G. Oliver, Jérôme Waldispühl January 17-18, 2018 Slides adapted from M. Blanchette Variables and types [Downey Ch 2] Variable: temporary storage location in memory.
More informationtoday cs3157-fall2002-sklar-lect05 1
today homework #1 due on monday sep 23, 6am some miscellaneous topics: logical operators random numbers character handling functions FILE I/O strings arrays pointers cs3157-fall2002-sklar-lect05 1 logical
More informationCMSC 150 INTRODUCTION TO COMPUTING LAB WEEK 3 STANDARD IO FORMATTING OUTPUT SCANNER REDIRECTING
CMSC 150 INTRODUCTION TO COMPUTING LAB WEEK 3 STANDARD IO FORMATTING OUTPUT SCANNER REDIRECTING INPUT AND OUTPUT Input devices Keyboard Mouse Hard drive Network Digital camera Microphone Output devices.
More informationCS 102 / CS Introduction to Programming Midterm Exam #1 - Prof. Reed Fall 2010
CS 102 / CS 107 - Introduction to Programming Midterm Exam #1 - Prof. Reed Fall 2010 What is your name?: There are two sections: I. True/False..................... 60 points; ( 30 questions, 2 points each)
More informationReview Chapter 6 in Bravaco. Short Answers 1. This type of method does not return a value. a. null b. void c. empty d. anonymous
Assignment 3 Methods Review CSC 123 Fall 2018 Notes: All homework must be submitted via e-mail. All parts of assignment must be submitted in a single e-mail with multiple attachments when required. Notes:
More informationProject 1. Java Data types and input/output 1/17/2014. Primitive data types (2) Primitive data types in Java
Java Data types and input/output Sharma Chakravarthy Information Technology Laboratory (IT Lab) Computer Science and Engineering Department The University of Texas at Arlington, Arlington, TX 76019 Email:
More informationCS61BL. Lecture 1: Welcome to CS61BL! Intro to Java and OOP Testing Error-handling
CS61BL Lecture 1: Welcome to CS61BL! Intro to Java and OOP Testing Error-handling About me Name: Edwin Liao Email: edliao@berkeley.edu Office hours: Thursday 3pm - 5pm Friday 11am - 1pm 611 Soda Or by
More informationArrays and Lists CSC 121 Fall 2016 Howard Rosenthal
Arrays and Lists CSC 121 Fall 2016 Howard Rosenthal Lesson Goals Understand what an array is Understand how to declare arrays Understand what reference variables are Understand how to pass arrays to methods
More informationF1 A Java program. Ch 1 in PPIJ. Introduction to the course. The computer and its workings The algorithm concept
F1 A Java program Ch 1 in PPIJ Introduction to the course The computer and its workings The algorithm concept The structure of a Java program Classes and methods Variables Program statements Comments Naming
More informationJava Identifiers, Data Types & Variables
Java Identifiers, Data Types & Variables 1. Java Identifiers: Identifiers are name given to a class, variable or a method. public class TestingShastra { //TestingShastra is an identifier for class char
More informationNew York University Intro to Computer Science (CSCI-UA.101) Fall 2014 Midterm #1 Test G. Instructions:
NAME: New York University Intro to Computer Science (CSCI-UA.101) Fall 2014 Midterm #1 Test G Instructions: KEEP TEST BOOKLET CLOSED UNTIL YOU ARE INSTRUCTED TO BEGIN. Omit one page from this exam. To
More informationYou will not be tested on JUnit or the Eclipse debugger. The exam does not cover interfaces.
Com S 227 Fall 2016 Topics and review problems for Exam 2 Thursday, November 10, 6:45 pm Locations, by last name: (same locations as Exam 1) A-C Curtiss 0127, first floor only D-N Hoover 2055 O-Z Troxel
More informationBinghamton University. CS-140 Fall Data Types in Java
Data Types in Java 1 CS-211 2015 Example Class: Car How Cars are Described Make Model Year Color Owner Location Mileage Actions that can be applied to cars Create a new car Transfer ownership Move to a
More informationInput. Scanner keyboard = new Scanner(System.in); String name;
Reading Resource Input Read chapter 4 (Variables and Constants) in the textbook A Guide to Programming in Java, pages 77 to 82. Key Concepts A stream is a data channel to or from the operating system.
More informationCS11 Java. Fall Lecture 1
CS11 Java Fall 2006-2007 Lecture 1 Welcome! 8 Lectures Slides posted on CS11 website http://www.cs.caltech.edu/courses/cs11 7-8 Lab Assignments Made available on Mondays Due one week later Monday, 12 noon
More information1 If you want to store a letter grade (like a course grade) which variable type would you use? a. int b. String c. char d. boolean
Practice Final Quiz 1 If you want to store a letter grade (like a course grade) which variable type would you use? a. int b. String c. char d. boolean 2 If you wanted to divide two numbers precisely, which
More informationAgenda CS121/IS223. Reminder. Object Declaration, Creation, Assignment. What is Going On? Variables in Java
CS121/IS223 Object Reference Variables Dr Olly Gotel ogotel@pace.edu http://csis.pace.edu/~ogotel Having problems? -- Come see me or call me in my office hours -- Use the CSIS programming tutors Agenda
More informationChief Reader Report on Student Responses:
Chief Reader Report on Student Responses: 2017 AP Computer Science A Free-Response Questions Number of Students Scored 60,519 Number of Readers 308 Score Distribution Exam Score N %At Global Mean 3.15
More information3. Convert 2E from hexadecimal to decimal. 4. Convert from binary to hexadecimal
APCS A Midterm Review You will have a copy of the one page Java Quick Reference sheet. This is the same reference that will be available to you when you take the AP Computer Science exam. 1. n bits can
More information