4th Quarter Cp.docx

  • Uploaded by: kent
  • 0
  • 0
  • May 2020
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View 4th Quarter Cp.docx as PDF for free.

More details

  • Words: 1,060
  • Pages: 3
Republic of the Philippines Department of Education Tarlac City Schools Division TIBAG HIGH SCHOOL (Formerly Maliwalo National High School-Annex) Tibag, Tarlac City FOURTH QUARTERLY ASSESSMENT (SY:2018-2019) ________________ Parent’s Signature Name:__________________

Date:______________

Section:_________________

Score:_____________

____1. It is a simple dialog box for graphical input/output a. JOptionPane b. JFrame ____2. A graphical window on the screen a. Frame b. Container ____3. import javax.swing.*;

c. JPanel

d. Jpane

c. Components

d. JOptionPane

public class SimpleFrame { public static void main(String[] args) { JFrame frame = new JFrame(); frame.setVisible(true); } } Is a sample program that creates and shows a _____ a. Frame b. JFrame c. SimpleFrame d. JSimpleFrame ____4. Default close operation is one of the properties of JFrame, how to set this propertis on java a. CloseOperation b. DefaulCloseOperation c. setDefaulCloseOperation d. SetOperation ____5. Setting the title of JFrame a. Title b. setTitle c. getTitle d.setgetTitle ____6. Create a set of classes/methods that can be used to write a multi-platform GUI a. Swing b. Javac c. Javax d. AWT ____7. A newer library written from the ground up that allows much powerful graphics and GUI construction a. Swing b. Javac c. Javax d. AWT ____8. Call ________ to make a frame appear on screen after creating it. a. setInvisible b. setVisible(true) c. setInvisible(true) d. setVisible ____9. It is the most common component of java a. Label b. Button c. String d. TextField

____10. it is a sample of what component of java? a. Label B. TextField c. TextArea d. String ____11. Specify exact pixel coordinates for every component a. FlowLayout c. Abstract Positioning c. Absolute Positioning d. Layout Managers ____12. Have special objects that decide where to position each component based on some criteria a. FlowLayout c. Abstract Positioning c. Absolute Positioning d. Layout Managers ____13. Here are some several common Java Layout managers except, a. FlowLayout c. GridLayout c. BoxLayout d. Layout Managers ____14. An object that holds components; it also governs their positions, sizes, resizing behavior a. Frame b. Container c. Components d. JOptionPane ____15. It treats container as a left-to-right , top-to-bottom page or paragraph a. FlowLayout c. GridLayout c. BoxLayout d. BorderLayout ____16. Create panels within panels a. FlowLayout c. Box Layout c. Composite Layout d. Layout Managers

____17. Predict output of following program int main() { int i; int arr[5] = {1}; for (i = 0; i < 5; i++) printf("%d ", arr[i]); return 0;

} a.

1 followed by four garbage values

b. 1 0 0 0 0

c. 1 1 1 1 1

d. 0 0 0 0 0

____18. int main() { int a[][] = {{1,2},{3,4}}; int i, j; for (i = 0; i < 2; i++) for (j = 0; j < 2; j++) printf("%d ", a[i][j]); return 0; } a. 1 2 3 4 b. Compiler Error in line “ int a[][] = {{1,2},{3,4}};” c. 4 garbage values ____19. Which of the following is FALSE about arrays on Java

d. 4 3 2 1

a. A java array is always an object b. Length of array can be changed after creation of array c. Arrays in Java are always allocated on heap d. A java array is always an array ____20. A variable that stores many values of the same type a. Element b. index c. array d. frame ____21. Array Declaration a. = new b. = new C. = d. = new ____22. Example of array declaration a. Int[] numbers = new int[10] b. Int[] numbers = new int[numbers] C Int[] numbers = int d. numbers = new int[numbers] ____23. what is the value of this program? double[] results = new double[6]; results[2] = 3.4; results[5] = -0.5; .a. 0 0 0 3.4 0 0 b. 0 0 0 3.4 0 0.5 ____24. System.out.println(data[-1]); is example of a. ArrayIndexOutOfBoundsException C IndexOutOfBounds

c. 0 0 3.4 0 0 0.5

d. 0 0 3.4 0 0 0.5

b. ArrayIndexOutOfBounds d. IndexOutOfBounds

____25. a.

declare the array of this output Boolean[] test = new new double [6] b. Boolean[] test = new new double [6] Test[2]=true test[3]=true C Boolean[] test = new new double [6] d. Boolean[] test = new new double [6] Test[4]=true test[5]=true ____26. What is the output of this program for (int i = 0; i < 8; i++) { numbers[i] = 2 * i; } a. 0|2|4|6|8|10|12|14 b. 0|3|6|9|12|15|18|21 c. 0|4|8|12|16|20|24|28 d. 0|1|2|3|4|5|6|7 ____27. One value in an array. A. Element b. index c. array d. frame ____28. A 0-based integer used to access an element from an array. A. Element b. index c. array d. frame ____29. What values would be stored into the array after this code? for (int i = 0; i < 8; i++) { numbers[i] = i * i; } A. 0|1|4|9|16|25|36|49 b 0|2|5|10|17|26|37|50 c. 0|3|6|12|19|28|39|52 d. 0|4|7|13|20|29|40|53 ____30. assigning a value to an array element A. <array name> [ ] = ; b. <array name> [ ] = ; C <array name> [ <10> ] = ; d. <array name> [ ] = <10> ; For 31 - 40 what is the output of this program * note answer the following on the box on the right side. // This program reads several days' temperatures from the user // and computes the average and how many days were above average. import java.util.*; public class Weather { public static void main(String[] args) { Scanner console = new Scanner(System.in); System.out.print("How many days' temperatures? "); int days = console.nextInt();

Write your answer here

int[] temperatures = new int[days]; // array to store days' temperatures int sum = 0; for (int i = 0; i < days; i++) { // read/store each day's temperature System.out.print("Day " + (i + 1) + "'s high temp: "); temperatures[i] = console.nextInt(); sum += temperatures[i]; } double average = (double) sum / days; int count = 0; // see if each day is above average for (int i = 0; i < days; i++) { if (temperatures[i] > average) { count++; } } // report results System.out.println("Average temp = " + average); System.out.println(count + " days above average"); } }

For 41 - 50 Write a program that will show the image below * note write your answer inside the box below.

Prepared by:

KENT ERIC M. NARRA

Noted: REBECCA K. SOTTO, Ph.D Principal III

Related Documents


More Documents from "Eva Dialogo"