In the following description the h: drive is used to indicate the directory in which during the actual ci101 exam the files used will reside.
|
|
- Antony Haynes
- 5 years ago
- Views:
Transcription
1 Important In the following description the h: drive is used to indicate the directory in which during the actual ci101 exam the files used will reside. However, if you are trying the exam system out yourself using the files from the web site then you will need to put these files in a different location. Suggest your own shared workspace and modify the instructions below to reflect the new location. See also section 5 of this document. M A Smith University of Brighton December 6, 2016 Page 1
2 Important information As during the exam you do not have access to the internet a copy of the lecture notes for CI101 is on the p: drive at: p:\ci101.java\ci101.html 1. At the exam Open the folder Applications -> Computing then double click on the shortcut Cygwin64 Terminal and then in the terminal window type the following lines. (Ignore any error messages you initial see in the terminal window.) Remember to press the return key after entering each line. cd h: cd ci101.exam_place-number Note Replace place-number by your actual place number. At any point in typing ci101.exam_place-number You can press the tab key and the bash shell will expand what you have typed to match a single directory in the current directory. M A Smith University of Brighton December 6, 2016 Page 1
3 Now at the command prompt type: sh menu and the following text menu will be displayed. mct - Run Multiple choice data entry program Check the answer to Check the answer to Check the answer to 2.3 exit - Exit from the menu check - Check the system is ok Which option : Options that can be selected: mct Run the Multiple choice data entry program. Remember to save and exit before selecting another option. 2.1 Run a check on your solution to Run a check on your solution to Run a check on your solution to 2.3 check Check that the exam system is working ok. M A Smith University of Brighton December 6, 2016 Page 2
4 Use the BlueJ project at: h:\ci101.exam_place-number\2.1 to modify/construct and debug your program. Remember to include your student number in a comment at the top of your Java program. For the other programs 2.2 & 2.3 replace 2.1 with 2.2 or 2.3 respectively to use the appropriate BlueJ project. When your program passes the 'test' leave the file(s) that you have created/ modified in BlueJ alone. These will be collected after the exam. M A Smith University of Brighton December 6, 2016 Page 3
5 Summary of BIO Static method call BIO.getInt() BIO.getDouble() BIO.getString() BIO.eof() Description Read a line and return as an int the number that is contained within the line. If the number is malformed then return 0. Read a line and return as a double the number that is contained within the line. If the number is malformed then return 0.0. Read a line and return as an instance of a String the characters that are contained within the line. Returns true if the end of the input has been reached otherwise false. If during a read operation the end of input is detected normally a warning message will be printed and the program will terminate. M A Smith University of Brighton December 6, 2016 Page 4
6 4. Overview The CI101 exam is composed of 20 Multiple choice questions worth (50%) Enter your answers to the multiple choice questions using a Java application 3 Java programs to modify/write worth (50%) You will need to write and test each program using BlueJ. Then check your answer using a local shell script. Note: A copy of your program is made with the following source changes: BIO. is changed to BIOX. public class Main is changed to class Main It is the copy that is compiled and run. CI101 course at: Remember: You can use the computer for the whole of the 3 hours of the exam. M A Smith University of Brighton December 6, 2016 Page 5
7 5. Trying this out The following pages contain exercises for you to try. If these were exam questions, then to develop these programs you would need to set-up in an appropriate pool room the following environment. At: which is a zip file that contains files to unzip to your networked storage. Warning this will create files in a top level directory called ci101.exam_10. So if you already have a directory called this please rename your directory. Now follow the instructions in page 1 & 2 You will not be able to do this at 'home' unless you install the cygwin environment. The environment must contain the commands: cat, cut, diff, echo, grep, head, sed, wc, [java & javac (Oracle version)] Best to try this out in an appropirate pool room at the University. M A Smith University of Brighton December 6, 2016 Page 6
8 Example multiple choice questions Remember there is no penalty for answering a question wrongly Q1 When the program below is run class Main public static void main( String args[] ) System.out.printf( "%s world\n", "hello" ); then the program would print: a) %s world hello b) world hello c) hello world d) A runtime error message Q2 When the program below is run class Main public static void main( String args[] ) int a = 0; // First int b = 1; while( a < 3 ) int tmp = a; // Second a = b; b = tmp + b; System.out.println( a ); // First <- Second // Second = Old First + Second it would print: a) 0 b) 1 c) 2 d) 3 M A Smith University of Brighton December 6, 2016 Page 7
9 Q3 When the program below is run class Main public static void main( String args[] ) int sum = 0; for( int i=0; i<3; i++ ) if ( i == 1 i == 3 i == 5 ) sum++; System.out.println( sum ); it would print: a) 0 b) 1 c) 2 d) 3 M A Smith University of Brighton December 6, 2016 Page 8
10 Q4 When the program below is run class Main public static void main( String args[] ) String s = "Hello world"; int count = 0; for ( int i=0; i<s.length()-1; i++ ) if ( s.charat(i) == s.charat(i+1) ) count++; System.out.println( count ); it would print: a) 0 b) 1 c) 2 d) 10 Q5 When the program below is run class Main public static void main( String args[] ) String s1 = "words"; String s2 = ""; for ( int index=0; index<s1.length()-3; index++ ) s2 = s2 + s1.charat( index ); System.out.println( s2 ); it would print: a) ds b) wo c) oo d) A runtime error message M A Smith University of Brighton December 6, 2016 Page 9
11 Q6 When the program below is run class Main public static void main( String args[] ) int numbers[] = 1, 1, 1, 1, 1, 1, 0, 1 ; int sum = 1; for ( int i=1; i<numbers.length; i++ ) sum = sum + numbers[i]; System.out.println( sum ); it would print: a) 0 b) 7 c) 8 d) 9 Q7 When the program below is run class Main public static void main( String args[] ) System.out.println( mystery( 3, 2 ) ); public static int mystery( int a, int b ) if ( b == 0 ) return a; else return mystery( a+1, b-1 ); it would print: a) 4 b) 5 c) 6 d) 7 M A Smith University of Brighton December 6, 2016 Page 10
12 Q8 Which of the following statements will not compile a) int a = ; b) int a = 36.1; c) int a = "Hello".length(); d) double d = 2; Q9 Which of the following statements is false a) An instance of an int will always occupy the same number of bytes. b) A class must always have at least one constructor provided by the implementor of a class. c) An instance of a class is an object. d) Two methods may have the same name provided there parameters differ. Q10 Which of the following statements is true Q11 a) A Java program may only be run on the machine on which it is compiled on. b) int Java = 2.1; Is a valid Java statement. c) Two methods in the same class with different signatures may have the same name. d) Instance variables must be declared before any methods in a class. Which of the following statements is true a) An instance of the class String is mutable (may be changed). Thus name.replace('.','+') will convert all.'s in name to a +. b) Arrays in Java always start at element 1. c) You should not compare instances of the string class using ==. d) If you wish to hold a value exactly you should use an instance of a double. M A Smith University of Brighton December 6, 2016 Page 11
13 Q12 Which of the following statements is true a) An instance of an int is the same size (in bytes) as an instance of a double. b) The number of elements in the int array numbers is delivered by the expression numbers.length(). c) The code fragment: String s = "Hello world"; System.out.println(s.charAt(0)-'H'); will print h. d) In the statement: Sytem.out.println("Hello"); out is an object. Q13 Which of the following statements is true a) int a = 1+/*2+3*/4; Is not a valid declaration. b) int a = 0123 >>> 2; Is not a valid declaration. c) String s = String.format("%s",""); Will put a string of length 2 in s. d) All of the above statements are false. M A Smith University of Brighton December 6, 2016 Page 12
14 Q14 When of the following statements is true a) String s = "Hello"; Is not a valid declaration. b) String s = new String("Hello"); Is not a valid declaration. c) String s = "Hello".length(); Is not a valid declaration. d) All of the above statements are false. Q15 The following statement "Write once, run anywhere" refers in Java to: a) The fact that as the Java system is available on every computer ever built, a program can be run everywhere. b) The fact that Java is never compiled, but always source interpreted and hence will run on any machine. c) The fact that Java is compiled to a bytecode and an interpreter or just in time compiler is available on many machines to 'run' the program. d) All of the above. M A Smith University of Brighton December 6, 2016 Page 13
15 Q16 class Account private double thebalance = 0.00; //Balance of account private double theoverdraft = 0.00; //Overdraft public double getbalance() return thebalance; public void deposit( final double money ) thebalance = thebalance + money; In the above code, which statement below is false a) thebalance is an instance variable b) theoverdraft may not be accessed from outside of the class Account. c) the method getbalance returns an instance of a double. d) final indicates that in the method deposit the formal parameter money may be modified. M A Smith University of Brighton December 6, 2016 Page 14
16 Q17 Using the class in Q16 with the code fragment below: Account mike = new Account(); Account copy = mike; mike.deposit(100.00); System.out.println("%10.2f\n", mike.getbalance() ); System.out.println("%10.2f\n", copy.getbalance() ); which statement below is true a) mike is an instance of a double. b) mike & copy are of different types. c) The two numbers that would be printed will be the same. d) All of the above statements are true. Not covered in class directly, though you may wish to try Q18 Which of the following statements is true a) Map<String, String> amap = new Map<>(); is not a valid declaration. b) Integer a = 2; Is not a valid declaration. c) double res = 2.0 / 0.0; Will cause a run-time error; d) All of the above statements are false. M A Smith University of Brighton December 6, 2016 Page 15
17 2.1 Warning not the exam question / 15 Marks Brief A Java application has been written to read in a series of numbers representing the size of a side of a 'square'. The data is terminated with a negative number. The application prints for each number a square outlined in *'s with an interior of the characters.+ (repeating). The square will always be an odd number of units in size. If the input value is even, the message " Size must be odd: try again" will be printed Example Input Expected output from above input A Java application has been written but unfortunately it contains a few syntax, semantic and logical errors. Correct these errors. A BlueJ project for this application is in the folder cu101.exam_10 at the top level of the h: drive: Using BlueJ correct the application so that the correct results are printed. Example input data Commentary 7 Size of 'square' 5-1 ******* *.+.+.* *.+.+.* *.+.+.* *.+.+.* *.+.+.* ******* ***** *.+.* *.+.* *.+.* ***** M A Smith University of Brighton December 6, 2016 Page 16
18 Special instructions Remember any line printed that contains a # will not be considered as part of your answer. This is so that you can write out a meaningful prompt (containing a # character) for any data required and this line of text will be ignored in the comparison of your answer. Remember that you have most of the answer. M A Smith University of Brighton December 6, 2016 Page 17
19 class Main public static void main( String args[] ) boolean process = false; while ( process ) System.out.print("#Enter size of box [<0 to exit]: ") int sq = BIO.getInt(); if ( sq < 0 ) process = false; else if ( sq%2 == 0 ) System.out.println( "Size must be odd: try again" ); else printbox( sq ); private static void printbox( int size ) for ( int row=1; row<=size; row++ ) for ( int col=1; col<=size; col++ ) if ( row == 1 row == size ) System.out.print("*"); else if ( col == 1 && col == size ) System.out.print( "*" ); else if ( col%2 == 0 ) System.out.print( " " ); else System.out.print( "+" ); System.out.print(); M A Smith University of Brighton December 6, 2016 Page 18
20 2.2 Warning not the exam question / 15 Marks Brief A Java application has been written to encrypt or decrypt a line of text using a Caesar cipher (attributed to Julius Caesar). In this a key is used to shift a plain text letter by key places up/down. For example if the key was 3, then abc becomes def. Each letter is replaced by the corresponding letter 3 places on. For example, a d, be, cf and zc [Cycle round to the start if go beyond z] To decrypt a message, the process is reversed, (key=-3) so d a and c would become z (each letter is shifted key places down, cycle round to the end if go below a. The program takes as input the key (how many places to shift each letter) followed by a series of messages to be encrypted/ decrypted terminated by the string END. All characters that are not alphabetic are ignored by being converted to a space and all characters are treated as being lower case. A Java application has been written but unfortunately it contains a few syntax, semantic and logical errors. Correct these errors. A BlueJ project for this application is in the folder cu101.exam_10 at the top level of the h: drive: Using BlueJ correct the application so that the correct results are printed. M A Smith University of Brighton December 6, 2016 Page 19
21 Example Input Encrypt Example input data 3 abcdefghijklmnopqrstuvwxyz a message in plain text END Commentary Shift by text text End of input Expected output from above input Original text: abcdefghijklmnopqrstuvwxyz En/Decrypted : defghijklmnopqrstuvwxyzabc Original text: a message in plain text En/Decrypted : d phvvdjh lq sodlq whaw Example Input Decrypt -3 defghijklmnopqrstuvwxyzabc d phvvdjh lq sodlq whaw END Shift by text text End of input Expected output from above input Original text: defghijklmnopqrstuvwxyzabc En/Decrypted : abcdefghijklmnopqrstuvwxyz Original text: d phvvdjh lq sodlq whaw En/Decrypted : a message in plain text Special instructions Remember any line printed that contains a # will not be considered as part of your answer. This is so that you can write out a meaningful prompt (containing a # character) for any data required and this line of text will be ignored in the comparison of your answer. Remember that you have most of the answer. M A Smith University of Brighton December 6, 2016 Page 20
22 class Main public static void main( String args[] ) System.out.print("#Enter key : " ); int key = BIO.getInt(); EncryptDecrypt ed = new EncryptDecrypt() ed.setkey( keys ); System.out.print("#Enter line of text : " ); String line = BIO.getString(); while (! line.== "END" ) System.out.println("Original text: " + line ); System.out.println("En/Decrypted : " + ed.process( line ) ); System.out.print("#Enter line of text : " ); line = BIO.getString(); class EncryptDecrypt private int key = 0; private String text = ""; public void setkey( int k ) key = k; public int process( String line ) line = line.tolowercase(); String res = ""; for ( int i=0; i<=line.length(); i++ ) char c = line.charat(i); //Get ith char if ( c >= 'a' && c <= 'z' ) int chn = c-'a'; //Letter to number 0-25 chn = chn + key; //move on key positions if ( chn >= 0 ) chn = chn % 26; //Forward else chn = 26 + chn; //Reverse c = (char) (chn+'a'); //Back to letter res += c; //Append else res += ' '; //Append space return res; M A Smith University of Brighton December 6, 2016 Page 21
23 2.3 Warning not the exam question / 20 Marks Brief Write a program to input lines of text that contain an English description of a number such as: six thousand nine hundred and sixty seven and to print out the number as a decimal number. The words used will be: one, two, three, four. five, six, seven, eight, nine, ten, twenty, thirty, forty, fifty, sixty, seventy, eighty, ninety, hundred, thousand, and The input will be terminated with a line that has only the word END in upper case. Example Input Expected output from above input Special instructions Example input data Commentary two Line 1 thousand Line 2 five Line 3 hundred Line 4 and Line 5 ninety Line 6 END END [two thousand five hundred and ninety] = 2590 Remember to submit the whole application which must have the class name Main. Remember any line printed that contains a # will not be considered as part of your answer. This is so that you can write out a meaningful prompt for any data (containing a # character) and this line of text will be ignored in the comparison of your answer. If the String variable name holds the character string END then name.equals("end") will return true. Hint The definition of a number is deliberately vague, higher marks will be awarded for working within the inherent ambiguity M A Smith University of Brighton December 6, 2016 Page 22
24 1. Alternative way of running the exam system From the start (icon bottom left corner) select the search dialogue box replacing 'search programs and files' with cygwin. Select 'cygwin bash shell' and then at the newly created windows command prompt type the following two lines. Remember to press the return key after each line. cd h:/ci101.exam_place-number sh system.sh Note The use of / instead of \ in the path place-number is your place number 2. Entering the Multiple choice questions From the start (icon bottom left corner) select the search dialogue box replacing 'search programs and files' with cygwin. Select 'cygwin bash shell' and then at the newly created windows command prompt type: cd h:/ci101.exam_place-number sh mct.sh Note The use of/ instead of \ in the path The line cd h:/ci101.exam_place-number may be omitted if already in this directory. M A Smith University of Brighton December 6, 2016 Page 23
25 3. Completing a Java program In the following instructions the assumption is that you are working on question 2.1. If however, you are working on question 2.2 or 2.3, then replace 2.1 in the instructions with 2.2 or 2.3 respectively. 1 Use the BlueJ project at: h:\ci101.exam_place-number\2.1 to modify/construct and debug your program. Remember to include your student number in a comment at the top of this Java program file 2 Once you are convinced your program works in BlueJ From the start (icon bottom left corner) select the search dialogue box replacing 'search programs and files' with cygwin. Select 'cygwin bash shell' and then at the newly created windows command prompt type: cd h:/ci101.exam_place-number sh check.sh 2.1 Note The use of/ instead of \ in the path This process runs a check on the program using several sets of data and is similar to the checks that take place on the Charon system. That's it, now leave all the files alone in the directory 2.1. The files will be collected after the exam finishes and the test(s) rerun. M A Smith University of Brighton December 6, 2016 Page 24
SCHOOL OF COMPUTING, ENGINEERING AND MATHEMATICS SEMESTER 1 EXAMINATIONS 2015/2016 CI101 / CI177. Programming
s SCHOOL OF COMPUTING, ENGINEERING AND MATHEMATICS SEMESTER 1 EXAMINATIONS 2015/2016 CI101 / CI177 Programming Time allowed: THREE hours: Answer: ALL questions Items permitted: Items supplied: There is
More informationSCHOOL OF COMPUTING, ENGINEERING AND MATHEMATICS SEMESTER 2 EXAMINATIONS 2014/2015 CI101/CI101H. Programming
s SCHOOL OF COMPUTING, ENGINEERING AND MATHEMATICS SEMESTER 2 EXAMINATIONS 2014/2015 CI101/CI101H Programming Time allowed: THREE hours Answer: ALL questions Items permitted: Items supplied: There is no
More informationSCHOOL OF COMPUTING, ENGINEERING AND MATHEMATICS SEMESTER 2 EXAMINATIONS 2013/2014 CI101/CI101H. Programming
s SCHOOL OF COMPUTING, ENGINEERING AND MATHEMATICS SEMESTER 2 EXAMINATIONS 2013/2014 CI101/CI101H Programming Time allowed: THREE hours Answer: ALL questions Items permitted: Items supplied: There is no
More informationIntroduction to the coursework for CI228
Introduction to the coursework for CI228 It is very unlikely that you would be able to complete this coursework without attending lectures and tutorials and following the suggested completion deadlines.
More informationCI228 CI228 Tutorials
CI228 M A Smith University of Brighton September 13, 2016 Page 1 BIO - Basic Input Output Input of an integer number The static method BIO.getInt() will read from the keyboard an integer number typed by
More informationDo this by creating on the m: drive (Accessed via start menu link Computer [The m: drive has your login id as name]) the subdirectory CI101.
Creating and running a Java program. This tutorial is an introduction to running a computer program written in the computer programming language Java using the BlueJ IDE (Integrated Development Environment).
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 informationAlgorithms and Programming I. Lecture#12 Spring 2015
Algorithms and Programming I Lecture#12 Spring 2015 Think Python How to Think Like a Computer Scientist By :Allen Downey Installing Python Follow the instructions on installing Python and IDLE on your
More informationAPCS Semester #1 Final Exam Practice Problems
Name: Date: Per: AP Computer Science, Mr. Ferraro APCS Semester #1 Final Exam Practice Problems The problems here are to get you thinking about topics we ve visited thus far in preparation for the semester
More informationPlace Value. Unit 1 Lesson 1
Unit 1 Lesson 1 Students will be able to: Read, write, whole numbers and decimals to thousandths. Key Vocabulary: Digits Place value position Decimal point The standard form The expanded form Digits are
More informationOutline. 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 information17. [Exploring Numbers]
. [Exploring Numbers] Skill. Comparing whole numbers. Compare the size of the digits in the same place, one at a time. Work from left to right across each number. Q. Which number is the A ) 06 B ) 60 C
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 informationBasics. proper programmers write commands
Scripting Languages Basics proper programmers write commands E.g. mkdir john1 rather than clicking on icons If you write a (set of) command more that once you can put them in a file and you do not need
More informationMcGill 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 informationSoftware and Programming 1
Software and Programming 1 Lab 1: Introduction, HelloWorld Program and use of the Debugger 17 January 2019 SP1-Lab1-2018-19.pptx Tobi Brodie (tobi@dcs.bbk.ac.uk) 1 Module Information Lectures: Afternoon
More informationFull file at
Chapter 2 Introduction to Java Applications Section 2.1 Introduction ( none ) Section 2.2 First Program in Java: Printing a Line of Text 2.2 Q1: End-of-line comments that should be ignored by the compiler
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 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 informationComputing Science 114 Solutions to Midterm Examination Tuesday October 19, In Questions 1 20, Circle EXACTLY ONE choice as the best answer
Computing Science 114 Solutions to Midterm Examination Tuesday October 19, 2004 INSTRUCTOR: I E LEONARD TIME: 50 MINUTES In Questions 1 20, Circle EXACTLY ONE choice as the best answer 1 [2 pts] What company
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 informationCS 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 informationCOMP 202 Java in one week
COMP 202 Java in one week... Continued CONTENTS: Return to material from previous lecture At-home programming exercises Please Do Ask Questions It's perfectly normal not to understand everything Most of
More informationSoftware and Programming 1
Software and Programming 1 Lab 2: Step-by-step execution of programs using a Debugger 18 January 2018 SP1-Lab2-18.pdf Tobi Brodie (tobi@dcs.bbk.ac.uk) 1 Lab Session 2: Objectives This session we are concentrating
More informationSPRING 13 CS 0007 FINAL EXAM V2 (Roberts) Your Name: A pt each. B pt each. C pt each. D or 2 pts each
Your Name: Your Pitt (mail NOT peoplesoft) ID: Part Question/s Points available Rubric Your Score A 1-6 6 1 pt each B 7-12 6 1 pt each C 13-16 4 1 pt each D 17-19 5 1 or 2 pts each E 20-23 5 1 or 2 pts
More informationSoftware and Programming 1
Software and Programming 1 Lab 2: Step-by-step execution of programs using a Debugger 24 January 2019 SP1-Lab2-2018-19.pdf Tobi Brodie (tobi@dcs.bbk.ac.uk) 1 Lab Session 2: Objectives This session we are
More informationC How to Program, 6/e by Pearson Education, Inc. All Rights Reserved.
C How to Program, 6/e 1992-2010 by Pearson Education, Inc. 1992-2010 by Pearson Education, Inc. 1992-2010 by Pearson Education, Inc. This chapter serves as an introduction to the important topic of data
More informationM A Smith University of Brighton November 23, 2015 Page 1
Semester 1 CI228 Object oriented software development M A Smith University of Brighton November 23, 2015 Page 1 This is a copy of some of the slides used in the 'Software implementation in Java' part of
More informationOutline. 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 informationM A Smith University of Brighton October 25, 2016 Page 1
Semester 1 CI228 Object oriented software development M A Smith University of Brighton October 25, 2016 Page 1 This is a copy of some of the slides used in the 'Software implementation in Java' part of
More informationSoftware and Programming 1
Software and Programming 1 Lab 1: Introduction, HelloWorld Program and use of the Debugger 11 January 2018 SP1-Lab1-2017-18.pptx Tobi Brodie (tobi@dcs.bbk.ac.uk) 1 Module Information Lectures: Afternoon
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 informationProgramming refresher and intro to C programming
Applied mechatronics Programming refresher and intro to C programming Sven Gestegård Robertz sven.robertz@cs.lth.se Department of Computer Science, Lund University 2018 Outline 1 C programming intro 2
More information3 CREATING YOUR FIRST JAVA APPLICATION (USING WINDOWS)
GETTING STARTED: YOUR FIRST JAVA APPLICATION 15 3 CREATING YOUR FIRST JAVA APPLICATION (USING WINDOWS) GETTING STARTED: YOUR FIRST JAVA APPLICATION Checklist: The most recent version of Java SE Development
More informationC212 Early Evaluation Exam Mon Feb Name: Please provide brief (common sense) justifications with your answers below.
C212 Early Evaluation Exam Mon Feb 10 2014 Name: Please provide brief (common sense) justifications with your answers below. 1. What is the type (and value) of this expression: 5 * (7 + 4 / 2) 2. What
More information1. [3 pts] What is your section number, the period your discussion meets, and the name of your discussion leader?
CIS 3022 Prog for CIS Majors I September 30, 2008 Exam I Print Your Name Your Section # Total Score Your work is to be done individually. The exam is worth 105 points (five points of extra credit are available
More informationCOMP-202B - Introduction to Computing I (Winter 2011) - All Sections Example Questions for In-Class Quiz
COMP-202B - Introduction to Computing I (Winter 2011) - All Sections Example Questions for In-Class Quiz The in-class quiz is intended to give you a taste of the midterm, give you some early feedback about
More informationPROGRAMMING 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 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 informationFaculty of Science Midterm. COMP-202B - Introduction to Computing I (Winter 2008)
Student Name: Student Number: Section: Faculty of Science Midterm COMP-202B - Introduction to Computing I (Winter 2008) Friday, March 7, 2008 Examiners: Prof. Jörg Kienzle 18:15 20:15 Mathieu Petitpas
More informationQuestion: Total Points: Score:
CS 170 Exam 1 Section 001 Fall 2014 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 informationCourse 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 informationIntroduction to Java Unit 1. Using BlueJ to Write Programs
Introduction to Java Unit 1. Using BlueJ to Write Programs 1. Open up BlueJ. Click on the Project menu and select New Project. You should see the window on the right. Navigate to wherever you plan to save
More informationICOM 4015 Advanced Programming Laboratory. Chapter 1 Introduction to Eclipse, Java and JUnit
ICOM 4015 Advanced Programming Laboratory Chapter 1 Introduction to Eclipse, Java and JUnit University of Puerto Rico Electrical and Computer Engineering Department by Juan E. Surís 1 Introduction This
More informationThis is a copy of the notes used in the module CI01.
CI101 This is a copy of the notes used in the module CI01. It is presented to you in the hope that it will be useful and reduce some of the burden of taking notes during the lectures. However, it will
More informationDo not start the test until instructed to do so!
CS 1054: Programming in Java Page 1 of 6 Form A READ THIS NOW! Failure to read and follow the instructions below may result in severe penalties Failure to adhere to these directions will not constitute
More informationBCIS 3630 Dr. GUYNES SPRING 2018 TUESDAY SECTION [JAN version] GRADER COURSE WEBSITE
COURSE WEBSITE http://www.steveguynes.com/bcis3630/bcis3630/default.html Instructor: Dr. Guynes Office: BLB 312H Phone: (940) 565-3110 Office Hours: By Email Email: steve.guynes@unt.edu TEXTBOOK: Starting
More informationLECTURE NOTES ON PROGRAMMING FUNDAMENTAL USING C++ LANGUAGE
Department of Software The University of Babylon LECTURE NOTES ON PROGRAMMING FUNDAMENTAL USING C++ LANGUAGE By Collage of Information Technology, University of Babylon, Iraq Samaher_hussein@yahoo.com
More informationWentworth Institute of Technology. Engineering & Technology WIT COMP1000. Java Basics
WIT COMP1000 Java Basics Java Origins Java was developed by James Gosling at Sun Microsystems in the early 1990s It was derived largely from the C++ programming language with several enhancements Java
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 informationIntroduction 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 informationFinal Exam. COMP Summer I June 26, points
Final Exam COMP 14-090 Summer I 2000 June 26, 2000 200 points 1. Closed book and closed notes. No outside material allowed. 2. Write all answers on the test itself. Do not write any answers in a blue book
More informationChapter 1. Introduction to Computers and Programming. M hiwa ahmad aziz
. Chapter 1 Introduction to Computers and Programming www.raparinweb.com M hiwa ahmad aziz 1 Ch 1 - Introduction to Computers and Programming Hardware Terminology Main Memory Auxiliary Memory Drives Writing
More informationASSIGNMENT 4 Classes and Objects
ASSIGNMENT 4 Classes and Objects COMP-202A, Fall 2010, All Sections Due: Friday, November 19, 2010 (23:55) You MUST do this assignment individually and, unless otherwise specified, you MUST follow all
More information1. [3 pts] What is your section number, the period your discussion meets, and the name of your discussion leader?
CIS 3022 Prog for CIS Majors I February 10, 2009 Exam I Print Your Name Your Section # Total Score Your work is to be done individually. The exam is worth 105 points (five points of extra credit are available
More informationRemaining Enhanced Labs
Here are some announcements regarding the end of the semester, and the specifications for the last Enhanced Labs. Don t forget that you need to take the Common Final Examination on Saturday, May 5, from
More informationCompSci 125 Lecture 02
Assignments CompSci 125 Lecture 02 Java and Java Programming with Eclipse! Homework:! http://coen.boisestate.edu/jconrad/compsci-125-homework! hw1 due Jan 28 (MW), 29 (TuTh)! Programming:! http://coen.boisestate.edu/jconrad/cs125-programming-assignments!
More information2 rd class Department of Programming. OOP with Java Programming
1. Structured Programming and Object-Oriented Programming During the 1970s and into the 80s, the primary software engineering methodology was structured programming. The structured programming approach
More information2.8. Decision Making: Equality and Relational Operators
Page 1 of 6 [Page 56] 2.8. Decision Making: Equality and Relational Operators A condition is an expression that can be either true or false. This section introduces a simple version of Java's if statement
More informationEXAM Computer Science 1 Part 1
Maastricht University Faculty of Humanities and Science Department of Knowledge Engineering EXAM Computer Science 1 Part 1 Block 1.1: Computer Science 1 Code: KEN1120 Examiner: Kurt Driessens Date: Januari
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 informationCOMP-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 informationObject-Oriented Programming. Topic 2: Fundamental Programming Structures in Java
Electrical and Computer Engineering Object-Oriented Topic 2: Fundamental Structures in Java Maj Joel Young Joel.Young@afit.edu 8-Sep-03 Maj Joel Young Java Identifiers Identifiers Used to name local variables
More informationHomework 5: Conditionals and Loops in C
COP 3223H Honors Introduction to Programming with C March 7, 2019 Homework 5: Conditionals and Loops in C See Webcourses and the syllabus for due dates. General Directions This homework should be done
More information1. [3 pts] What is your section number, the period your discussion meets, and the name of your discussion leader?
CIS 3022 Prog for CIS Majors I October 4, 2007 Exam I Print Your Name Your Section # Total Score Your work is to be done individually. The exam is worth 104 points (four points of extra credit are available
More informationIntroduction to Computer Science I Spring 2010 Sample mid-term exam Answer key
Introduction to Computer Science I Spring 2010 Sample mid-term exam Answer key 1. [Question:] (15 points) Consider the code fragment below. Mark each location where an automatic cast will occur. Also find
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 informationProgramming with Java
Programming with Java Variables and Output Statement Lecture 03 First stage Software Engineering Dep. Saman M. Omer 2017-2018 Objectives ü Declare and assign values to variable ü How to use eclipse ü What
More informationCOMP 110 Project 1 Programming Project Warm-Up Exercise
COMP 110 Project 1 Programming Project Warm-Up Exercise Creating Java Source Files Over the semester, several text editors will be suggested for students to try out. Initially, I suggest you use JGrasp,
More informationWrite code that simulates one roll of a 6-sided die and prints out the
CS 101, Spring 2017 Mar 14th Exam 2 Name: Question 1. [5 points] If i = 4 and j = 2, what will print: true or false? Briefly explain. if ((i!= 3) (j < 2)) { printf("true"); else { printf("false"); Question
More informationCOMP-202 Unit 4: Programming With Iterations. CONTENTS: The while and for statements
COMP-202 Unit 4: Programming With Iterations CONTENTS: The while and for statements Introduction (1) Suppose we want to write a program to be used in cash registers in stores to compute the amount of money
More informationCSE 114 Midterm 1. Please leave one seat between yourself and each of your neighbors.
CSE 114 Midterm 1 Please leave one seat between yourself and each of your neighbors. Please place ALL of your final answers on the answer sheet that you were given at the start of the exam. Answers and
More informationFaculty of Science COMP-202A - Introduction to Computing I (Fall 2008) Midterm Examination
First Name: Last Name: McGill ID: Section: Faculty of Science COMP-202A - Introduction to Computing I (Fall 2008) Midterm Examination Tuesday, November 4, 2008 Examiners: Mathieu Petitpas [Section 1] 18:30
More informationGet JAVA. I will just tell you what I did (on January 10, 2017). I went to:
Get JAVA To compile programs you need the JDK (Java Development Kit). To RUN programs you need the JRE (Java Runtime Environment). This download will get BOTH of them, so that you will be able to both
More informationSection 002 Spring CS 170 Exam 1. Name (print): Instructions:
CS 170 Exam 1 Section 002 Spring 2015 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 informationUniversity of Cape Town ~ Department of Computer Science Computer Science 1015F ~ June Exam
Name: Please fill in your Student Number and Name. Student Number : Student Number: University of Cape Town ~ Department of Computer Science Computer Science 1015F ~ 2009 June Exam Question Max Internal
More informationUsing Scantron ParLAN 6.5 for the First Time:
Page 1 of 19 Using Scantron ParLAN 6.5 for the First Time: Last updated: Monday, December 02, 2013 Nine Basic Steps To request a Scantron Account, please contact the Academic Technology Center. Step One:
More informationComputer Science II Data Structures
Computer Science II Data Structures Instructor Sukumar Ghosh 201P Maclean Hall Office hours: 10:30 AM 12:00 PM Mondays and Fridays Course Webpage homepage.cs.uiowa.edu/~ghosh/2116.html Course Syllabus
More informationDM550 Introduction to Programming part 2. Jan Baumbach.
DM550 Introduction to Programming part 2 Jan Baumbach jan.baumbach@imada.sdu.dk http://www.baumbachlab.net COURSE ORGANIZATION 2 Course Elements Lectures: 10 lectures Find schedule and class rooms in online
More informationAssoc. Prof. Dr. Marenglen Biba. (C) 2010 Pearson Education, Inc. All rights reserved.
Assoc. Prof. Dr. Marenglen Biba (C) 2010 Pearson Education, Inc. All rights reserved. Java application A computer program that executes when you use the java command to launch the Java Virtual Machine
More informationCSCI 161: Introduction to Programming I Lab 1b: Hello, World (Eclipse, Java)
Goals - to learn how to compile and execute a Java program - to modify a program to enhance it Overview This activity will introduce you to the Java programming language. You will type in the Java program
More informationAssignment 2.4: Loops
Writing Programs that Use the Terminal 0. Writing to the Terminal Assignment 2.4: Loops In this project, we will be sending our answers to the terminal for the user to see. To write numbers and text to
More informationUniversità degli Studi di Bologna Facoltà di Ingegneria. Principles, Models, and Applications for Distributed Systems M
Università degli Studi di Bologna Facoltà di Ingegneria Principles, Models, and Applications for Distributed Systems M tutor Isam M. Al Jawarneh, PhD student isam.aljawarneh3@unibo.it Mobile Middleware
More informationEECS2031 Winter Software Tools. Assignment 2 (15%): C Programming
EECS2031 Winter 2018 Software Tools Assignment 2 (15%): C Programming Due Date: 11:59pm on Fri, Mar 2, 2018 Objective In this assignment, you will be writing four C programs. The first program (triangle.c)
More informationAP Computer Science Unit 1. Writing Programs Using BlueJ
AP Computer Science Unit 1. Writing Programs Using BlueJ 1. Open up BlueJ. Click on the Project menu and select New Project. You should see the window on the right. Navigate to wherever you plan to save
More informationM A Smith University of Brighton January 12, 2015 Page 1
Semester 1 CI228 Object oriented software development M A Smith University of Brighton January 12, 2015 Page 1 This is a copy of some of the slides used in the 'Software implementation in Java' part of
More informationSimple Java Programming Constructs 4
Simple Java Programming Constructs 4 Course Map In this module you will learn the basic Java programming constructs, the if and while statements. Introduction Computer Principles and Components Software
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 information1. The Apache Derby database
1. The Apache Derby database In these instructions the directory jdk_1.8.0_112 is named after the version 'number' of the distribution. Oracle tend to issue many new versions of the JDK/ JRE each year.
More informationAP CS Unit 3: Control Structures Notes
AP CS Unit 3: Control Structures Notes The if and if-else Statements. These statements are called control statements because they control whether a particular block of code is executed or not. Some texts
More informationProgramming. Syntax and Semantics
Programming For the next ten weeks you will learn basic programming principles There is much more to programming than knowing a programming language When programming you need to use a tool, in this case
More informationSelected Questions from by Nageshwara Rao
Selected Questions from http://way2java.com by Nageshwara Rao Swaminathan J Amrita University swaminathanj@am.amrita.edu November 24, 2016 Swaminathan J (Amrita University) way2java.com (Nageshwara Rao)
More information12/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 informationObjectives. Problem Solving. Introduction. An overview of object-oriented concepts. Programming and programming languages An introduction to Java
Introduction Objectives An overview of object-oriented concepts. Programming and programming languages An introduction to Java 1-2 Problem Solving The purpose of writing a program is to solve a problem
More informationTable of contents. Our goal. Notes. Notes. Notes. Summer June 29, Our goal is to see how we can use Unix as a tool for developing programs
Summer 2010 Department of Computer Science and Engineering York University Toronto June 29, 2010 1 / 36 Table of contents 1 2 3 4 2 / 36 Our goal Our goal is to see how we can use Unix as a tool for developing
More informationFirst Exam Computer Programming 326 Dr. St. John Lehman College City University of New York Thursday, 7 October 2010
First Exam Computer Programming 326 Dr. St. John Lehman College City University of New York Thursday, 7 October 2010 NAME (Printed) NAME (Signed) E-mail Exam Rules Show all your work. Your grade will be
More informationTicket Machine Project(s)
Ticket Machine Project(s) Understanding the basic contents of classes Produced by: Dr. Siobhán Drohan (based on Chapter 2, Objects First with Java - A Practical Introduction using BlueJ, David J. Barnes,
More informationSri Vidya College of Engineering & Technology
UNIT I INTRODUCTION TO OOP AND FUNDAMENTALS OF JAVA 1. Define OOP. Part A Object-Oriented Programming (OOP) is a methodology or paradigm to design a program using classes and objects. It simplifies the
More informationCS112 Lecture: Variables, Expressions, Computation, Constants, Numeric Input-Output
CS112 Lecture: Variables, Expressions, Computation, Constants, Numeric Input-Output Last revised January 12, 2006 Objectives: 1. To introduce arithmetic operators and expressions 2. To introduce variables
More informationCS16 Exam #1 7/17/ Minutes 100 Points total
CS16 Exam #1 7/17/2012 75 Minutes 100 Points total Name: 1. (10 pts) Write the definition of a C function that takes two integers `a` and `b` as input parameters. The function returns an integer holding
More information