Quiz
Java
Erstelle ein kostenloses Konto, um dieses Quiz zu beenden
Speichere deinen Fortschritt und sieh dir dein Endergebnis an.
oder mit deiner E-Mail registrieren
Schon ein Konto? Anmelden
Fragen in diesem Quiz (111)
1A GUI program has three parts:
- AWindows, Buttons, Mice
- BFrame, Code, Events
- CFrame, Panes and Containers
- DGUI Components, Graphics, Code
- EGUI Components, Event Listeners, Application Code
2When the paint() method of a frame object called?
- ANo right answer
- BThe main() method calls it once when the program starts
- CThe Java system calls it every time it decides to display the frame
- DThe Java system calls it once when the program starts
- EThe user calls it to display a frame
3What is the one component that nearly all GUI programs will have?
- AFrame
- BKeystroke
- CMonitor
- DButton
- EMouse
4Name of the class used to represent a GUI application window, which is optionally resizable and can have a a title bar, an icon, and menus.
- ALabel
- BDialog
- CFrame
- DWindow
- EPanel
5Which of these methods are used to register a mouse motion listener
- ANone of the mentioned
- BaddMouse()
- CaddMouseListener()
- DaddMouseMotionListner()
- EeventMouseMotionListener()
6Fill in the blanks so that the following draws a Frame containing "Hello"
- Aimport, drawString, paint
- Bextends, paint, drawString
- Cextends, draw, paint
- Dinclude, drawString, paint
- Eimplement, paint, drawString
7What is a container object in GUI programming?
- AA container is another name for an array or vector
- BA container is any class that is made up of other classes
- CA container is a primitive variable that contains the actual data
- DA container is an object like a Frame that has other GUI components placed inside of it
8What is it called when a program is written to respond to the button clicks, menu selections, and other actions of the user in whatever order the user does them?
- AEvent-driven programming
- BAction-driven programming
- CUser-driven programming
- DMouse-driven programming
9Which of the following sets the frame to 300 pixels wide by 200 high?
- Afrm.setSize( 300, 200 );
- Bfrm.setSize( 200, 300 );
- Cfrm.paint( 300, 200 );
- Dfrm.setVisible( 300, 200 );
10Which of these classes can be added to a Frame component
- AMenu
- BButton
- CPopupMenu
- DWindow
- EList
11Which of these are constants defined in WindowEvent class?
- AWINDOW_ACTIVATED
- BWINDOW_CLOSED
- CWINDOW_DEICONIFIED
- DAll of the mentioned
12Window is used for
- ACreating windows
- BModifying windows
- CCreating and handling windows
- DHandling windows
13Which corner of the screen has pixel coordinates (0,0)
- Atop-right corner
- Btop-left corner
- Cbottom-right corner
- Dbottom-left corner
14In Java, events are all the activities that occur between
- AThe user
- BThe applications
- CBoth a & b
- DNone of these
15Which of these classes can be added to any Container class, using the add method defined in Container class?
- AButton
- BCheckboxMenuItem
- CMenu
- DCanvas
16What is a Graphics object?
- AThe Graphics object represents the part of the Frame that you can draw on
- BThe Graphics object represents the whole Frame
- CThe Graphics object represents the entire monitor
- DThe Graphics object represents the graphics board
17Usually GUI programs are written by using existing software components provided in a toolkit. The Java toolkit used in this chapter is the
- AGUI toolkit
- BAbstract Windowing Toolkit
- CGraphics Event Toolkit
- DJava Enhancement Toolkit
18The AWT classes can be roughly categorized into the following groups
- AGUI Components
- BLayouts
- CGraphics Tools
- DEvent Handlers
- EAll of these
19Package of drawstring() method is
- Ajava.awt
- Bjavax.swing
- Cjava.applet
- Djava.io
20A GUI..
- Auses buttons, menus, icons
- Bshould be easy for a user to manipulate
- Cstands for Graphic Use Interaction
- Dboth a and b
- ENone of the mentioned
21EventObject class belongs to:
- Ajava.util
- Bjava.awt
- Cjava.lang
- Djava.sql
22.
- AForm, setVisible, setOn
- BFrame, setSize, setVisible
- CFrame, setVisible, setSize
- DWindow, setSize, paint
23Which of the following classes are derived from the Container class
- AComponent
- BPanel
- CMenuComponent
- DList
24Which of these is superclass of WindowEvent class?
- AWindowEvent
- BComponentEvent
- CItemEvent
- DInputEvent
25JAR stands for:
- AJava argument
- BJava array
- CJava archived
- DJava architechture
26Given:
What is the result?
- A20
- B100
- C1000
- D2
27Given:
What is the result?
- A0 tom 0 jerry 1 tom 2 tom 2 jerry
- B0 tom 0 jerry 1 tom 1 jerry
- C0 tom 0 jerry 2 tom 2 jerry
- D0 tom 0 jerry 1 tom 1 jerry 2 tom 2 jerry
28Given:
What is the result?
- ACompilation fails
- B16 mph, lope
- C24 mph, lope
- D27 mph, lope
29Given:
What is the result?
- ACompilation fails
- Balpha beta
- Cbeta beta
- Dgamma gamma
30Compilation of program is done by ______ compiler
- Ajavac
- Bjavaq
- Cjvm
- Djdk
31Javac included in
- AJVM
- BJRE
- CJDK
- DClass
32What does JDK stands for
- AJava Development Kit
- BJava Development Key
- CJava Directory Kit
- DJava Directory Key
33What does JVM stands for
- AJava Virtual Machine
- BJava Virus Machine
- CJava Virtual Mechanism
- DJava Virtual Manipulator
34What does JRE stands for
- AJava Runtime Environment
- BJava Running Environment
- CJava Runnable Environment
- DJava Runtime Exception
35Javac converts source code to the byte code as ______ file
- A.class
- B.java
- C.jar
- D.exe
36Source code saved as _____ file
- A.java
- B.class
- C.jar
- D.txt
37JVM executes the byte code generated by compiler and produce output
- ATrue
- BFalse
38_________ is a paradigm based on the concepts of “object” that contains data and methods
- AObject-oriented programming System
- BObject-based programming System
- CData-oriented programming System
- DMethod-oriented programming System
39An object that has more than one form is referred to as
- APolymorphism
- BAbstract
- CInterface
- DInheritance
40Keyword which is used to access the method or member variables from the superclass
- ASuper
- BUsing
- CIs_a
- DInstance of
41An _______ cannot provide any code at all, can provide only the signature
- AInterface
- BAbstract Class
42Which of the following is not a part of OOP?
- AMultitasking
- BInformation hiding
- CPolymorphism
- DEncapsulation
43Can objects of abstract classes be instantiated
- AFalse
- BTrue
44Information Hiding can also be termed as
- AEncapsulation
- BPolymorphism
- CAbstract
- DNone of the above
45One or more function that has different number of argument or different type of argument but all have same return type is called as
- AMethod overloading
- BMethod overriding
- CMethod overridden
- DNone of the above
46Pick the term that relates to polymorphism
- ADynamic binding
- BDynamic allocation
- CStatic allocation
- DStatic typing
47When sub class declares a method that has the same type arguments as a method declared by one of its superclass, it is termed as
- AMethod Overriding
- BMethod Overloading
- COperator Overridden
- DOperator Overloading
48Constructors are used to
- AInitialize a newly create object.
- BFree memory
- CTo create a subclass
- DTo build a user interface
49What modifiers are allowed for methods in an Interface
- Apublic, abstract
- Bprivate
- Cprotected
- Dnone of the above
50Two or more methods with same name in the same class with different arguments is called as
- AMethod overloading
- BMethod overriding
- CMethod overridden
- Dnone of the above
51To call a base class constructor in a derived class, is it needed to call the base class initializer
- AFalse
- BTrue
52Main method can be overridden
- AFalse
- BTrue
53Static methods cannot be accessed directly from the class level.
- AFalse
- BTrue
54When deriving from a private base class, the public, protected and private members of the base class become private members of the derived class
- AFalse
- BTrue
55The process by which one object can acquire the properties of another object
- AInheritance
- BEncapsulation
- CAbstract
- DPolymorphism
56An object is
- AOne instance of a class
- BAnother word for a class
- CA class with static methods
- DA method that accesses class attributes
57Access to private data or private methods is
- ARestricted to methods of other classes
- BRestricted to methods of the same class
- CAvailable to methods of the same class and other classes
- DNot an issue because the program will not compile
58Inheritance is the process of
- AUsing features from an existing class
- BUsing classes in the established standard Java Language library
- CCombining data and the methods, which process the data, inside the same module.
- DDividing a program into multiple related files for each class in the program.
59In an object-oriented programming language __________ is used to refer to one of two related but distinct notions, and sometimes to the combination thereof:
A language mechanism for restricting access to some of the object's components.
A language construct that facilitates the bundling of data with the methods operating on that data.- AEncapsulation
- BPolymorphism
- CAbstract
60If you do not implement any constructor in your class, Java compiler inserts a default constructor
- ATrue
- BFalse
61A concept of having more than one constructor with different parameters list
- AConstructor Overloading
- BConstructor Overriding
- CConstructor Overridden
- DMultiple Constructor
62String method equals() return boolean values
- ATrue
- BFalse
63Dividing number to zero is a example of ________ exception
- AArithmeticException
- BNullPointerException
- CNumberFormatException
- DNumberException
64A class is...
- AAn abstract definition of an object
- BAn object
- CAn executable piece of code
- DA variable
65What will be the value of "num" after the following statements? int num; num = (5+4); num = num / 9; num = 9;
- A9
- B1
- C2
- D0
66What displays from the following statements?
String word = "abcde"; for (int i = 0; i <4; i+=2) System.out.print(word[i]);- Aac
- Bbd
- Cace
- Dab
67Following code will result in:
class A {
int x = 1;
public static void main(String [] args) { System.out.println("x is " + x);
}}- ACompilation error
- Bx is 1
- CRuntime Error
- DRuntime Exception
68Java runs on _______.
- AAll of the above
- BMac
- CWindows
- DLinux
69Following code will result in:
int num = 6.7;- ACompilation error
- BRuntime error
- Cnum being 6.7
- Dnum being 6
70What is the difference between private and public functions ?
- APublic functions can be used by anyone, private can only be used by other code in the class you are writing
- BPublic functions can’t be used
- CPublic functions are free, you have to buy private ones
- DPublic functions are the only ones you can download
71Choose the appropriate data type for this value: "1"
- AString
- Bint
- Cboolean
- Ddouble
72What loop will display each of the numbers in this array on a separate line:
float [ ]
nums= {1.1, 2.2, 3.3};- Afor(int i = 0; i < 3; i++){ System.out.println(nums[i]); }
- Bfor(int i = 1; i < 3; i++){ System.out.println(nums[i]); }
- Cfor(int i = 0; i <= 3; i++){ System.out.println(nums[i]); }
- Dfor(int i = 1; i <= 3; i++){ System.out.println(nums[i]); }
73Choose the best definition of an object
- AAn instance of class
- BA thing
- CSomething you wear
- Dnone of the above
74Which of the following means that in order for the conditional to happen, either x must be less than 3 or y must be greater than or equal to 4?
- AIf ((x < 3) || (y > = 4))
- BIf ((x < 3) && (y > = 4))
- CIf ((x <= 3) || (y > 4))
- DIf (!(x < 3) || (y > = 4))
75Choose the appropriate data type for this value: "volatile"
- AString
- Bchar
- Cint
- Dboolean
76Choose the best definition for a Class.
- AAn object definition, containing the data and function elements necessary to create an object
- BA group of students in a class
- CAn action for a program
- Dnone of the above
77What does GUI stand for?
- AGraphical User Interface
- BGraphical Useful Interface
- CGrand User Interface
- DGraphical User Inheritance
78From what immediate base class is JTextField derived?
- AJText
- BJField
- CJTextComponent
- DJComponent
79What goes in the blanks so that a text field of 20 characters is put into the frame?
public TextExample()
{
text = new JTextField( ____ ) ;
_________( new FlowLayout() );
add( ____ );
}- Atext, setLayout, 20
- B20, setLayout, text
- C20, put, frame
- D20, set, text
80What is the class of Swing labels?
- AJLabel
- BLabel
- CSLable
- Dlabel
81How does FlowLayout() put components into the content frame?
- AStarts at the top, then left to right in each row.
- BStarts at the bottom, then right to left in each row.
- CStarts at the center, then spirals outward.
- DPuts the first component in the center, then squeezes the rest in around it.
82When does a text field generate an action event?
- AWhen the field has focus and the enter key is hit.
- BFor every character that is typed into the field.
- CWhenever the frame has focus and the enter key is hit.
- DWhen the text field looses focus.
83When the user is typing into a text field may corrections be made?
- ANo, each character is sent to the application program as soon as it is typed.
- BNo, hitting backspace or delete terminates input.
- CYes, up until the enter key is hit.
- DYes, but only by deleting the entire line and starting over.
84What method is used to read the text from a JTextField?
- AreadText()
- BgetText()
- CgetString()
- DputText()
85 Can the program put text into a JTextField?
- ANo, only the user can enter text.
- BYes, by using a JLabel
- CYes, by using setEditable()
- DYes, by using a setText()
86How can the user be prevented from entering text into a text field?
- ABy using setEditable( true )
- BBy using setEditable( false )
- CBy using setNotEditable()
- DBy using setVisible( false )
87What method changes the color of a content pane?
- AsetColor()
- BsetBackgroundColor()
- CsetBackground()
- DsetForegroundColor()
88In Java, what do you call an area on the screen that has nice borders and various buttons along the top border?
- AA window.
- BA screen.
- CA box.
- DA frame.
89What is the name of the Swing class that is used for frames?
- AWindow
- BFrame
- CJFrame
- DSwingFrame
90 What method sets the size of the displayed JFrame?
- AsetSize( int width, int height)
- BsetSize( int height, int width)
- CsetVisible( int width, int height)
- DsetVisible( int height, int width)
91The size of a frame on the screen is measured in:
- Ainches
- Bnits
- Cdots
- Dpixels
92What is the part of a frame that holds the graphical components?
- Acontent pane
- Bcontent provider
- Cdata frame
- Dwindow pane
93What type of object determines where GUI components are placed in a container?
- AThe layer organizer.
- BThe component manager.
- CThe frame manager.
- DThe layout manager.
94What method of a frame prevents (or allows) a user to change the size of the frame?
- AsetResizable()
- BsetStretch()
- CclearSizable()
- DclearUser()
95How does FlowLayout() put components into the content frame?
- ABy rows starting at the top, then left to right in each row.
- BStarts at the bottom, then right to left in each row.
- CStarts at the center, then spirals outward.
- DPuts the first component in the center, then squeezes the rest in around it.
96What type of component is a JPanel()?
- AContainer
- BJFrame
- CJButton
- DJWindow
97What is the default layout manager for JPanel?
- APanelLayout
- BFrameLayout
- CFlowLayout
- DBoxLayout
98Which alignment directions may be used with BoxLayout?
- AHorizontal only.
- BHorizontal and Vertical.
- CLeft aligned and Right aligned.
- DCentered and Justified.
99Can a JPanel be placed inside another JPanel?
- AYes.
- BNo, only visible components may be placed in JPanels.
- CNo, JPanel can't be nested.
- DYes, but only one JPanel may be placed inside another.
100Can a different layout manager type be picked for each JPanel ?
- ANo, only one type of layout manager is used for the entire frame.
- BYes, each container has its own layout manager, independent of any others.
- CNo, all JFrames in a frame use the same layout manager.
- DYes, but only if JPanels are nested.
101How are components added to a JPanel?
- AWith the set() method.
- BWith the add() method.
- CWith the put() method.
- DWith the setComponent() method.
102How may numbers be entered into a graphical interface?
- AThe user types text into a text box. The program must convert the text into a primitive numeric type.
- BThe user must push "num lock" on the keyboard so numbers, not text are entered.
- CThe user enters digits into a text box; the text box returns numeric data to the program.
- DUnless the digits are surrounded with quote marks, they are automatically numeric data.
103What type of object determines where GUI components go in the content pane?
- AThe layer organizer.
- BThe GUI manager.
- CThe layout manager.
- DThe frame hanger.
104 What is the class of Swing labels?
- AJLabel
- BLabel
- CSLable
- Dlabel
105How does FlowLayout() put components into the content frame?
- ABy rows starting at the top, then left to right in each row.
- BStarts at the bottom, then right to left in each row.
- CStarts at the center, then spirals outward.
- DPuts the first component in the center, then squeezes the rest in around it.
106When does a text field generate an action event?
- AWhen the field has focus and the enter key is hit.
- BFor every character that is typed into the field.
- CWhenever the frame has focus and the enter key is hit.
- DWhen the text field looses focus.
107What interface must a class implement in order to be a listener for button ActionEvents?
- ATextListener
- BRunnable
- CActionListener
- DImageConsumer
108What method is used to read the text from a JTextField?
- AreadText()
- BgetText()
- CgetString()
- DputText()
109What type of event does a button click generate?
- AActionEvent
- BButtonEvent
- CClickEvent
- DDoItEvent
110A certain graphical interface contains several components that generate action events. What should be done so that the different events can be recognized?
- AUse setEditable( true ) with each component.
- BUse setActionCommand() with each component.
- CMake every component a different type.
- DThe listener looks at the values in the variables to deduce which component an event is from.
111 If the user changes the size of the frame, what happens to the graphical components?
- AThey stay where they are; the frame just gets bigger.
- BThe layout manager changes the layout and re-distributes the components.
- CThe user can not change the size of a frame if the program used setSize.
- Drepaint() calls the frame's constructor, which puts everything back they way it started.
Informationen
- Beschreibung
- Quiz am Java, erstellt von Zara Klak am 30/05/2019.
- Autor
- Zara Klak
- Sprache
- English
- Aufrufe
- 81
- Bewertung
- Noch keine Bewertungen Bewerte dieses Quiz