Day 2: Review, ICS3U0, June 2017

Size: px
Start display at page:

Download "Day 2: Review, ICS3U0, June 2017"

Transcription

1 Day 2: Review, ICS3U0, June 2017 Bubble in your answers as directed. Use a pencil. Put your name on the scantron. Multiple Choice. Select the best answer. Applets 1. After you click a button, e.getactioncommand() holds: (a) the JButton s Action Listener (b) the text on the JButton (c) the JButton s Action Command (d) a and c (e) None of the above 2. This would change the colour to red: (a) g.setcolor(new Color(255,255,0)); (b) g.setcolor(new Color(0,0,0)); (c) g.setcolor(new Color(255,0,0)); (d) g.setcolor(new Color(0,255,0)); (e) g.setcolor(new Color(0,0,255)); 3. You would declare a JLabel globally if: (a) You needed to change it s text in actionperformed (b) You needed to change it s background to red (c) It had a lot of formatting. (d) It was a picture. (e) None of the above. 4. Red and green (in java) makes: (a) cyan (b) yellow (c) green (d) magenta (e) purple 5. Red and blue (in java) makes: (a) cyan (b) yellow (c) green (d) magenta (e) purple 6. Which colours make cyan? (a) red + blue (b) red + green (c) green + blue (d) red + green + blue 7. Which one is a string used to distinguish between buttons? (a) ActionListeners (b) ActionCommand (c) ActionPerformed (d) ActionEvent 8. Which one watches over a button and triggers an event? (a) ActionListeners (b) ActionCommand (c) ActionPerformed (d) ActionEvent 9. Which one is a method where events are processed? (a) ActionListeners (b) ActionCommand (c) ActionPerformed (d) ActionEvent 10. A can be used to create or display a string. (a) JLabel (b) JTextField (c) JRadioButton (d) JCheckbox (e) JButton 11. Methods that cannot be called on a JLabel include: (a) settext (b) setfont (c) setforeground (d) setbackground (e) setvisible 12. Which widgets have events? (a) JLabel (b) JTextField (c) JButton (d) JTextArea (e) Panel 13. What category of method is.settext? (a) accessor (b) mutator (c) constructor (d) facilitator

2 14. What category of method is this line: JLabel title = new JLabel ("Click"); (a) accessor (b) mutator (c) constructor (d) facilitator 15. What category of method is e.getactioncommand()? (a) accessor (b) mutator (c) constructor (d) facilitator 16. Which code has the correct order to make these widgets appear on the screen? JLabel n1 = new JLabel ("Tiger"); JButton n2 = new JButton ("Elephant"); JTextField n3 = new JTextField (6); (a) add (n3); add (n2); add (n1); (b) add(n1); add(n2); add(n3); (c) add (n3); add (n1); add (n2); (d) add (n2); add (n1); add (n3); The next three questions refer to this screen: 17. How many widgets are on this screen? (a) 4 (b) 5 (c) 6 (d) 10 (e) How many actionlisteners would be declared in init? (a) 0 (b) 1 (c) 2 (d) 3 (e) How many JLabels are on this screen? (a) 0 (b) 1 (c) 2 (d) 3 (e) Why are actionlisteners useful? (a) They signal actionperformed when a button is clicked. (b) They make a program responsive. (c) They pass the ActionListener to the ActionEvent so it knows which button is pressed. (d) All of the above. (e) None of the above. 21. Which type of widget is not needed by this tent screen? (a) JTextField (b) JButton (c) JLabel (d) JPicture (e) All of the above are needed 22. Which method is not needed to make this tent screen? (a) Init (b) ActionPerformed (c) Main (d) CreateImageIcon 23. Which type of widget on the tent screen needs to be global? (a) JTextField (b) JButton (c) JPicture (d) Int (e) Main

3 24. When you add the line implements actionlistener in your applet, you are: (a) Committing to use the init method in your code. (b) Committing to use the main method in your code. (c) Committing to use the swing libraries widgets (d) Committing to use the actionperformed method in your code. 25. What line of code has an error: (a) JButton next = new JButton ( Next screen ); (b) next.setactioncommand ("2"); (c) next.addactionlistener ( ); (d) next.setforeground(color.white); (e) next.setbackground(color.black); 26. Which isn t a method in an applet? (a) createimageicon (b) main (c) actionperformed (d) init 27. Which phase of the PDLC has beta testing? (a) Analysis (b) Design (c) Code (d) Evaluate 28. Which phase of the PDLC would involve brainstorming a brand new game idea? (a) Analysis (b) Design (c) Code (d) Evaluate 29. Which phase of the PDLC involved drawing detailed level maps and drawing artwork? (a) Analysis (b) Design (c) Code (d) Evaluate 30. Which phase of the PDLC involves drawing flow charts? (a) Analysis (b) Design (c) Code (d) Evaluate 31. Which phase of the PDLC involves writing a script/storyline? (a) Analysis (b) Design (c) Code (d) Evaluate 32. This structure chart was used to design a maze game. Which of the following statements is false? (a) There are 3 screens in the game. (b) The game will be an applet. (c) ActionPerformed calls three other methods. (d) isvalid returns a Boolean value. (e) The program has more void methods than any other return type.

4 33. This screen flow diagram is used to design a checkers game. Which statement is true? (a) There are 6 screens. (b) The first screen that will appear is instructions 1. (c) All arrows on a screen flow diagram must begin at a button. (d) Only the buttons that are important to the screen flow are displayed. (e) On a screen flow diagram, a screen can only connect to a maximum of three other screens. 34. What is false about this screen flow diagram? (to the right) (a) The first screen to appear is Welcome. (b) The first screen to appear is numbered 0. (c) The level 1 screen can go to 3 screens. (d) The level 2 screen can go to 5 screens. (e) There are 6 screens. 35. Which is false about screen flow diagrams? (a) All screens must be connected with arrows. (b) A screen should never have more than 6 buttons leading to other screens. (c) A screen needs a unique name. (d) The first screen a user will see is numbered with 0. (e) C and B. 36. Why are screen flow diagrams useful? (a) They provide details about the layout and colour scheme of the screens. (b) They help programmers write comments for their code so debugging is easier. (c) They are used in the Design phase of the PDLC to layout navigations in the program. (d) They help design the details of the code, including input, output and processing. (e) They help the programmer understand the structure of Strings and which char is in which location. 37. Which is true? (a) You should new an object in actionperformed. (b) showstatus( HI ); would print HI in the status bar. (c) Panels, including screen panels, never need to be declared globally. (d) The colour 255, 0, 255 is cyan. (e) To add a picture, you need to add the createimageicon method to your applet. 38. Which is false? (a) The speed of finding the maximum in the array is O(n). (b) The speed of printing the array is O(n). (c) The speed of Bin Sort is O(n). (d) The speed of Bubble Sort is O(n 2 ), in the average case. (e) The speed of selection sort is O(n log n), in the average case.

5 For the next three questions, consider this flowchart: 39. Which widget is required for the get height parallelogram? (a) JLabel (b) JTextField (c) JButton (d) JTextArea (e) Panel 40. Which widget is required for the you can ride pencil-shape? (a) JLabel (b) JTextField (c) JButton (d) JTextArea (e) Panel 41. Which code construct is required for the height < 54 diamond? (a) loop (b) String (c) main method (d) System.out (e) Boolean expression in an if 42. Why are flow charts useful? (a) They provide details about the layout and colour scheme of the screens. (b) They help programmers write comments for their code so debugging is easier. (c) They are used in the Design phase of the PDLC to layout navigations in the program. (d) They help design the details of the code, including input, output and processing. (e) They help the programmer understand which element is in which index. 43. When a programmer disables buttons when they should not be clicked, they are using this priciple of good user interface design. 44. When a programmer uses JButtons instead of JTextfields when possible, they are using this priciple of good user interface design. 45. When a programmer provides clear titles on the top of their screens, they are using this priciple of good user interface design. 46. When a programmer uses colour and pictures, they are using this priciple of good user interface design. 47. When a programmer has a reset or undo button, they are using this priciple of good user interface design. 48. When a programmer groups like items with like items, they are using this priciple of good user interface design. 49. When a programmer puts prompts in front of JTextFields, they are using this priciple of good user interface design.

6 50. When a programmer places widgets in the order needed, they are using this priciple of good user interface design. More Loops The next four questions refer to this flowchart. 51. Which part of the flow chart tests the loop stopping condition: (a) Start (b) num=0 (c) num < 10 (d) num (e) num Which part of the flow chart initializes the loop stopping variable: (a) Start (b) num=0 (c) num < 10 (d) num (e) num Which part of the flow chart moves toward loop stopping condition: (a) Start (b) num=0 (c) num < 10 (d) num (e) num Which part of the flow chart is the steps to repeat: (a) Start (b) num=0 (c) num < 10 (d) num (e) num If you wish to print the numbers from 1 to 60, what number should fill in the blank? for (int i = 1; i < ; i++) { System.out.println(" "+i); (a) 59 (b) 60 (c) 61 (d) 62 (e) None of the previous 56. If you wish to print the numbers from 1 to 100, what number should fill in the blank? for (int i = 1; i < ; i++) { System.out.println(" "+i); (a) 101 (b) 99 (c) 98 (d) 102 (e) None of the previous Arrays 57. When declared, arrays must have: (a) a type (b) a name (c) a size (d) a dimension (e) all of the previous 58. How do you write the third element from the beginning in an array called a in java? (a) a[2] (b) a(2) (c) a[3] (d) a(3) (e) none of the previous 59. Which of the following is correct? (a) int a[] = new int[2]; (b) int a[] = new int(2); (c) int a = new int[2]; (d) int a = new int[3]; (e) int a = new int(2);

7 60. Which is the correct array declaration? (a) int towns[]={"atown", "Bream", "Broda", "Calgari", "Frenzia", "Newtown", "Roetown"; (b) String towns[]=("atown", "Bream", "Broda", "Calgari", "Frenzia", "Newtown", "Roetown"); (c) String towns ={"Atown", "Bream", "Broda", "Calgari", "Frenzia", "Newtown", "Roetown"; (d) String towns[] ={"Atown", "Bream", "Broda", "Calgari", "Frenzia", "Newtown", "Roetown"; (e) char towns =("Atown", "Bream", "Broda", "Calgari", "Frenzia", "Newtown", "Roetown"); 61. Assume int t[] = {0,1,2,3; What is t.length? (a) 0 (b) 2 (c) 3 (d) 4 (e) How can you initialize an array of two characters to 'a' and 'b'? (a) char chararray []= new char[2]; chararray = {'a', 'b'; (b) char chararray [2] = {'a', 'b'; (c) char chararray []= {'a', 'b'; (d) char chararray []= new char[]{'a', 'b'; (e) char chararray []={ a, b ); 63. An array can: (a) grow to a larger size when the program is running. (b) have different types put in it. (c) be re-declared. (d) be re-initialised. (e) have a name that is two words with a space in the middle. 64. The code is designed to find the position of the word octopus in the array shown. What is wrong with it? String a[]={ cat, dog, giraffe, goat, monkey, octopus, turkey, snake ; int pos=-1; for(int i=0; i<a.length; i++) { if (a[i]== octopus ) pos = i; System.out.println( Octopus is in position +pos); (a) the for loop runs to size instead of a.length (b) the if should use.equals instead of == (c) pos should be initialized to 0 because that is the first spot in the array (d) the for loop should have a semi-colon after it. (e) the if needs curly braces. 65. Referring to the flow chart below, which array function is displayed? (a) Minimum (b) Maximum (c) Search (d) Bubble sort (e) Bin sort

8 66. Referring to the flow chart below, which array function is displayed? (a) Bin sort (b) Linear Search (c) Maximum (d) Sum (e) Print 67. Referring to the flow chart below, which array function is displayed? (a) Minimum (b) Maximum (c) Sum (d) Sum under 9 (e) Sum over Why are memory diagrams useful for arrays? (a) They provide details about the layout and colour scheme of the screens. (b) They help programmers write comments for their code so debugging is easier. (c) They are used in the Design phase of the PDLC to layout navigations in the program. (d) They help design the details of the code, including input, output and processing. (e) They help the programmer understand which element is in which index. 69. Which of the following statements is valid? (a) int i = new int(30); (b) double d[] = new int [30]; (c) int i []= {3, 4, 3, 2; (d) char c []= new char(); (e) char c [] = new char[4]{'a', 'b', 'c', 'd'; 70. If you wanted to sort a list of numbers that was sorted, but had one new thing added to the end, you would use: (a) Bubble Sort (b) Bin Sort (c) Insertion Sort (d) Shaker Sort (e) Selection Sort 71. If you wanted to sort a list of names that was sorted, but had one new thing added to the end, you would use: (a) Bubble Sort (b) Bin Sort (c) Insertion Sort (d) Shaker Sort (e) Selection Sort 72. If you wanted to sort a list of 5,000,000 names in random order, you would use: (a) Bubble Sort (b) Bin Sort (c) Insertion Sort (d) Shaker Sort (e) Selection Sort 73. If you wanted to sort a list of 5,000,000 numbers in random order, you would use: (a) Bubble Sort (b) Bin Sort (c) Insertion Sort (d) Shaker Sort (e) Selection Sort 74. You have 3,000,456 integers all between 0 and 3. How would you sort them? (a) Bubble Sort (b) Bin Sort (c) Insertion Sort (d) Shaker Sort (e) Selection Sort 75. The fastest sorting algorithm we learned was: (a) Bubble Sort (b) Bin Sort (c) Insertion Sort (d) Shaker Sort (e) Selection Sort

9 76. Referring to the code below, what value for X will print all elements of array "values"? int values [] = {0, 1, 2, 3, 4, 5, 6, 7; for (int i = 0 ; i < X ; i++) System.out.println (values [i]); (a) 1 (b) 7 (c) 8 (d) 9 (e) none, there is an error in the code. 77. Consider the following code int number[] = new int[5]; After execution of this statement, which of the following are true? (a) number[0] is undefined (b) number[5] is undefined (c) number[4] is null (d) number[2] is 0 (e) number.size () is In the notation for the time that an algorithm takes, n refers to: (a) the number of operations (b) the speed (c) the number of seconds (d) the size of the array (e) none of the above 79. Which error appears in the following flowchart? (a) n=0 should be in a parallelogram. (b) The variable i is not initialized. (c) There should not be two arrows going to j++. (d) The reference to the i, jth element is confusing. (e) All of the above. 80. Why would you choose to use a for loop over a while loop? (a) it is more compact (b) you are using a counting loop (c) you are working with arrays (d) all of the above (e) a and c 81. What array function is shown by this code? int a[]={23, 34, 56, 1, 2, 3, 34, 99, 0, 45, 2; int m=0; for(int i=0; i<a.length; i++) m+=a[i]; System.out.println( The mystery result is +m); (a) maximum (b) linear search (c) binary search (d) sum (e) average

10 82. An ArrayIndexOutOfBoundsException is an error that: (a) occurs when you put elements of different types in an array (b) occurs if you go off the end of an array (c) occurs if you make a partially filled array when a full array is required. (d) occurs after a NullPointer exception. (e) must happen in linear search 83. The pictures for the game of sokoban are named using numbers. Why? (a) Because numbers are used in math and that makes them easier to use. (b)because Strings would make meaningful names like brick or box, less meaningful is better. (c) Because String use.equals and double quotations. Those are annoying to type. (d) Because it is June. Integers work well in June. (e) Because arrays can only be declared as integers. 84. What is declared and set up in the following section of code? JButton b[]; public void init() { b=new JButton[26]; for(int i=0; i<b.length; i++) { b[i]=new JButton(? ); b[i].setactioncommand(i+ ); b[i].addactionlistener(this); add(b[i]); (a) an array of 25 local JButtons (their text can t change). (b) an array of 25 global JButtons (c) an array of 26 local JButtons. (d) an array of 26 global JButtons (e) an applet 85. The code is designed to find the minimum number in the array shown. What is wrong with it? int a[]={1, 34, 516, 78, 89, 100, 234, 54, 3, 27; int min = 0; for (int i=0; i<a.length; i++) { if (min>a[i]) min=a[i]; System.out.println( The minimum value is + min); (a) the min should be initialized to a[0] not 0. (b) the array shouldn t be called a. array would be more appropriate (c) the for loop should have a semi-colon after it. (d) the if needs curly braces. (e) the if line should read: if(min<a[i]) 86. Which puts the Big-Oh notation speeds in the correct order, from fastest to slowest? (a) O(1), O(log n), O(n), O(n log n), O(n 2 ), O(n 3 ), O(2 n ) (b) O(n log n), O(log n), O(n), O(2 n ), O(n 2 ), O(n 3 ), O(1) (c) O(1), O(log n), O(n log n), O(n), O(n 2 ), O(n 3 ), O(2 n ) (d) O(1), O(log n), O(n log n), O(2 n ), O(n), O(n 2 ), O(n 3 ) (e) O(2 n ), O(log n), O(n log n), O(1), O(n), O(n 2 ), O(n 3 )

11 87. Which trace is of selection sort? (a) (b) Which trace is of bubble sort? (a) (b) (c) (c) (d) (d) How many changes are needed to convert this bubble sort code from and integer to a char array? public void bubble (int a []) { int n = a.length; for (int i = 0 ; i < n - 1 ; i++) { for (int j = 0 ; j < n i ; j++) { if (a [j + 1] < a [j]) { int temp = a [j]; a [j] = a [j + 1]; a [j + 1] = temp; (a) 0 (b) 1 (c) 2 (d) 6 (e) none of the previous. 90. What does this code do? int findme = IO.inputInt("Find what? "); int pos = -1; for (int i = 0 ; i < array.length ; i++) { if (array [i] == findme) pos = i; if(pos==-1) System.out.println("Didn t find it"); else System.out.println("It is in position "+pos); (a) find the max (b) initialize (c) binary search (d) search (e) selection sort

12 91. What operation does this code do? int m = a[0]; for (int i = 0; i < a.length; i++) { if (m < a[i]) m = a[i]; System.out.println(m); (a) min (b) max (c) sum (d) average (e) print 92. Denise Melanson s inquest ruled that: (a) It was her nurse s fault that she died. (b) Chemotherapy pumps should only be used in a hospital setting. (c) The system was a fault. (d) User Interfaces should be visually appealing. (e) All of the above. 93. The PDLC is important because: (a) Dividing work is easier when you know what work is required. (b) Good planning means that a large team of people can work together seamlessly. (c) Programs need to be thoroughly tested to remove bugs. (d) It is important that the entire process begins with a good idea or high concept statement. (e) All of the above. 94. Why are algorithms important to computer science? (a) Efficiently written algorithms can significantly improve the running time of a program. (b) Jon Bentley was a programmer. (c) Loops allow code to repeat quickly. (d) Algorithms are a series of steps that complete a task. (e) Animation and rendering are killer aps. 95. Why does the array index start at 0? (a) Because the 0 th element starts at the beginning of the array memory allocation. It is easier to access in memory. (b) There is no reason to waste a perfectly good number (0). (c) It s related to binary, which is used on computer hardware. (d) It is easier to make loops < array.length. (e) All of the above. 96. Why do loops use i as the counting variable. (a) Because i takes less space on the screen than x. (b) Because a would be confusing. (c) Because y is in an inconvenient place on the keyboard. (d) Because i stands for array index. (e) Because i isn t a common vowel and is rarely typed. 97. Why are arrays useful? (a) They don t take up much memory. (b) They work well with control structures like ifs. (c) All of their operations can be done in constant time (Big Oh notation). (d) You can quickly loop through them, changing all of the elements easily. (e) They help develop animation.

13 98. Why is it important to design user interfaces well? (i) If devices are intuitive, they are easier to use. (ii) Error checking makes devices safer. (iii) Visually appealing user interfaces will attract more customers. (a) i and iii (b) ii and iii (c) iii (d) i and ii (e) none of the previous 99. When do you use a while loop over a for loop? (a) When you are counting a set number of times. (b) With an array. (c) When you have a complex loop stopping condition involving and or &&. (d) A & B (e) All of the above Why should you learn to program? (a) Because the singularity is coming and you want to be able to communicate with our new masters. (b) Because it is a dying art like knitting and cooking and it needs preserving. (c) Because computers are being used everywhere and it will be useful in your future jobs. (d) Because there are videos that tell you that you should on the internet. (e) Because Ms. Gorski says so.

ICS3C0 Day 2 Multiple Choice Exam Review Please answer on the scantron card.

ICS3C0 Day 2 Multiple Choice Exam Review Please answer on the scantron card. ICS3C0 Day 2 Multiple Choice Exam Review Please answer on the scantron card. 1. This screen flow diagram is used to design a checkers game. Which statement is true? (a) There are 6 screens. (b) The first

More information

Day 1: Review, ICS4C0, Jan 2019

Day 1: Review, ICS4C0, Jan 2019 Day 1: Review, ICS4C0, Jan 2019 Bubble in your answers with a pencil. Put your name on the scantron. Bubble errors count as mistakes. Multiple Choice. Select the best answer. 1. Which draws a square that

More information

1. Which one is a widget? (a) int (b) JLabel (c) Touchscreen (d) System.out.println (e) Red

1. Which one is a widget? (a) int (b) JLabel (c) Touchscreen (d) System.out.println (e) Red ICS3C0 Day 2 Multiple Choice Exam Review Jan 2018 Please answer on the scantron card. Use a pencil. Put your name on the scantron card NOW. Don t wait. This is due by the end of the period. Button in your

More information

Day 1: Review, ICS3U0, Jan 2018

Day 1: Review, ICS3U0, Jan 2018 Day 1: Review, ICS3U0, Jan 2018 Bubble in your answers as directed. Use a pencil. Be forewarned: Bubbling errors count as mistakes. Put your name on the scantron. Once again, I would like to tell you to

More information

Exam Questions. How to Answer

Exam Questions. How to Answer Exam Questions How to Answer This flowchart asks the user for their desired download speed. Then, it prints the cost of the service. Write the code that would result from this flowchart. Make sure that

More information

DEMYSTIFYING PROGRAMMING: CHAPTER FOUR

DEMYSTIFYING PROGRAMMING: CHAPTER FOUR DEMYSTIFYING PROGRAMMING: CHAPTER FOUR Chapter Four: ACTION EVENT MODEL 1 Objectives 1 4.1 Additional GUI components 1 JLabel 1 JTextField 1 4.2 Inductive Pause 1 4.4 Events and Interaction 3 Establish

More information

Contents Chapter 1 Introduction to Programming and the Java Language

Contents Chapter 1 Introduction to Programming and the Java Language Chapter 1 Introduction to Programming and the Java Language 1.1 Basic Computer Concepts 5 1.1.1 Hardware 5 1.1.2 Operating Systems 8 1.1.3 Application Software 9 1.1.4 Computer Networks and the Internet

More information

Arrays of Buttons. Inside Android

Arrays of Buttons. Inside Android Arrays of Buttons Inside Android The Complete Code Listing. Be careful about cutting and pasting.

More information

Module 5 The Applet Class, Swings. OOC 4 th Sem, B Div Prof. Mouna M. Naravani

Module 5 The Applet Class, Swings. OOC 4 th Sem, B Div Prof. Mouna M. Naravani Module 5 The Applet Class, Swings OOC 4 th Sem, B Div 2016-17 Prof. Mouna M. Naravani The layout manager helps lay out the components held by this container. When you set a layout to null, you tell the

More information

DEMYSTIFYING PROGRAMMING: CHAPTER TEN REPETITION WITH WHILE-LOOP (TOC DETAILED)

DEMYSTIFYING PROGRAMMING: CHAPTER TEN REPETITION WITH WHILE-LOOP (TOC DETAILED) DEMYSTIFYING PROGRAMMING: CHAPTER TEN REPETITION WITH WHILE-LOOP (TOC DETAILED) Chapter Ten: Classes Revisited, Repetition with while... 1 Objectives... 1 10.1 Design... 1 Repetition process pseudocode...

More information

CSE 373 Spring 2010: Midterm #1 (closed book, closed notes, NO calculators allowed)

CSE 373 Spring 2010: Midterm #1 (closed book, closed notes, NO calculators allowed) Name: Email address: CSE 373 Spring 2010: Midterm #1 (closed book, closed notes, NO calculators allowed) Instructions: Read the directions for each question carefully before answering. We may give partial

More information

Outline. Topic 9: Swing. GUIs Up to now: line-by-line programs: computer displays text user types text AWT. A. Basics

Outline. Topic 9: Swing. GUIs Up to now: line-by-line programs: computer displays text user types text AWT. A. Basics Topic 9: Swing Outline Swing = Java's GUI library Swing is a BIG library Goal: cover basics give you concepts & tools for learning more Assignment 7: Expand moving shapes from Assignment 4 into game. "Programming

More information

STUDENT LESSON A12 Iterations

STUDENT LESSON A12 Iterations STUDENT LESSON A12 Iterations Java Curriculum for AP Computer Science, Student Lesson A12 1 STUDENT LESSON A12 Iterations INTRODUCTION: Solving problems on a computer very often requires a repetition of

More information

AP CS Unit 11: Graphics and Events

AP CS Unit 11: Graphics and Events AP CS Unit 11: Graphics and Events This packet shows how to create programs with a graphical interface in a way that is consistent with the approach used in the Elevens program. Copy the following two

More information

Java Programming Lecture 6

Java Programming Lecture 6 Java Programming Lecture 6 Alice E. Fischer Feb 15, 2013 Java Programming - L6... 1/32 Dialog Boxes Class Derivation The First Swing Programs: Snow and Moving The Second Swing Program: Smile Swing Components

More information

Controls Structure for Repetition

Controls Structure for Repetition Controls Structure for Repetition So far we have looked at the if statement, a control structure that allows us to execute different pieces of code based on certain conditions. However, the true power

More information

Introduction. Introduction

Introduction. Introduction Introduction Many Java application use a graphical user interface or GUI (pronounced gooey ). A GUI is a graphical window or windows that provide interaction with the user. GUI s accept input from: the

More information

Graphical User Interface (GUI)

Graphical User Interface (GUI) Graphical User Interface (GUI) An example of Inheritance and Sub-Typing 1 Java GUI Portability Problem Java loves the idea that your code produces the same results on any machine The underlying hardware

More information

1007 Imperative Programming Part II

1007 Imperative Programming Part II Agenda 1007 Imperative Programming Part II We ve seen the basic ideas of sequence, iteration and selection. Now let s look at what else we need to start writing useful programs. Details now start to be

More information

A set, collection, group, or configuration containing members regarded as having certain attributes or traits in common.

A set, collection, group, or configuration containing members regarded as having certain attributes or traits in common. Chapter 6 Class Action In Chapter 1, we explained that Java uses the word class to refer to A set, collection, group, or configuration containing members regarded as having certain attributes or traits

More information

Java Applets. Last Time. Java Applets. Java Applets. First Java Applet. Java Applets. v We created our first Java application

Java Applets. Last Time. Java Applets. Java Applets. First Java Applet. Java Applets. v We created our first Java application Last Time v We created our first Java application v What are the components of a basic Java application? v What GUI component did we use in the examples? v How do we write to the standard output? v An

More information

An array is a type of variable that is able to hold more than one piece of information under a single variable name.

An array is a type of variable that is able to hold more than one piece of information under a single variable name. Arrays An array is a type of variable that is able to hold more than one piece of information under a single variable name. Basically you are sub-dividing a memory box into many numbered slots that can

More information

Topic 9: Swing. Swing is a BIG library Goal: cover basics give you concepts & tools for learning more

Topic 9: Swing. Swing is a BIG library Goal: cover basics give you concepts & tools for learning more Swing = Java's GUI library Topic 9: Swing Swing is a BIG library Goal: cover basics give you concepts & tools for learning more Assignment 5: Will be an open-ended Swing project. "Programming Contest"

More information

Topic 9: Swing. Why are we studying Swing? GUIs Up to now: line-by-line programs: computer displays text user types text. Outline. 1. Useful & fun!

Topic 9: Swing. Why are we studying Swing? GUIs Up to now: line-by-line programs: computer displays text user types text. Outline. 1. Useful & fun! Swing = Java's GUI library Topic 9: Swing Swing is a BIG library Goal: cover basics give you concepts & tools for learning more Why are we studying Swing? 1. Useful & fun! 2. Good application of OOP techniques

More information

Final Exam CS 251, Intermediate Programming December 13, 2017

Final Exam CS 251, Intermediate Programming December 13, 2017 Final Exam CS 251, Intermediate Programming December 13, 2017 Name: NetID: Answer all questions in the space provided. Write clearly and legibly, you will not get credit for illegible or incomprehensible

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

5/31/2006. Last Time. Announcements. Today. Variable Scope. Variable Lifetime. Variable Scope - Cont. The File class. Assn 3 due this evening.

5/31/2006. Last Time. Announcements. Today. Variable Scope. Variable Lifetime. Variable Scope - Cont. The File class. Assn 3 due this evening. Last Time Announcements The File class. Back to methods Passing parameters by value and by reference. Review class attributes. An exercise to review File I/O, look at passing by reference and the use of

More information

Java - Applets. public class Buttons extends Applet implements ActionListener

Java - Applets. public class Buttons extends Applet implements ActionListener Java - Applets Java code here will not use swing but will support the 1.1 event model. Legacy code from the 1.0 event model will not be used. This code sets up a button to be pushed: import java.applet.*;

More information

CMP 326 Midterm Fall 2015

CMP 326 Midterm Fall 2015 CMP 326 Midterm Fall 2015 Name: 1) (30 points; 5 points each) Write the output of each piece of code. If the code gives an error, write any output that would happen before the error, and then write ERROR.

More information

Prototyping a Swing Interface with the Netbeans IDE GUI Editor

Prototyping a Swing Interface with the Netbeans IDE GUI Editor Prototyping a Swing Interface with the Netbeans IDE GUI Editor Netbeans provides an environment for creating Java applications including a module for GUI design. Here we assume that we have some existing

More information

Arrays Introduction. Group of contiguous memory locations. Each memory location has same name Each memory location has same type

Arrays Introduction. Group of contiguous memory locations. Each memory location has same name Each memory location has same type Array Arrays Introduction Group of contiguous memory locations Each memory location has same name Each memory location has same type Remain same size once created Static entries 1 Name of array (Note that

More information

Repe$$on CSC 121 Spring 2017 Howard Rosenthal

Repe$$on CSC 121 Spring 2017 Howard Rosenthal Repe$$on CSC 121 Spring 2017 Howard Rosenthal Lesson Goals Learn the following three repetition structures in Java, their syntax, their similarities and differences, and how to avoid common errors when

More information

Overview. Lecture 7: Inheritance and GUIs. Inheritance. Example 9/30/2008

Overview. Lecture 7: Inheritance and GUIs. Inheritance. Example 9/30/2008 Overview Lecture 7: Inheritance and GUIs Written by: Daniel Dalevi Inheritance Subclasses and superclasses Java keywords Interfaces and inheritance The JComponent class Casting The cosmic superclass Object

More information

Unit 1: Binary and Java Input and Output. Sample Test (Inquiry) Name : Totals: /70 (!c), /9 (c), /79 (!c&&c)

Unit 1: Binary and Java Input and Output. Sample Test (Inquiry) Name : Totals: /70 (!c), /9 (c), /79 (!c&&c) Unit 1: Binary and Java Input and Output Sample Test (Inquiry) Name : Totals: /70 (!c), /9 (c), /79 (!c&&c) Part A: Binary 1. Fill in the answer column of this chart. /9 Instruction Data Answer 53 (a)

More information

MONTHLY TEST (JUNE 2018) CLASS XII INFORMATICS PRACTICES

MONTHLY TEST (JUNE 2018) CLASS XII INFORMATICS PRACTICES M.M: 40 MONTHLY TEST (JUNE 2018) CLASS XII INFORMATICS PRACTICES TIME: 80 Mins. Q1. Which of the following is not a feature of Networking? (i) Resource Sharing (ii) Reliability (iii) Uninterrupted power

More information

Curriculum Map Grade(s): Subject: AP Computer Science

Curriculum Map Grade(s): Subject: AP Computer Science Curriculum Map Grade(s): 11-12 Subject: AP Computer Science (Semester 1 - Weeks 1-18) Unit / Weeks Content Skills Assessments Standards Lesson 1 - Background Chapter 1 of Textbook (Weeks 1-3) - 1.1 History

More information

DEMYSTIFYING PROGRAMMING: CHAPTER SIX METHODS (TOC DETAILED) CHAPTER SIX: METHODS 1

DEMYSTIFYING PROGRAMMING: CHAPTER SIX METHODS (TOC DETAILED) CHAPTER SIX: METHODS 1 DEMYSTIFYING PROGRAMMING: CHAPTER SIX METHODS (TOC DETAILED) CHAPTER SIX: METHODS 1 Objectives 1 6.1 Methods 1 void or return 1 Parameters 1 Invocation 1 Pass by value 1 6.2 GUI 2 JButton 2 6.3 Patterns

More information

CSE 373 Autumn 2010: Midterm #1 (closed book, closed notes, NO calculators allowed)

CSE 373 Autumn 2010: Midterm #1 (closed book, closed notes, NO calculators allowed) Name: Email address: CSE 373 Autumn 2010: Midterm #1 (closed book, closed notes, NO calculators allowed) Instructions: Read the directions for each question carefully before answering. We may give partial

More information

Review sheet for Final Exam (List of objectives for this course)

Review sheet for Final Exam (List of objectives for this course) Review sheet for Final Exam (List of objectives for this course) Please be sure to see other review sheets for this semester Please be sure to review tests from this semester Week 1 Introduction Chapter

More information

APCS Semester #1 Final Exam Practice Problems

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

1. This is the thinking part of the computer. (a) RAM (b) ROM (c) CPU (d) Hard Drive (e) Motherboard

1. This is the thinking part of the computer. (a) RAM (b) ROM (c) CPU (d) Hard Drive (e) Motherboard ICS3C0 Day 1 Multiple Choice Exam Review Jan 2018 Please answer on the scantron card. Use a pencil. Put your name on the scantron card NOW. Don t wait. This is due by the end of the period. Button in your

More information

CS 170 Exam 2. Version: A Fall Name (as in OPUS) (print): Instructions:

CS 170 Exam 2. Version: A Fall Name (as in OPUS) (print): Instructions: CS 170 Exam 2 Version: A Fall 2015 Name (as in OPUS) (print): Section: Seat Assignment: Instructions: Keep your eyes on your own paper and do your best to prevent anyone else from seeing your work. Do

More information

CS 177 Week 15 Recitation Slides. Review

CS 177 Week 15 Recitation Slides. Review CS 177 Week 15 Recitation Slides Review 1 Announcements Final Exam on Friday Dec. 18 th STEW 183 from 1 3 PM Complete your online review of your classes. Your opinion matters!!! Project 6 due Just kidding

More information

Building a GUI in Java with Swing. CITS1001 extension notes Rachel Cardell-Oliver

Building a GUI in Java with Swing. CITS1001 extension notes Rachel Cardell-Oliver Building a GUI in Java with Swing CITS1001 extension notes Rachel Cardell-Oliver Lecture Outline 1. Swing components 2. Building a GUI 3. Animating the GUI 2 Swing A collection of classes of GUI components

More information

CS 180 Final Exam Review 12/(11, 12)/08

CS 180 Final Exam Review 12/(11, 12)/08 CS 180 Final Exam Review 12/(11, 12)/08 Announcements Final Exam Thursday, 18 th December, 10:20 am 12:20 pm in PHYS 112 Format 30 multiple choice questions 5 programming questions More stress on topics

More information

Java Just in Time: Collected concepts after chapter 18

Java Just in Time: Collected concepts after chapter 18 Java Just in Time: Collected concepts after chapter 18 John Latham, School of Computer Science, Manchester University, UK. April 15, 2011 Contents 1 Computer basics 18000 1.1 Computer basics: hardware

More information

Repe$$on CSC 121 Fall 2015 Howard Rosenthal

Repe$$on CSC 121 Fall 2015 Howard Rosenthal Repe$$on CSC 121 Fall 2015 Howard Rosenthal Lesson Goals Learn the following three repetition methods, their similarities and differences, and how to avoid common errors when using them: while do-while

More information

Starting Out with Java: From Control Structures Through Objects Sixth Edition

Starting Out with Java: From Control Structures Through Objects Sixth Edition Starting Out with Java: From Control Structures Through Objects Sixth Edition Chapter 12 A First Look at GUI Applications Chapter Topics 12.1 Introduction 12.2 Creating Windows 12.3 Equipping GUI Classes

More information

CSE 20. SAMPLE FINAL Version A Time: 180 minutes. The following precedence table is provided for your use:

CSE 20. SAMPLE FINAL Version A Time: 180 minutes. The following precedence table is provided for your use: CSE 20 SAMPLE FINAL Version A Time: 180 minutes Name The following precedence table is provided for your use: Precedence of Operators ( ) - (unary),!, ++, -- *, /, % +, - (binary) = = =,!= &&

More information

Defining Classes and Methods

Defining Classes and Methods Defining Classes and Methods Chapter 4 Chapter 4 1 Basic Terminology Objects can represent almost anything. A class defines a kind of object. It specifies the kinds of data an object of the class can have.

More information

Programming graphics

Programming graphics Programming graphics Need a window javax.swing.jframe Several essential steps to use (necessary plumbing ): Set the size width and height in pixels Set a title (optional), and a close operation Make it

More information

1 Getting started with Processing

1 Getting started with Processing cis3.5, spring 2009, lab II.1 / prof sklar. 1 Getting started with Processing Processing is a sketch programming tool designed for use by non-technical people (e.g., artists, designers, musicians). For

More information

Graphics. Lecture 18 COP 3252 Summer June 6, 2017

Graphics. Lecture 18 COP 3252 Summer June 6, 2017 Graphics Lecture 18 COP 3252 Summer 2017 June 6, 2017 Graphics classes In the original version of Java, graphics components were in the AWT library (Abstract Windows Toolkit) Was okay for developing simple

More information

CS180 Recitation. More about Objects and Methods

CS180 Recitation. More about Objects and Methods CS180 Recitation More about Objects and Methods Announcements Project3 issues Output did not match sample output. Make sure your code compiles. Otherwise it cannot be graded. Pay close attention to file

More information

Give one example where you might wish to use a three dimensional array

Give one example where you might wish to use a three dimensional array CS 110: INTRODUCTION TO COMPUTER SCIENCE SAMPLE TEST 3 TIME ALLOWED: 60 MINUTES Student s Name: MAXIMUM MARK 100 NOTE: Unless otherwise stated, the questions are with reference to the Java Programming

More information

1 Short Answer (10 Points Each)

1 Short Answer (10 Points Each) 1 Short Answer (10 Points Each) 1. For the following one-dimensional array, show the final array state after each pass of the three sorting algorithms. That is, after each iteration of the outside loop

More information

Selection. Chapter 7

Selection. Chapter 7 Selection Chapter 7 Chapter Contents Objectives 7.1 Introductory Example: The Mascot Problem 7.2 Selection: The if Statement Revisited 7.3 Selection: The switch Statement 7.4 Selection: Conditional Expressions

More information

Chapter 5: Enhancing Classes

Chapter 5: Enhancing Classes Chapter 5: Enhancing Classes Presentation slides for Java Software Solutions for AP* Computer Science 3rd Edition by John Lewis, William Loftus, and Cara Cocking Java Software Solutions is published by

More information

Block I Unit 2. Basic Constructs in Java. AOU Beirut Computer Science M301 Block I, unit 2 1

Block I Unit 2. Basic Constructs in Java. AOU Beirut Computer Science M301 Block I, unit 2 1 Block I Unit 2 Basic Constructs in Java M301 Block I, unit 2 1 Developing a Simple Java Program Objectives: Create a simple object using a constructor. Create and display a window frame. Paint a message

More information

Name Section. CS 21a Introduction to Computing I 1 st Semester Final Exam

Name Section. CS 21a Introduction to Computing I 1 st Semester Final Exam CS a Introduction to Computing I st Semester 00-00 Final Exam Write your name on each sheet. I. Multiple Choice. Encircle the letter of the best answer. ( points each) Answer questions and based on the

More information

CSE 373 Winter 2009: Midterm #1 (closed book, closed notes, NO calculators allowed)

CSE 373 Winter 2009: Midterm #1 (closed book, closed notes, NO calculators allowed) Name: Email address: CSE 373 Winter 2009: Midterm #1 (closed book, closed notes, NO calculators allowed) Instructions: Read the directions for each question carefully before answering. We may give partial

More information

References. Chapter 5: Enhancing Classes. Enhancing Classes. The null Reference. Java Software Solutions for AP* Computer Science A 2nd Edition

References. Chapter 5: Enhancing Classes. Enhancing Classes. The null Reference. Java Software Solutions for AP* Computer Science A 2nd Edition Chapter 5: Enhancing Classes Presentation slides for Java Software Solutions for AP* Computer Science A 2nd Edition by John Lewis, William Loftus, and Cara Cocking Java Software Solutions is published

More information

CIS 110 Introduction to Computer Programming Summer 2018 Midterm. Recitation ROOM :

CIS 110 Introduction to Computer Programming Summer 2018 Midterm. Recitation ROOM : CIS 110 Introduction to Computer Programming Summer 2018 Midterm Name: Recitation ROOM : Pennkey (e.g., paulmcb): My signature below certifies that I have complied with the University of Pennsylvania s

More information

B2.52-R3: INTRODUCTION TO OBJECT ORIENTATED PROGRAMMING THROUGH JAVA

B2.52-R3: INTRODUCTION TO OBJECT ORIENTATED PROGRAMMING THROUGH JAVA B2.52-R3: INTRODUCTION TO OBJECT ORIENTATED PROGRAMMING THROUGH JAVA NOTE: 1. There are TWO PARTS in this Module/Paper. PART ONE contains FOUR questions and PART TWO contains FIVE questions. 2. PART ONE

More information

Part I: Learn Common Graphics Components

Part I: Learn Common Graphics Components OOP GUI Components and Event Handling Page 1 Objectives 1. Practice creating and using graphical components. 2. Practice adding Event Listeners to handle the events and do something. 3. Learn how to connect

More information

Topic 22 Hash Tables

Topic 22 Hash Tables Topic 22 Hash Tables "hash collision n. [from the techspeak] (var. `hash clash') When used of people, signifies a confusion in associative memory or imagination, especially a persistent one (see thinko).

More information

To gain experience using GUI components and listeners.

To gain experience using GUI components and listeners. Lab 5 Handout 7 CSCI 134: Fall, 2017 TextPlay Objective To gain experience using GUI components and listeners. Note 1: You may work with a partner on this lab. If you do, turn in only one lab with both

More information

Java Swing. based on slides by: Walter Milner. Java Swing Walter Milner 2005: Slide 1

Java Swing. based on slides by: Walter Milner. Java Swing Walter Milner 2005: Slide 1 Java Swing based on slides by: Walter Milner Java Swing Walter Milner 2005: Slide 1 What is Swing? A group of 14 packages to do with the UI 451 classes as at 1.4 (!) Part of JFC Java Foundation Classes

More information

What did we talk about last time? Finished hunters and prey Class variables Constants Class constants Started Big Oh notation

What did we talk about last time? Finished hunters and prey Class variables Constants Class constants Started Big Oh notation Week 12 - Friday What did we talk about last time? Finished hunters and prey Class variables Constants Class constants Started Big Oh notation Here is some code that sorts an array in ascending order

More information

CompSci 125 Lecture 17. GUI: Graphics, Check Boxes, Radio Buttons

CompSci 125 Lecture 17. GUI: Graphics, Check Boxes, Radio Buttons CompSci 125 Lecture 17 GUI: Graphics, Check Boxes, Radio Buttons Announcements GUI Review Review: Inheritance Subclass is a Parent class Includes parent s features May Extend May Modify extends! Parent

More information

More About Objects and Methods

More About Objects and Methods More About Objects and Methods Chapter 5 Chapter 5 1 Programming with Methods - Methods Calling Methods A method body may contain an invocation of another method. Methods invoked from method main typically

More information

Name: Checked: Learn about listeners, events, and simple animation for interactive graphical user interfaces.

Name: Checked: Learn about listeners, events, and simple animation for interactive graphical user interfaces. Lab 15 Name: Checked: Objectives: Learn about listeners, events, and simple animation for interactive graphical user interfaces. Files: http://www.csc.villanova.edu/~map/1051/chap04/smilingface.java http://www.csc.villanova.edu/~map/1051/chap04/smilingfacepanel.java

More information

Systems Programming Graphical User Interfaces

Systems Programming Graphical User Interfaces Systems Programming Graphical User Interfaces Julio Villena Román (LECTURER) CONTENTS ARE MOSTLY BASED ON THE WORK BY: José Jesús García Rueda Systems Programming GUIs based on Java

More information

Java Just in Time: Collected concepts after chapter 22

Java Just in Time: Collected concepts after chapter 22 Java Just in Time: Collected concepts after chapter 22 John Latham, School of Computer Science, Manchester University, UK. April 15, 2011 Contents 1 Computer basics 22000 1.1 Computer basics: hardware

More information

More About Objects and Methods

More About Objects and Methods More About Objects and Methods Chapter 5 Chapter 5 1 Auto-Boxing and Unboxing and Wrapper Classes Many Java library methods work with class objects only Do not accept primitives Use wrapper classes instead!

More information

CIS Introduction to Computer Programming Spring Exam 1

CIS Introduction to Computer Programming Spring Exam 1 CIS 110 - Introduction to Computer Programming Spring 2017 - Exam 1 Name: Recitation (e.g. 201): PennKey (e.g. eeaton): My signature below certifies that I have complied with the University of Pennsylvania

More information

G. Tardiani RoboCup Rescue. EV3 Workshop Part 1 Introduction to RobotC

G. Tardiani RoboCup Rescue. EV3 Workshop Part 1 Introduction to RobotC RoboCup Rescue EV3 Workshop Part 1 Introduction to RobotC Why use RobotC? RobotC is a more traditional text based programming language The more compact coding editor allows for large programs to be easily

More information

CS 170 Java Programming 1. Week 10: Loops and Arrays

CS 170 Java Programming 1. Week 10: Loops and Arrays CS 170 Java Programming 1 Week 10: Loops and Arrays What s the Plan? Topic 1: A Little Review Use a counted loop to create graphical objects Write programs that use events and animation Topic 2: Advanced

More information

DUKE UNIVERSITY Department of Computer Science. Midterm Solutions

DUKE UNIVERSITY Department of Computer Science. Midterm Solutions DUKE UNIVERSITY Department of Computer Science CPS 001 Fall 2001 J. Forbes Midterm Solutions PROBLEM 1 : (Quick Ones (4 points)) A. Give an example of a variable declaration. int a; B. Given that you wrote

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

Window Interfaces Using Swing Objects

Window Interfaces Using Swing Objects Chapter 12 Window Interfaces Using Swing Objects Event-Driven Programming and GUIs Swing Basics and a Simple Demo Program Layout Managers Buttons and Action Listeners Container Classes Text I/O for GUIs

More information

Lecture (06) Java Forms

Lecture (06) Java Forms Lecture (06) Java Forms Dr. Ahmed ElShafee 1 Dr. Ahmed ElShafee, Fundamentals of Programming I, Introduction You don t have to output everything to a terminal window in Java. In this lecture, you ll be

More information

Computer Science is...

Computer Science is... Computer Science is... Machine Learning Machine learning is the study of computer algorithms that improve automatically through experience. Example: develop adaptive strategies for the control of epileptic

More information

Frames, GUI and events. Introduction to Swing Structure of Frame based applications Graphical User Interface (GUI) Events and event handling

Frames, GUI and events. Introduction to Swing Structure of Frame based applications Graphical User Interface (GUI) Events and event handling Frames, GUI and events Introduction to Swing Structure of Frame based applications Graphical User Interface (GUI) Events and event handling Introduction to Swing The Java AWT (Abstract Window Toolkit)

More information

TOPIC 2 INTRODUCTION TO JAVA AND DR JAVA

TOPIC 2 INTRODUCTION TO JAVA AND DR JAVA 1 TOPIC 2 INTRODUCTION TO JAVA AND DR JAVA Notes adapted from Introduction to Computing and Programming with Java: A Multimedia Approach by M. Guzdial and B. Ericson, and instructor materials prepared

More information

Agenda CS121/IS223. Reminder. Object Declaration, Creation, Assignment. What is Going On? Variables in Java

Agenda CS121/IS223. Reminder. Object Declaration, Creation, Assignment. What is Going On? Variables in Java CS121/IS223 Object Reference Variables Dr Olly Gotel ogotel@pace.edu http://csis.pace.edu/~ogotel Having problems? -- Come see me or call me in my office hours -- Use the CSIS programming tutors Agenda

More information

Sorting Algorithms part 1

Sorting Algorithms part 1 Sorting Algorithms part 1 1. Bubble sort Description Bubble sort is a simple sorting algorithm. It works by repeatedly stepping through the array to be sorted, comparing two items at a time, swapping these

More information

1. The programming language C is more than 30 years old. True or False? (Circle your choice.)

1. The programming language C is more than 30 years old. True or False? (Circle your choice.) Name: Section: Grade: Answer these questions while viewing the assigned videos. Not sure of an answer? Ask your instructor to explain at the beginning of the next class session. You can then fill in your

More information

We are on the GUI fast track path

We are on the GUI fast track path We are on the GUI fast track path Chapter 13: Exception Handling Skip for now Chapter 14: Abstract Classes and Interfaces Sections 1 9: ActionListener interface Chapter 15: Graphics Skip for now Chapter

More information

ADTs, Arrays, Linked Lists

ADTs, Arrays, Linked Lists 1 ADTs, Arrays, Linked Lists Outline and Required Reading: ADTs ( 2.1) Using Arrays ( 3.1) Linked Lists ( 3.2, 3.3, 3.4) CSE 2011, Winter 2017 Instructor: N. Vlajic Data Type 2 A data type is a classification

More information

Lecture Programming in C++ PART 1. By Assistant Professor Dr. Ali Kattan

Lecture Programming in C++ PART 1. By Assistant Professor Dr. Ali Kattan Lecture 08-1 Programming in C++ PART 1 By Assistant Professor Dr. Ali Kattan 1 The Conditional Operator The conditional operator is similar to the if..else statement but has a shorter format. This is useful

More information

G51PGP Programming Paradigms. Lecture 009 Concurrency, exceptions

G51PGP Programming Paradigms. Lecture 009 Concurrency, exceptions G51PGP Programming Paradigms Lecture 009 Concurrency, exceptions 1 Reminder subtype polymorphism public class TestAnimals public static void main(string[] args) Animal[] animals = new Animal[6]; animals[0]

More information

Decisions: Logic Java Programming 2 Lesson 7

Decisions: Logic Java Programming 2 Lesson 7 Decisions: Logic Java Programming 2 Lesson 7 In the Java 1 course we learned about if statements, which use booleans (true or false) to make decisions. In this lesson, we'll dig a little deeper and use

More information

int a; int b = 3; for (a = 0; a < 8 b < 20; a++) {a = a + b; b = b + a;}

int a; int b = 3; for (a = 0; a < 8 b < 20; a++) {a = a + b; b = b + a;} 1. What does mystery(3) return? public int mystery (int n) { int m = 0; while (n > 1) {if (n % 2 == 0) n = n / 2; else n = 3 * n + 1; m = m + 1;} return m; } (a) 0 (b) 1 (c) 6 (d) (*) 7 (e) 8 2. What are

More information

Sorting. Popular algorithms: Many algorithms for sorting in parallel also exist.

Sorting. Popular algorithms: Many algorithms for sorting in parallel also exist. Sorting Popular algorithms: Selection sort* Insertion sort* Bubble sort* Quick sort* Comb-sort Shell-sort Heap sort* Merge sort* Counting-sort Radix-sort Bucket-sort Tim-sort Many algorithms for sorting

More information

Window Interfaces Using Swing Objects

Window Interfaces Using Swing Objects Chapter 12 Window Interfaces Using Swing Objects Event-Driven Programming and GUIs Swing Basics and a Simple Demo Program Layout Managers Buttons and Action Listeners Container Classes Text I/O for GUIs

More information

Java - Applets. C&G criteria: 1.2.2, 1.2.3, 1.2.4, 1.3.4, 1.2.4, 1.3.4, 1.3.5, 2.2.5, 2.4.5, 5.1.2, 5.2.1,

Java - Applets. C&G criteria: 1.2.2, 1.2.3, 1.2.4, 1.3.4, 1.2.4, 1.3.4, 1.3.5, 2.2.5, 2.4.5, 5.1.2, 5.2.1, Java - Applets C&G criteria: 1.2.2, 1.2.3, 1.2.4, 1.3.4, 1.2.4, 1.3.4, 1.3.5, 2.2.5, 2.4.5, 5.1.2, 5.2.1, 5.3.2. Java is not confined to a DOS environment. It can run with buttons and boxes in a Windows

More information

CSE373 Fall 2013, Midterm Examination October 18, 2013

CSE373 Fall 2013, Midterm Examination October 18, 2013 CSE373 Fall 2013, Midterm Examination October 18, 2013 Please do not turn the page until the bell rings. Rules: The exam is closed-book, closed-note, closed calculator, closed electronics. Please stop

More information

C++ DATA TYPES BASIC CONTROL FLOW

C++ DATA TYPES BASIC CONTROL FLOW C++ DATA TYPES BASIC CONTROL FLOW Problem Solving with Computers-I Chapter 1 and Chapter 2 CLICKERS OUT FREQUENCY AB Review: Program compilation What does it mean to compile a C++ program? A. Write the

More information

CS121/IS223. Object Reference Variables. Dr Olly Gotel

CS121/IS223. Object Reference Variables. Dr Olly Gotel CS121/IS223 Object Reference Variables Dr Olly Gotel ogotel@pace.edu http://csis.pace.edu/~ogotel Having problems? -- Come see me or call me in my office hours -- Use the CSIS programming tutors CS121/IS223

More information