What method do you use to set the location of a frame

Assignment Help JAVA Programming
Reference no: EM13494590

Write a program that converts US dollars into Canadian dollars, as shown in the following figure. The program let the user enter an amount in US dollars and display it equivalent value in Canadian dollars when clicking the Convert button. One dollar is 1.5 Canadian dollars. The layout should be designed following the draft layout shown in the second diagram.

479_Create a panel with BorderLayout.png

Question 5:

Answer the following questions by choosing the single most correct alternative from those given.
1. The method parses a string s to a double value.
a. double.parseDouble(s);
b. Double.parsedouble(s);
c. double.parseDouble(s);
d. Double.parseDouble(s);
2. What is the printout of the following code:
double x = 10.1;
int y = (int)x;
System.out.printIn("x is " + x + " and y is " + y):
a. x is10 and y is 10
b. x is 10.0 and y is 10.0
c. x is 11 and y is 11
d. x is 10.1 and y is 10
3. Which of the following is not a valid boolean expression.
a. (1 < x < 100);
b. (x = 1)11(x I= 1)
c. (x =< 5) & (x>=5)
d. The above are all wrong
4. Given the following method:
static void nPrint(String message, Int n) ( while (n > 0) {
System.out.print(message);
n-;
}
}
What is the printout of the call nPrint("a". 4)?
a. aaaaa
b. aaaa
c. aaa
d. invalid call
4. An array reference variable can be used in which of the following ways?
a. As a local variable
b. As a parameter of a method
c. Asa return value of a method
d. All of the above
5. Which of the following are valid array declarations
a. char(' charArray = new char(261:
b. Intl] words = new words[10];
c. chart] charArray = Computer Science";
d. double[3] nums = (3.5, 35.1, 32.0};
6. Suppose s1 and s2 are two strings. which of the following statements or expressions are Incorrect?
a. String s3 = 51 - s2;
b. int i = s1.compareTo(s2);
c. int j = s2.1ength():
d. char c = s1.charAt(stlength() - 1):
7. How can you Initialize a string with "123"?
a. String] string = {'l', '2', '3'};
b. String s = "123":
c. String s = new String("123");
d. both (a) and (c) are both fine, but (b) is better
8. Which method can be used to create an output object for file temp.td?
a. new Formatter('lemp.brt")
b. new Formatter(temp.bct)
c. new Formatter(new File("tempixt"))
new Formatter(File("tematd"))
9. When you implement a method that is defined in a superclass. you
a. Overload
b. Override
c. Copy
d. Call
10. The class is inherited by every Java class.
a. Class
b. Object
c. Number
d. Comparable
11. What method do you use to set the location of a frame on the screen?
a. setPosition
b. selLocation
c. setsize
d. setDimention the original method

12. What is the default layout manager for the content pane of a JFrame ?
a. FlowLayout
b. BorderLayout
c. GirdLayout cl. No default layout manager
13. What is the default layout manager for a JPanel?
a. FlowLayout
b. Borderlayout
c. GirdLayout
d. No default layout manager
14. draws a drcle whose center position is (400, 400) and whose radius is 50.
a. g.drawCircle(350, 350, 100, 100)
b. g.drawOval(350. 350, 100, 100)
c. g.drawCircle(400. 400. 50. 50)
d. g.drawOvale(400. 400. 50. 50)
15. What method do you use to set the text to the right of the icon in an instance jbt of JButton?
a. jbtsetHorizontalArignment(SwingContants.RIGHT)
b. bt.setVerticalAlignment(SwingContants.RIGHT)
c. btsetHorizontalTextPosItion(SwingContants.RIGHT)
d. btsetVerlicalTextPosition(SwingContants.RIGHT)
16. What method do you use to disable editing on an Instance jtf of JTextField?
a. jtt.setEditing(false)
b. jtt.setEditable(false)
c. ittenableEditing(false)
d. jltsetEcIlt (false)
17. Can a JComboBox instance generate the following events?
a. MouseEvent
b. ActionEvent
c. ItemEvent
d. All above
18. The method that executes immediately after the init() method in an applet is
a. destroy()
b. start()
c. stop()
d. run()
19. Which data structure is appropriate to store customers in a clinic for taking flu shots?
a. Stack
b. Queue
c. Priority Queue
d. Array List
20. Suppose List<String> list = new ArrayList<String>. Which of the following operations are correct?
a. list.add("Red");
b. list.add(new lnteger(100)):
c. list.add(new java.uULDate());
d. list.add(new ArrayList()):
21. To declare a class named A with two generic types. use
a. public class A<E>
b. public class A<E, F>
c. public class A(E) 1
d. public class A(E, F) }
22. Which of the data type below does not allow duplicates?
a. Set
b. List
c. Stack
d. LinkedList
23. Analyze the following code
import java.util.*: public class Test {
public static void main(String0 args) throws Exception (
Set set = new TreeSet();
setadd("Red"); setadd("Green"): set.add("Blue");
System.out.println(set.first());
}
}
a. The program displays Red
b. The program displays Blue
c. The program displays Green
d. The program may display Red, Blue, or Green.

24. which method do you use to test tt an element Is Ina set or list named tc?
a. (element instanceof [SOU (element instanceof Set)
b. xin(element)
c. x.contains(element) 0. x inctude(element)
25. Which method do you use to mid the number of elements In a set or list named r?
a. x.length()
b. x.count()
c. x.number()
0. x Size()
26. WhIch method do you use to remove an element from a set or list named x? a. x.delete(eleMent)
D. xremove(element)
c. x deletes(element)
d. x remOves(element)
27. wntr_n of the following is correct to sort the elements In a list Ist? a. 1St sort()
D. C011eCtiOnS.SOrt(ISt)
c. Arrays.sort(Ist)
d. new linkedList(new StrIngrred". 'green". "blue"))
29. Which method on a condition should you Invoke to causes the current thread to wait until the condition Is signalled?
a. ConditiOn.vraiteda
b. COnditiOn.awarta
c. comlnion.waitinga
0. COnditiOn.waita
30 Suppose that your program accesses MySOL or Oracle database. Which c4 to follovang staterneMs are true?
a. d the driver for MySOL and Oracle are not in the classpath, the program M have a runbme error. indicating that the driver Naas cannot be loaded
b. the database is not available. the program will have a runtime error. when attempting to create a Connection object.
C. If the database is not available. the program will have a syntax error.
d if the driver for MySOL and Oracle are not in the dasspar, the program ws have a syntax error
30. Analyze the following code.
ResubSel resullSet statement execuleOuery
(select arStName. ml, lastName from Student where laniMme" + " = 'smith");
System.out println(resullSet gelStrIng(1)).
Minch Of to toarmIng are right? (multiple Answers)
a if the SOL SELECT statemeM returns no result resubSet is null
b. resultSel getStnng(1) returns the erstName field in the mesa set
c mune! getStmg(1) returns the nv field in the result set
d The program MI have a runtime error. because the cursor in resultSet does not point to a row. You must use resubSet next() to move the cursor to the ersi row in the result set Subsequently. restaiSet mead() moves the cursor to the neat row in the result set

31 in a relational data model. provides the means for accessirg and manrthating data

a SOL
a Executor
C Structure
m Integrity
32 whim of the folloMng statements are true? (Muni* Afts*Cfs)
a You may load multiple ADC drivers xi a program
0. You may create multiple connections to a database.
C You Can send buena and update statements through a Statement object
m YOU may <reale multiple statements from one connection
33 TO execute a SELECT statement 'SOW • from Address' on a Statement oiled stmt. use a stmt execulerselect • from Andress"),
b. at m duery("Select * from Andreas").
C SIN execuleOumy(seled * from Address").
d situ execuleUmlaterseled * frC01 Addf CSC).
14 lAtuch of the lodging statements is not true?
a. A panel can be placed inside a panel.
b. A frame can be placed inside a frame.
c. A source object and a listener °bled can be the same.
d. A source object can register many listeners.
35. Mat should you use to positon a button with.. an application frame so that the size of the button is NOT affedeci by the frame size? a. a FlOvelayOut
b a GndlayOut
c. the center area of a BorderLayout
0 the East or Weal area of a BorderlayOut
e the North or South area of a BorderLayotil
36 F at wo the code in Comparable c = new Data();
a. <String>
b <1>
C <Date>
d. <E>
37. Analyze the following code
import java.utr;
public class Test (
public static void main (String II args) throws Exception
TreeSet set = new TreeSet();
set set.add("Yelow"); set.add("Green"); set.add("Blue"); SortedSet temp = set.headSet("Purple");
System.oul.println(temptirst());
a. The program displays Blue
b. The program displays Red
c. The program displays Green
d. The program displays Yellow
e. The program displays Purple
38. Which of the following is correct to create a list from an array?
a. new List(("red", "green', "blue"))
b. new List(new Stringrred", "green", "blue"))
c. Arrays.asList(new Stringrred", "green", "blue"))
d. new ArrayList(new Stringu("red", "green", "blue"))
e. new LinkedList(new Stringrred", "green", "blue"))
39. Much layout manager would you use to place three GUI components in a frame so that all components have the same sae?
a. GndLayout
b. F lowLayoul
C. 8orderLayout
d. CardLayout

Reference no: EM13494590

Questions Cloud

Compute factored receivables and write journal entries : Don't erase your work and leave a blank problem. If you start working, and find you are out of your depth, go on to another problem, but don't erase the work you put into that problem.
Journal entry to record the acquisition of the bonds : Prepare the appropriate journal entry to record the acquisition of the bonds
Explain how much will the ph increase if 0.010 mol of naoh : A buffer solution consists of 0.100 mol of acetic acid (Pka=4.74) and 0.100 mol of sodium acetate in 1.00 L of aqueous solution . How much will the PH increase if 0.010 mol of NaOH is added to the solution
Determine the maximum torque on the wire : A circular wire of radius 5.67 cm has a current of 3.27 A flowing in it. The wire is placed in a uniform magnetic field of 4.39 mT. Determine the maximum torque on the wire
What method do you use to set the location of a frame : Write a program that converts US dollars into Canadian dollars, as shown in the following figure. The program let the user enter an amount in US dollars and display it equivalent value in Canadian dollars when clicking the Convert button.
Classification of mike''s bad debt deduction : 2- Ron sell his business accounts receivable of $100,000 to Mike for $70,000 (70% of the actual accounts receivable). Mike later determines that he will be able to collect only $6,000 $10,000 receivable. Discuss the amount and classification o..
A combustion of the french fries the water has a temperature : A 250.0 g sample of french fries is placed in a calorimeter with 500.0 g of water and an initial temperature of 21.0 C. After combustion of the french fries the water has a temperature of 48.0 C
How fast is the student going at the bottom of the slide : A student, starting from rest, slides down a water slide. On the way down, a kinetic frictional force (a nonconservative force) acts on her.  how fast is the student going at the bottom of the slide
Explain the molecular electron configuration : For N2 1- draw the molecular orbital energy diagram showing electrons 2- give the molecular electron configuration 3- give the bond order for the molecule 4- predict if the molecule will be magnetic

Reviews

Write a Review

JAVA Programming Questions & Answers

  The drink machine should have a supply

When the applet starts, the drink machine should have a supply of 20 of each of the drinks. The applet should have a text field where the user can enter the amount of money he or she is giving the machine. The user can then click on a button to selec..

  What ways can vulnerable inmates be protected

What ways can vulnerable inmates be protected? Why are classification and housing assignments so critical to these populations?

  Explain a gui interface using advanced java swing classes

Implement a threads and a GUI interface using advanced Java Swing classes. The project will be graded according the criteria for the final project

  The desired functionality is for your programs to input

the desired functionality is for your programs to input pairs of natural numbers as theyre entered by the user until

  Consumer and business product and discuss

Name a product that could be described as both a consumer and business product and discuss why. Describe its attributes, uses and product perceptions of the customers in both markets.

  Examples of cultural productions from three cultures

Using specific examples of cultural productions from three cultures -Sumerians, Archaic Greeks (800-480 BCE), Classical Greeks (480-323 BCE)- explain how cultural values and ideals are reflected in the creation and style of cultural productions.

  Your project as a programming consultant is to create a

your project as a programming consultant is to create a program that develops an amortization schedule.nbsp your

  Report the last letter of each word in the string

Write a sequence of Java statements that report the last letter of each word in the string.

  Add a button that will read the text fields

Create a GUI with two text fields for inputting the dimensions of a rectangle. Identify these two text fields as Length and Width with labels. Add a button that will read the text fields and cause the GUI to display the area and perimeter of the r..

  Create a project in eclipse

Create a new project

  Program to translates a number into the closest letter grade

Write a program that translates a number into the closest letter grade. For example, the number 2.8 (which might have been the average of several grades) would be converted to B-. Break ties in favor of the better grade

  Write a program that plays a word game with the user

Write a program that plays a word game with the user. The program should ask the user to enter the following.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd