Possible Exam Questions

Size: px
Start display at page:

Download "Possible Exam Questions"

Transcription

1 Name: Class: Date: Here are all the questions from all your previous tests. Your exam will be made up of some of these questions. Use these to study from. Remember - all the answers are contained in your textbook. Possible Exam Questions True/False Indicate whether the sentence or statement is true or false. 1. An overflow error occurs when there are not enough bits to hold the mantissa. 2. Ergonomics is the science that studies copyright infringement. 3. The physical components of the computer are called software. 4. A multiuser OS allows for more than one user at the same time. 5. Cross-platform connectivity is the ability for one PC to use more than one input device. 6. WANs are used to connect devices over large geographical distances. 7. The largest and most widely accessed network is the Internet. 8. Outlook is an example of software. 9. A citation gives credit to the original author. 10. The illegal copying of software is called piracy. 11. The equal sign operator is used to assign a new value to a variable. 12. Values represented by the double data type are referred to as floating point. 13. The statement numplayers += 2; is the same as numplayers = numplayers + 2; 14. A run-time error is also called a syntax error. 15. The statement system.out.println("hello world!"); will generate a syntax error. 16. A run-time error halts program execution at the statement that cannot be executed. 17. The condition of an if statement is a Boolean expression. 18. A set of statements that perform a task over and over again based on a condition is called a loop structure. 19. Each execution of a loop is called an iteration. 20. The ++ operator is used in a for statement to automatically increment a counter by 2 during each loop iteration. 21. A method must include parameters. 22. Data passed to a method is called a parameter. 23. The return type void means that the method will return a value. 24. A method declaration contains the statements that implement the method. 25. Multiple parameters are separated by semicolons. 1

2 Name: 26. The order of the arguments passed to a procedure need to correspond to the order of the parameters declared in the procedure. 27. The number of arguments in a method call must match the number of parameters in the method declaration. 28. A method can return a value. 29. The return statement is used to send a value back to the calling statement. 30. Method overloading means that an application contains more than 10 methods. 31. Files are used to store the data generated by an application. 32. An exception is an error affecting execution. 33. The try statements are statements that could possibly generate an exception. 34. The file stream keeps track of the file position. 35. The end of file is indicated by A file on disk is a set of characters, even if the file contains numeric data. 37. Numeric data from a file must be converted to int or double values before it can processed. 38. A BufferedWriter class object is used to send text to the input file stream. 39. Writing objects to a file is called object deserialization. 40. The ObjectOutputStream class contains methods for writing primitive data types. Multiple Choice Identify the letter of the choice that best completes the statement or answers the question. 41. Which processes data and controls the flow of data between the computer s other units? a. CPU c. ROM b. USB d. SRAM 42. SRAM (Static Access RAM) is also referred to as a. ROM. c. cache. b. integrated circuits. d. clock rate. 43. Operating system software a. is a combination of hardware and software that works together to allow computers to exchange data. b. is network security hardware that prevents unauthorized network access. c. is software that enables the user to communicate with the computer. d. is a series of related web pages. 44. In which type of network topology is each node attached to a hub? a. bus topology c. ring topology b. star topology d. client topology 45. How many states do the electrical circuits on an IC (integrated circuit) have? a. one: on c. four: + - * / b. two: on, off d. three: on, off, wait 2

3 Name: 46. Which prevents unauthorized network access? a. a hub c. a firewall b. a router d. a cookie 47. An ISDN is a a. cable modem. c. subscriber line. b. conventional modem. d. digital telephone network. 48. Which programming language is considered a third generation programming language (3GL)? a. machine language c. SQL b. assembly language d. C 49. Which programming language is considered an object-oriented language? a. Fortran c. SQL b. Java d. C 50. Computer memory capacity and file size are measured in a. bytes. c. nanoseconds. b. inches. d. codes. 51. Which of the following represent correctly-formed comments? I. // Happy II. /* Sorry /* III. /* Wise */ a. I only c. I and III only b. I and II only d. III only 52. Which is a valid declaration statement? a. int height int width; c. int height; width; b. int height, width; d. int height, int width; 53. Which statement assigns the value 15 to radius? a. radius = 15; c. 15 = radius; b. radius == 15; d. 15radius; 54. What is the result of the following expression when x is 125? x%6 a. 0 c. 20 b. 5 d What happens to the decimal portion of a number when a double is cast to an int? a. The decimal portion is truncated. c. Nothing, a syntax error occurs. b. The decimal portion is rounded. d. The value 0.5 is added to the number. 56. Which type of error occurs in statements that are syntactically correct, but produce undesired or unexpected results? a. syntax error c. run-time error b. semantic error d. exception error 3

4 Name: 57. Which code segment displays the circle area when the radius is a positive value? a. if (radius!=0) { System.out.println("The area is: " + radius * radius * Math.PI); b. if (radius>=0) { System.out.println("The area is: " + radius * radius * Math.PI); c. if (radius>0) { System.out.println("The area is: " + radius * radius * Math.PI); d. if (radius==0) { System.out.println("The area is: " + radius * radius * Math.PI); 58. Which will be displayed when the code segment below is run? double grosspay = ; if (grosspay > 3000) { System.out.println("Your tax rate is 33%"); else if (grosspay > 4000) { System.out.println("Your tax rate is 35%"); a. Your tax rate is 33% b. Your tax rate is 35% c. Your tax rate is 33% Your tax rate is 35% d. A run-time error will be generated. 59. Given the following code segment: int x = 0; for (int i = 0; i < 8; i++) { x += i; System.out.println(x); Which will be displayed when the code segment is run? a. 7 c. 9 b. 8 d Given the following code segment: String lastname = "Watson"; int namelength; namelength = lastname.length(); What is the value of namelength after the statements execute? a. 5 c. 8 b. 6 d. Watson 4

5 Name: 61. A problem-solving approach that breaks tasks into smaller subtasks is called a. bottom-up development. c. top-down development. b. task division development. d. procedural development. 62. A method is executed when it is a. typed. c. declared. b. called. d. named. 63. Which keyword is an access modifier? a. static c. public b. void d. call 64. Which statement calls the method inchestocentimeters()? a. call inchestocentimeters; b. inchestocentimeters(call); c. inchestocentimeters(); d. execute inchestocentimeters(); 65. How many arguments are passed in the statement checkguess(i, valitem)? a. 1 c. 3 b. 2 d How many parameters are declared in the statement public static void checkguess(int length, int width)? a. 1 c. 3 b. 2 d (Application) Given the following code segment: public static void prob(int x, int y) { System.out.print(x + " "); if (x <= y) { System.out.println(x + y); Which will be displayed when prob(6, 7) is called? a. 6 7 c. x + 7 b. x + 6 d The arguments in a method call must a. correspond in order to the parameters in the method being called. b. have the same names as the corresponding parameters in the method being called. c. be variables. d. be integers. 69. When more than one method of the same name is included in a class, it is referred to as method a. passing. c. overloading. b. duplicating. d. voiding. 5

6 Name: 70. (Application) Given the following application: public class Calculation { public static int linelength(int x, int y) { int length; length = x * y; return length; public static int linelength(int x) { int length; length = x * x; return length; public static void main(string[] args) { System.out.println(lineLength(5)); Which will be displayed when the application is run? a. 5 c. 25 b. 10 d. A syntax error will be generated. 71. (Application) Given the following application: public class Comparison { public static double maxnum(int num1, int num2) { if (num1 > num2) { return num1; else { return (num2); public static double maxnum(int value1, int value2) { if (value1 > value2) { return value1; else { return (value2); public static void main(string[] args) { System.out.println(maxNum(1, 2)); Which will be displayed when the application is run? a. 1 c. 2.0 b. 2 d. A syntax error will be generated. 6

7 Name: 72. (Application) Given the following code segment: public static int prob2(int x, int y) { y += x * 2; return(y); public static void main(string[] args) { int j = 6, k = 4; j = prob2(j, k); System.out.println(j); Which will be displayed after the code executes? a. 4 6 c. 16 b. 12 d How many values can a return statement return? a. 0 c. 3 b. 1 d. An unlimited number. 74. A statement of what must be true at the end of the execution of a procedure is called a(n) a. precondition. c. ending comment. b. postcondition. d. procedure condition. 75. Which statement is required to access the File class? a. import java.io.* c. import java.awt.* b. import java.util.* d. import java.lang.* 76. Which is the error in the statement, File textfile = new File("c:\MyDocuments\data.txt");? a. The file path does not have to be in quotes ("). b. The words new File are not necessary. c. Escape sequences need to separate the drive, folder, and file names (\\). d. There is no error in the statement. 77. Which is a block of code that performs an action when an exception occurs? a. throw stream c. exception handler b. err stream d. action handler 7

8 Name: 78. Given the following code segment: File textfile = new File("c:\\inventory.txt"); if (textfile.exists()) { System.out.println("The file already exists."); else { try { textfile.createnewfile(); System.out.println("The file was created."); catch (IOException e) { System.out.println("The file could not be created."); System.err.println("IOException: " + e.getmessage()); Which is the statement that could possibly generate an exception in the try-catch-finally statement? a. textfile.exists() b. System.err.println("IOException: " + e.getmessage()); c. IOException d. textfile.createnewfile(); 79. Which class is used to create an input file stream? a. BufferedReader c. FileWriter b. FileReader d. BufferedWriter 80. Which class is used to create an output file stream? a. BufferedReader c. FileWriter b. FileReader d. BufferedWriter 81. Given the following statement: File datafile = new File("inventory.dat"); Which will occur if there is an existing inventory.dat file? a. An IOException will be thrown. b. An inventory1.dat file will be created. c. The existing file will automatically be overwritten. d. A prompt will appear asking if the file should be overwritten. 82. Given the following statement: File datafile = new File("inventory.dat"); Which will occur if inventory.data does not exist? a. An IOException will be thrown. b. A new inventory.dat file will be created. c. The existing file will automatically be overwritten. d. A prompt will appear asking if the file should be overwritten. Completion Complete each sentence or statement. 83. Errors that violate the rules of Java are called errors. 8

9 Name: 84. A is a collection of related data stored on a persistent medium. 85. File streams are used to perform file access, with all the reading and writing performed one character after another or one line after another. Short Answer 86. (1 mark) What does HTML stand for? 87. (1 mark) What does CSS stand for? 88. (4 marks) List some rules typically found on an Acceptable Use Policy. 89. (5 marks Application) Sketch a flowchart for the following program description: The Information application displays your name on a separate line, your school on a separate line, and your current school classes on the same line, separated by a tab. 90. (5 marks Application) Identify five errors in the following application: /* * InternetRules.java /* package studentrules /** * Displays student rules for accessing the Internet. */ public class InternetRules public static void main(string[] args) { System.out.println("Internet Rules\n"); System.out.println("1. Use school issued login and password."); System.out.println("2. Do not download any files.") system.out.println("3. Do not reveal personal information."); 91. (2 Marks - Communication) Write an appropriate decision statement to display You move to the next level. when the value of points is 150 or higher. 92. (8 marks - communication) Complete the following: a) Write an algorithm for obtaining a gross pay amount from the user and then determining an appropriate tax bracket amount based on the gross pay entered. If the gross pay is less than $700, the tax rate is 26%, if the gross pay is between $700 and $1,200 inclusive, the tax rate is 33%, and if the gross pay is greater than $1,200, the tax rate is 36%. b) Write the pseudocode for the algorithm developed in part (a). 93. (Communication 4 marks)list two naming conventions for method names. 9

10 Name: 94. (Application) (2 marks)write a statement to call a method named checkvalue() that has two int parameters named firstnum and secondnum. 95. (Communication 6 marks) Write the method declaration for a public class method named calculateaverage() that has double parameters firstnum, secondnum, thirdnum and returns a double value. 96. (Application) (4 marks) Write a productinventory() method that calculates the total number of products available in four store locations and returns the total. The productinventory() method should contain int store1, store2, store3, and store4 parameters and return an int value. 97. (2 marks Application) List two examples of a persistent medium. 98. (2 marks Communication & Application) Explain why should an exception handler should be used in an application? 99. (2 marks Communication & Application) Explain how the FileReader and BufferedReader classes work together to read the contents of an existing file? Essay 100. (4 MARKS) Describe the ethical and system reliability responsibilities associated with being an IT professional. 10

Java Foundations: Introduction to Program Design & Data Structures, 4e John Lewis, Peter DePasquale, Joseph Chase Test Bank: Chapter 2

Java Foundations: Introduction to Program Design & Data Structures, 4e John Lewis, Peter DePasquale, Joseph Chase Test Bank: Chapter 2 Java Foundations Introduction to Program Design and Data Structures 4th Edition Lewis TEST BANK Full download at : https://testbankreal.com/download/java-foundations-introduction-toprogram-design-and-data-structures-4th-edition-lewis-test-bank/

More information

Tools : The Java Compiler. The Java Interpreter. The Java Debugger

Tools : The Java Compiler. The Java Interpreter. The Java Debugger Tools : The Java Compiler javac [ options ] filename.java... -depend: Causes recompilation of class files on which the source files given as command line arguments recursively depend. -O: Optimizes code,

More information

CS 1063 Introduction to Computer Programming Midterm Exam 2 Section 1 Sample Exam

CS 1063 Introduction to Computer Programming Midterm Exam 2 Section 1 Sample Exam Seat Number Name CS 1063 Introduction to Computer Programming Midterm Exam 2 Section 1 Sample Exam This is a closed book exam. Answer all of the questions on the question paper in the space provided. If

More information

McGill University School of Computer Science COMP-202A Introduction to Computing 1

McGill University School of Computer Science COMP-202A Introduction to Computing 1 McGill University School of Computer Science COMP-202A Introduction to Computing 1 Midterm Exam Thursday, October 26, 2006, 18:00-20:00 (6:00 8:00 PM) Instructors: Mathieu Petitpas, Shah Asaduzzaman, Sherif

More information

PROGRAMMING FUNDAMENTALS

PROGRAMMING FUNDAMENTALS PROGRAMMING FUNDAMENTALS Q1. Name any two Object Oriented Programming languages? Q2. Why is java called a platform independent language? Q3. Elaborate the java Compilation process. Q4. Why do we write

More information

SECONDARY SCHOOL, L-IMRIEĦEL HALF YEARLY EXAMINATIONS 2016/2017

SECONDARY SCHOOL, L-IMRIEĦEL HALF YEARLY EXAMINATIONS 2016/2017 SECONDARY SCHOOL, L-IMRIEĦEL HALF YEARLY EXAMINATIONS 2016/2017 YEAR: 10 Computing Time: 1½ Hr. Name: Class: Instructions: 1. Answer all the questions in the space provided on this paper. 2. Calculators

More information

JAVA Ch. 4. Variables and Constants Lawrenceville Press

JAVA Ch. 4. Variables and Constants Lawrenceville Press JAVA Ch. 4 Variables and Constants Slide 1 Slide 2 Warm up/introduction int A = 13; int B = 23; int C; C = A+B; System.out.print( The answer is +C); Slide 3 Declaring and using variables Slide 4 Declaring

More information

Object-Oriented Programming

Object-Oriented Programming Object-Oriented Programming Java Syntax Program Structure Variables and basic data types. Industry standard naming conventions. Java syntax and coding conventions If Then Else Case statements Looping (for,

More information

Chapter 2. Elementary Programming

Chapter 2. Elementary Programming Chapter 2 Elementary Programming 1 Objectives To write Java programs to perform simple calculations To obtain input from the console using the Scanner class To use identifiers to name variables, constants,

More information

Data and Variables. Data Types Expressions. String Concatenation Variables Declaration Assignment Shorthand operators. Operators Precedence

Data and Variables. Data Types Expressions. String Concatenation Variables Declaration Assignment Shorthand operators. Operators Precedence Data and Variables Data Types Expressions Operators Precedence String Concatenation Variables Declaration Assignment Shorthand operators Review class All code in a java file is written in a class public

More information

Primitive Data, Variables, and Expressions; Simple Conditional Execution

Primitive Data, Variables, and Expressions; Simple Conditional Execution Unit 2, Part 1 Primitive Data, Variables, and Expressions; Simple Conditional Execution Computer Science S-111 Harvard University David G. Sullivan, Ph.D. Overview of the Programming Process Analysis/Specification

More information

Zheng-Liang Lu Java Programming 45 / 79

Zheng-Liang Lu Java Programming 45 / 79 1 class Lecture2 { 2 3 "Elementray Programming" 4 5 } 6 7 / References 8 [1] Ch. 2 in YDL 9 [2] Ch. 2 and 3 in Sharan 10 [3] Ch. 2 in HS 11 / Zheng-Liang Lu Java Programming 45 / 79 Example Given a radius

More information

Course Outline. Introduction to java

Course Outline. Introduction to java Course Outline 1. Introduction to OO programming 2. Language Basics Syntax and Semantics 3. Algorithms, stepwise refinements. 4. Quiz/Assignment ( 5. Repetitions (for loops) 6. Writing simple classes 7.

More information

Data Types and the while Statement

Data Types and the while Statement Session 2 Student Name Other Identification Data Types and the while Statement In this laboratory you will: 1. Learn about three of the primitive data types in Java, int, double, char. 2. Learn about the

More information

Darrell Bethea May 25, 2011

Darrell Bethea May 25, 2011 Darrell Bethea May 25, 2011 Yesterdays slides updated Midterm on tomorrow in SN014 Closed books, no notes, no computer Program 3 due Tuesday 2 3 A whirlwind tour of almost everything we have covered so

More information

Pace University. Fundamental Concepts of CS121 1

Pace 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 information

Outline. Parts 1 to 3 introduce and sketch out the ideas of OOP. Part 5 deals with these ideas in closer detail.

Outline. Parts 1 to 3 introduce and sketch out the ideas of OOP. Part 5 deals with these ideas in closer detail. OOP in Java 1 Outline 1. Getting started, primitive data types and control structures 2. Classes and objects 3. Extending classes 4. Using some standard packages 5. OOP revisited Parts 1 to 3 introduce

More information

CS 231 Data Structures and Algorithms, Fall 2016

CS 231 Data Structures and Algorithms, Fall 2016 CS 231 Data Structures and Algorithms, Fall 2016 Dr. Bruce A. Maxwell Department of Computer Science Colby College Course Description Focuses on the common structures used to store data and the standard

More information

Introduction to Java Applications

Introduction to Java Applications 2 Introduction to Java Applications OBJECTIVES In this chapter you will learn: To write simple Java applications. To use input and output statements. Java s primitive types. Basic memory concepts. To use

More information

false, import, new 1 class Lecture2 { 2 3 "Data types, Variables, and Operators" 4

false, import, new 1 class Lecture2 { 2 3 Data types, Variables, and Operators 4 1 class Lecture2 { 2 3 "Data types, Variables, and Operators" 4 5 } 6 7 // Keywords: 8 byte, short, int, long, char, float, double, boolean, true, false, import, new Zheng-Liang Lu Java Programming 44

More information

Simple Java Reference

Simple Java Reference Simple Java Reference This document provides a reference to all the Java syntax used in the Computational Methods course. 1 Compiling and running... 2 2 The main() method... 3 3 Primitive variable types...

More information

false, import, new 1 class Lecture2 { 2 3 "Data types, Variables, and Operators" 4

false, import, new 1 class Lecture2 { 2 3 Data types, Variables, and Operators 4 1 class Lecture2 { 2 3 "Data types, Variables, and Operators" 4 5 } 6 7 // Keywords: 8 byte, short, int, long, char, float, double, boolean, true, false, import, new Zheng-Liang Lu Java Programming 44

More information

( &% class MyClass { }

( &% class MyClass { } Recall! $! "" # ' ' )' %&! ( &% class MyClass { $ Individual things that differentiate one object from another Determine the appearance, state or qualities of objects Represents any variables needed for

More information

CS5000: Foundations of Programming. Mingon Kang, PhD Computer Science, Kennesaw State University

CS5000: Foundations of Programming. Mingon Kang, PhD Computer Science, Kennesaw State University CS5000: Foundations of Programming Mingon Kang, PhD Computer Science, Kennesaw State University Overview of Source Code Components Comments Library declaration Classes Functions Variables Comments Can

More information

Chapter 2: Basic Elements of Java

Chapter 2: Basic Elements of Java Chapter 2: Basic Elements of Java TRUE/FALSE 1. The pair of characters // is used for single line comments. ANS: T PTS: 1 REF: 29 2. The == characters are a special symbol in Java. ANS: T PTS: 1 REF: 30

More information

Lecture 2. COMP1406/1006 (the Java course) Fall M. Jason Hinek Carleton University

Lecture 2. COMP1406/1006 (the Java course) Fall M. Jason Hinek Carleton University Lecture 2 COMP1406/1006 (the Java course) Fall 2013 M. Jason Hinek Carleton University today s agenda a quick look back (last Thursday) assignment 0 is posted and is due this Friday at 2pm Java compiling

More information

I pledge by honor that I will not discuss this exam with anyone until my instructor reviews the exam in the class.

I pledge by honor that I will not discuss this exam with anyone until my instructor reviews the exam in the class. Name: Covers Chapters 1-3 50 mins CSCI 1301 Introduction to Programming Armstrong Atlantic State University Instructor: Dr. Y. Daniel Liang I pledge by honor that I will not discuss this exam with anyone

More information

Lecture 2: Variables and Operators. AITI Nigeria Summer 2012 University of Lagos.

Lecture 2: Variables and Operators. AITI Nigeria Summer 2012 University of Lagos. Lecture 2: Variables and Operators AITI Nigeria Summer 2012 University of Lagos. Agenda Variables Types Naming Assignment Data Types Type casting Operators Declaring Variables in Java type name; Variables

More information

Midterm I - CSE11 Fall 2013 CLOSED BOOK, CLOSED NOTES 50 minutes, 100 points Total.

Midterm I - CSE11 Fall 2013 CLOSED BOOK, CLOSED NOTES 50 minutes, 100 points Total. Midterm I - CSE11 Fall 2013 CLOSED BOOK, CLOSED NOTES 50 minutes, 100 points Total. Name: ID: Problem 1) (8 points) For the following code segment, what are the values of i, j, k, and d, after the segment

More information

Lab 9: Creating a Reusable Class

Lab 9: Creating a Reusable Class Lab 9: Creating a Reusable Class Objective This will introduce the student to creating custom, reusable classes This will introduce the student to using the custom, reusable class This will reinforce programming

More information

Outline. Overview. Control statements. Classes and methods. history and advantage how to: program, compile and execute 8 data types 3 types of errors

Outline. Overview. Control statements. Classes and methods. history and advantage how to: program, compile and execute 8 data types 3 types of errors Outline Overview history and advantage how to: program, compile and execute 8 data types 3 types of errors Control statements Selection and repetition statements Classes and methods methods... 2 Oak A

More information

false, import, new 1 class Lecture2 { 2 3 "Data types, Variables, and Operators" 4

false, import, new 1 class Lecture2 { 2 3 Data types, Variables, and Operators 4 1 class Lecture2 { 2 3 "Data types, Variables, and Operators" 4 5 } 6 7 // Keywords: 8 byte, short, int, long, char, float, double, boolean, true, false, import, new Zheng-Liang Lu Java Programming 44

More information

CS 106 Introduction to Computer Science I

CS 106 Introduction to Computer Science I CS 106 Introduction to Computer Science I 05 / 31 / 2017 Instructor: Michael Eckmann Today s Topics Questions / Comments? recap and some more details about variables, and if / else statements do lab work

More information

Computer Components. Software{ User Programs. Operating System. Hardware

Computer Components. Software{ User Programs. Operating System. Hardware Computer Components Software{ User Programs Operating System Hardware What are Programs? Programs provide instructions for computers Similar to giving directions to a person who is trying to get from point

More information

1 class Lecture2 { 2 3 "Elementray Programming" / References 8 [1] Ch. 2 in YDL 9 [2] Ch. 2 and 3 in Sharan 10 [3] Ch.

1 class Lecture2 { 2 3 Elementray Programming / References 8 [1] Ch. 2 in YDL 9 [2] Ch. 2 and 3 in Sharan 10 [3] Ch. 1 class Lecture2 { 2 3 "Elementray Programming" 4 5 } 6 7 / References 8 [1] Ch. 2 in YDL 9 [2] Ch. 2 and 3 in Sharan 10 [3] Ch. 2 in HS 11 / Zheng-Liang Lu Java Programming 41 / 68 Example Given the radius

More information

1 Introduction Java, the beginning Java Virtual Machine A First Program BlueJ Raspberry Pi...

1 Introduction Java, the beginning Java Virtual Machine A First Program BlueJ Raspberry Pi... Contents 1 Introduction 3 1.1 Java, the beginning.......................... 3 1.2 Java Virtual Machine........................ 4 1.3 A First Program........................... 4 1.4 BlueJ.................................

More information

WOSO Source Code (Java)

WOSO 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 information

Full file at

Full file at Java Programming: From Problem Analysis to Program Design, 3 rd Edition 2-1 Chapter 2 Basic Elements of Java At a Glance Instructor s Manual Table of Contents Overview Objectives s Quick Quizzes Class

More information

Chapter 2: Using Data

Chapter 2: Using Data Chapter 2: Using Data TRUE/FALSE 1. A variable can hold more than one value at a time. F PTS: 1 REF: 52 2. The legal integer values are -2 31 through 2 31-1. These are the highest and lowest values that

More information

IT101. File Input and Output

IT101. File Input and Output IT101 File Input and Output IO Streams A stream is a communication channel that a program has with the outside world. It is used to transfer data items in succession. An Input/Output (I/O) Stream represents

More information

F I N A L E X A M I N A T I O N

F I N A L E X A M I N A T I O N Faculty Of Computer Studies M257 Putting Java to Work F I N A L E X A M I N A T I O N Number of Exam Pages: (including this cover sheet( Spring 2011 April 4, 2011 ( 5 ) Time Allowed: ( 1.5 ) Hours Student

More information

An overview of Java, Data types and variables

An overview of Java, Data types and variables An overview of Java, Data types and variables Lecture 2 from (UNIT IV) Prepared by Mrs. K.M. Sanghavi 1 2 Hello World // HelloWorld.java: Hello World program import java.lang.*; class HelloWorld { public

More information

Accelerating Information Technology Innovation

Accelerating Information Technology Innovation Accelerating Information Technology Innovation http://aiti.mit.edu Cali, Colombia Summer 2012 Lesson 02 Variables and Operators Agenda Variables Types Naming Assignment Data Types Type casting Operators

More information

COMP-202: Foundations of Programming. Lecture 2: Variables, and Data Types Sandeep Manjanna, Summer 2015

COMP-202: Foundations of Programming. Lecture 2: Variables, and Data Types Sandeep Manjanna, Summer 2015 COMP-202: Foundations of Programming Lecture 2: Variables, and Data Types Sandeep Manjanna, Summer 2015 Announcements Midterm Exams on 4 th of June (12:35 14:35) Room allocation will be announced soon

More information

Expressions and Data Types CSC 121 Spring 2015 Howard Rosenthal

Expressions 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 information

Today. o main function. o cout object. o Allocate space for data to be used in the program. o The data can be changed

Today. o main function. o cout object. o Allocate space for data to be used in the program. o The data can be changed CS 150 Introduction to Computer Science I Data Types Today Last we covered o main function o cout object o How data that is used by a program can be declared and stored Today we will o Investigate the

More information

CS 302: Introduction to Programming

CS 302: Introduction to Programming CS 302: Introduction to Programming Lectures 2-3 CS302 Summer 2012 1 Review What is a computer? What is a computer program? Why do we have high-level programming languages? How does a high-level program

More information

Full file at

Full 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 information

Chapter 2: Using Data

Chapter 2: Using Data Chapter 2: Using Data TRUE/FALSE 1. A variable can hold more than one value at a time. F PTS: 1 REF: 52 2. The legal integer values are -2 31 through 2 31-1. These are the highest and lowest values that

More information

Java Bytecode (binary file)

Java Bytecode (binary file) Java is Compiled Unlike Python, which is an interpreted langauge, Java code is compiled. In Java, a compiler reads in a Java source file (the code that we write), and it translates that code into bytecode.

More information

CSc 2010 Principles of Computer Science, Fall 2013 Practice Problems for Midterm 3* * 3 17 % 9-20 % (26 / 7) "2"

CSc 2010 Principles of Computer Science, Fall 2013 Practice Problems for Midterm 3* * 3 17 % 9-20 % (26 / 7) 2 CSc 2010 Principles of Computer Science, Fall 2013 Practice Problems for Midterm 1. For each Java expression in the left hand column, indicate its value in the right hand column. Be sure to show a constant

More information

CONTENTS: Compilation Data and Expressions COMP 202. More on Chapter 2

CONTENTS: Compilation Data and Expressions COMP 202. More on Chapter 2 CONTENTS: Compilation Data and Expressions COMP 202 More on Chapter 2 Programming Language Levels There are many programming language levels: machine language assembly language high-level language Java,

More information

COMP 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 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 information

CEN 414 Java Programming

CEN 414 Java Programming CEN 414 Java Programming Instructor: H. Esin ÜNAL SPRING 2017 Slides are modified from original slides of Y. Daniel Liang WEEK 2 ELEMENTARY PROGRAMMING 2 Computing the Area of a Circle public class ComputeArea

More information

1. An operation in which an overall value is computed incrementally, often using a loop.

1. An operation in which an overall value is computed incrementally, often using a loop. Practice Exam 2 Part I: Vocabulary (10 points) Write the terms defined by the statements below. 1. An operation in which an overall value is computed incrementally, often using a loop. 2. The < (less than)

More information

Review Chapters 1 to 4. Instructor: Scott Kristjanson CMPT 125/125 SFU Burnaby, Fall 2013

Review Chapters 1 to 4. Instructor: Scott Kristjanson CMPT 125/125 SFU Burnaby, Fall 2013 Review Chapters 1 to 4 Instructor: Scott Kristjanson CMPT 125/125 SFU Burnaby, Fall 2013 Introduction to Java Chapters 1 and 2 The Java Language Section 1.1 Data & Expressions Sections 2.1 2.5 Instructor:

More information

Entry Point of Execution: the main Method. Elementary Programming. Learning Outcomes. Development Process

Entry Point of Execution: the main Method. Elementary Programming. Learning Outcomes. Development Process Entry Point of Execution: the main Method Elementary Programming EECS1021: Object Oriented Programming: from Sensors to Actuators Winter 2019 CHEN-WEI WANG For now, all your programming exercises will

More information

Lab5. Wooseok Kim

Lab5. Wooseok Kim Lab5 Wooseok Kim wkim3@albany.edu www.cs.albany.edu/~wooseok/201 Question Answer Points 1 A 8 2 A 8 3 E 8 4 D 8 5 20 5 for class 10 for main 5 points for output 6 A 8 7 B 8 8 0 15 9 D 8 10 B 8 Question

More information

Section 2.2 Your First Program in Java: Printing a Line of Text

Section 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 information

CSC System Development with Java. Exception Handling. Department of Statistics and Computer Science. Budditha Hettige

CSC System Development with Java. Exception Handling. Department of Statistics and Computer Science. Budditha Hettige CSC 308 2.0 System Development with Java Exception Handling Department of Statistics and Computer Science 1 2 Errors Errors can be categorized as several ways; Syntax Errors Logical Errors Runtime Errors

More information

Variables, Types, Operations on Numbers

Variables, Types, Operations on Numbers Variables, Types, Operations on Numbers CSE 1310 Introduction to Computers and Programming Vassilis Athitsos University of Texas at Arlington Updated 9/6/16 1 Summary Variable declaration, initialization,

More information

I/O in Java I/O streams vs. Reader/Writer. HW#3 due today Reading Assignment: Java tutorial on Basic I/O

I/O in Java I/O streams vs. Reader/Writer. HW#3 due today Reading Assignment: Java tutorial on Basic I/O I/O 10-7-2013 I/O in Java I/O streams vs. Reader/Writer HW#3 due today Reading Assignment: Java tutorial on Basic I/O public class Swimmer implements Cloneable { public Date geteventdate() { return (Date)

More information

13 th Windsor Regional Secondary School Computer Programming Competition

13 th Windsor Regional Secondary School Computer Programming Competition SCHOOL OF COMPUTER SCIENCE 13 th Windsor Regional Secondary School Computer Programming Competition Hosted by The School of Computer Science, University of Windsor WORKSHOP I [ Overview of the Java/Eclipse

More information

Programming with Java

Programming 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 information

Weiss Chapter 1 terminology (parenthesized numbers are page numbers)

Weiss Chapter 1 terminology (parenthesized numbers are page numbers) Weiss Chapter 1 terminology (parenthesized numbers are page numbers) assignment operators In Java, used to alter the value of a variable. These operators include =, +=, -=, *=, and /=. (9) autoincrement

More information

COMP Primitive and Class Types. Yi Hong May 14, 2015

COMP Primitive and Class Types. Yi Hong May 14, 2015 COMP 110-001 Primitive and Class Types Yi Hong May 14, 2015 Review What are the two major parts of an object? What is the relationship between class and object? Design a simple class for Student How to

More information

University of Cape Town Department of Computer Science. Computer Science CSC115F. June Exam 2002

University of Cape Town Department of Computer Science. Computer Science CSC115F. June Exam 2002 University of Cape Town Department of Computer Science Computer Science CSC115F June Exam 2002 Marks: 100 Time: 3 Hours Surname NAME: STUDENT NO: Approximate marks per question are shown in brackets The

More information

Lecture 2. Examples of Software. Programming and Data Structure. Programming Languages. Operating Systems. Sudeshna Sarkar

Lecture 2. Examples of Software. Programming and Data Structure. Programming Languages. Operating Systems. Sudeshna Sarkar Examples of Software Programming and Data Structure Lecture 2 Sudeshna Sarkar Read an integer and determine if it is a prime number. A Palindrome recognizer Read in airline route information as a matrix

More information

Basic computer skills such as using Windows, Internet Explorer, and Microsoft Word. Chapter 1 Introduction to Computers, Programs, and Java

Basic computer skills such as using Windows, Internet Explorer, and Microsoft Word. Chapter 1 Introduction to Computers, Programs, and Java Basic computer skills such as using Windows, Internet Explorer, and Microsoft Word Chapter 1 Introduction to Computers, Programs, and Java Chapter 2 Primitive Data Types and Operations Chapter 3 Selection

More information

C++ Programming: From Problem Analysis to Program Design, Third Edition

C++ Programming: From Problem Analysis to Program Design, Third Edition C++ Programming: From Problem Analysis to Program Design, Third Edition Chapter 2: Basic Elements of C++ Objectives (continued) Become familiar with the use of increment and decrement operators Examine

More information

Computer Science II (20082) Week 1: Review and Inheritance

Computer Science II (20082) Week 1: Review and Inheritance Computer Science II 4003-232-08 (20082) Week 1: Review and Inheritance Richard Zanibbi Rochester Institute of Technology Review of CS-I Syntax and Semantics of Formal (e.g. Programming) Languages Syntax

More information

IBPS Practice Exam 1. One megabyte equals approximately 1) 1,000 bits 2) 1,000 bytes 3) 1 million bytes 4) 1 million bits 5) 2,000 bytes 2.

IBPS Practice Exam 1. One megabyte equals approximately 1) 1,000 bits 2) 1,000 bytes 3) 1 million bytes 4) 1 million bits 5) 2,000 bytes 2. IBPS Practice Exam 1. One megabyte equals approximately 1) 1,000 bits 2) 1,000 bytes 3) 1 million bytes 4) 1 million bits 5) 2,000 bytes 2. Data going into the computer is called? 1) Output 2) Algorithm

More information

St. Edmund Preparatory High School Brooklyn, NY

St. Edmund Preparatory High School Brooklyn, NY AP Computer Science Mr. A. Pinnavaia Summer Assignment St. Edmund Preparatory High School Name: I know it has been about 7 months since you last thought about programming. It s ok. I wouldn t want to think

More information

ECE 122. Engineering Problem Solving with Java

ECE 122. Engineering Problem Solving with Java ECE 122 Engineering Problem Solving with Java Lecture 10 For Loops and Arrays Outline Problem: How can I perform the same operations a fixed number of times? Considering for loops Performs same operations

More information

AP Programming - Chapter 6 Lecture

AP Programming - Chapter 6 Lecture page 1 of 21 The while Statement, Types of Loops, Looping Subtasks, Nested Loops I. The while Statement Note: Loop - a control structure that causes a sequence of statement(s) to be executed repeatedly.

More information

Crash Course in Java. Why Java? Java notes for C++ programmers. Network Programming in Java is very different than in C/C++

Crash Course in Java. Why Java? Java notes for C++ programmers. Network Programming in Java is very different than in C/C++ Crash Course in Java Netprog: Java Intro 1 Why Java? Network Programming in Java is very different than in C/C++ much more language support error handling no pointers! (garbage collection) Threads are

More information

12/22/11. Java How to Program, 9/e. Help you get started with Eclipse and NetBeans integrated development environments.

12/22/11. Java How to Program, 9/e. Help you get started with Eclipse and NetBeans integrated development environments. Java How to Program, 9/e Education, Inc. All Rights Reserved. } Java application programming } Use tools from the JDK to compile and run programs. } Videos at www.deitel.com/books/jhtp9/ Help you get started

More information

Interpreted vs Compiled. Java Compile. Classes, Objects, and Methods. Hello World 10/6/2016. Python Interpreted. Java Compiled

Interpreted vs Compiled. Java Compile. Classes, Objects, and Methods. Hello World 10/6/2016. Python Interpreted. Java Compiled Interpreted vs Compiled Python 1 Java Interpreted Easy to run and test Quicker prototyping Program runs slower Compiled Execution time faster Virtual Machine compiled code portable Java Compile > javac

More information

Tester vs. Controller. Elementary Programming. Learning Outcomes. Compile Time vs. Run Time

Tester vs. Controller. Elementary Programming. Learning Outcomes. Compile Time vs. Run Time Tester vs. Controller Elementary Programming EECS1022: Programming for Mobile Computing Winter 2018 CHEN-WEI WANG For effective illustrations, code examples will mostly be written in the form of a tester

More information

Midterm Examination (MTA)

Midterm 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 information

Chapter 1 Introduction to Java

Chapter 1 Introduction to Java Chapter 1 Introduction to Java Lesson page 0-1. Introduction to Livetexts Question 1. A livetext is a text that relies not only on the printed word but also on graphics, animation, audio, the computer,

More information

https://asd-pa.perfplusk12.com/admin/admin_curric_maps_display.aspx?m=5507&c=618&mo=18917&t=191&sy=2012&bl...

https://asd-pa.perfplusk12.com/admin/admin_curric_maps_display.aspx?m=5507&c=618&mo=18917&t=191&sy=2012&bl... Page 1 of 13 Units: - All - Teacher: ProgIIIJavaI, CORE Course: ProgIIIJavaI Year: 2012-13 Intro to Java How is data stored by a computer system? What does a compiler do? What are the advantages of using

More information

false, import, new 1 class Lecture2 { 2 3 "Data types, Variables, and Operators" 4

false, import, new 1 class Lecture2 { 2 3 Data types, Variables, and Operators 4 1 class Lecture2 { 2 3 "Data types, Variables, and Operators" 4 5 } 6 7 // Keywords: 8 byte, short, int, long, char, float, double, boolean, true, false, import, new Zheng-Liang Lu Java Programming 45

More information

Full download all chapters instantly please go to Solutions Manual, Test Bank site: testbanklive.com

Full download all chapters instantly please go to Solutions Manual, Test Bank site: testbanklive.com Introduction to Java Programming Comprehensive Version 10th Edition Liang Test Bank Full Download: http://testbanklive.com/download/introduction-to-java-programming-comprehensive-version-10th-edition-liang-tes

More information

5/3/2006. Today! HelloWorld in BlueJ. HelloWorld in BlueJ, Cont. HelloWorld in BlueJ, Cont. HelloWorld in BlueJ, Cont. HelloWorld in BlueJ, Cont.

5/3/2006. Today! HelloWorld in BlueJ. HelloWorld in BlueJ, Cont. HelloWorld in BlueJ, Cont. HelloWorld in BlueJ, Cont. HelloWorld in BlueJ, Cont. Today! Build HelloWorld yourself in BlueJ and Eclipse. Look at all the Java keywords. Primitive Types. HelloWorld in BlueJ 1. Find BlueJ in the start menu, but start the Select VM program instead (you

More information

Elementary Programming

Elementary Programming Elementary Programming EECS1022: Programming for Mobile Computing Winter 2018 CHEN-WEI WANG Learning Outcomes Learn ingredients of elementary programming: data types [numbers, characters, strings] literal

More information

Chapter 02: Using Data

Chapter 02: Using Data True / False 1. A variable can hold more than one value at a time. ANSWER: False REFERENCES: 54 2. The int data type is the most commonly used integer type. ANSWER: True REFERENCES: 64 3. Multiplication,

More information

Classes Basic Overview

Classes Basic Overview Final Review!!! Classes and Objects Program Statements (Arithmetic Operations) Program Flow String In-depth java.io (Input/Output) java.util (Utilities) Exceptions Classes Basic Overview A class is a container

More information

Introduction Unit 4: Input, output and exceptions

Introduction Unit 4: Input, output and exceptions Faculty of Computer Science Programming Language 2 Object oriented design using JAVA Dr. Ayman Ezzat Email: ayman@fcih.net Web: www.fcih.net/ayman Introduction Unit 4: Input, output and exceptions 1 1.

More information

CMSC 331 Second Midterm Exam

CMSC 331 Second Midterm Exam 1 20/ 2 80/ 331 First Midterm Exam 11 November 2003 3 20/ 4 40/ 5 10/ CMSC 331 Second Midterm Exam 6 15/ 7 15/ Name: Student ID#: 200/ You will have seventy-five (75) minutes to complete this closed book

More information

VARIABLES, DATA TYPES,

VARIABLES, DATA TYPES, 1-59863-275-2_CH02_31_05/23/06 2 C H A P T E R VARIABLES, DATA TYPES, AND SIMPLE IO In this chapter, you learn how to use variables, data types, and standard input/output (IO) to create interactive applications.

More information

Introduction to Programming Using Java (98-388)

Introduction 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 information

Lecture Set 2: Starting Java

Lecture Set 2: Starting Java Lecture Set 2: Starting Java 1. Java Concepts 2. Java Programming Basics 3. User output 4. Variables and types 5. Expressions 6. User input 7. Uninitialized Variables 0 This Course: Intro to Procedural

More information

Values and Variables 1 / 30

Values and Variables 1 / 30 Values and Variables 1 / 30 Values 2 / 30 Computing Computing is any purposeful activity that marries the representation of some dynamic domain with the representation of some dynamic machine that provides

More information

Object-oriented programming. and data-structures CS/ENGRD 2110 SUMMER 2018

Object-oriented programming. and data-structures CS/ENGRD 2110 SUMMER 2018 Object-oriented programming 1 and data-structures CS/ENGRD 2110 SUMMER 2018 Lecture 1: Types and Control Flow http://courses.cs.cornell.edu/cs2110/2018su Lecture 1 Outline 2 Languages Overview Imperative

More information

DM550 / DM857 Introduction to Programming. Peter Schneider-Kamp

DM550 / DM857 Introduction to Programming. Peter Schneider-Kamp DM550 / DM857 Introduction to Programming Peter Schneider-Kamp petersk@imada.sdu.dk http://imada.sdu.dk/~petersk/dm550/ http://imada.sdu.dk/~petersk/dm857/ OBJECT-ORIENTED PROGRAMMING IN JAVA 2 Programming

More information

Lab # 02. Basic Elements of C++ _ Part1

Lab # 02. Basic Elements of C++ _ Part1 Lab # 02 Basic Elements of C++ _ Part1 Lab Objectives: After performing this lab, the students should be able to: Become familiar with the basic components of a C++ program, including functions, special

More information

Syllabus for Computer Science General Part I

Syllabus for Computer Science General Part I Distribution of Questions: Part I Q1. (Compulsory: 20 marks). Any ten questions to be answered out of fifteen questions, each carrying two marks (Group A 3 questions, Group B, Group C and Group D 4 questions

More information

Chapters 1-4 Summary. Syntax - Java or C? Syntax - Java or C?

Chapters 1-4 Summary. Syntax - Java or C? Syntax - Java or C? Chapters 1-4 Summary These slides are brief summary of chapters 1-4 for students already familiar with programming in C or C++. Syntax - Java or C? int x[]={1,2,3,4,5,6,7,8,9,10; int i; int sum=0; float

More information

Lecture Set 2: Starting Java

Lecture Set 2: Starting Java Lecture Set 2: Starting Java 1. Java Concepts 2. Java Programming Basics 3. User output 4. Variables and types 5. Expressions 6. User input 7. Uninitialized Variables 0 This Course: Intro to Procedural

More information