JAVA QUESTIONS HELP!!!!!

Hi there im a student and have an exam on java coming up next week, i have a few past paper questions that im stuck with if anyone can help that would be great.....
1.) Java implements generic types by erasure: what does this mean?
A. The compiler removes references to parameter types and inserts casts wherever return types refer to parameter types.
B. The programmer must comment out references to parameter types before code is compiled.
C. The compiler removes any casts that may be type-unsafe. 􀀀
D. The compiler removes any references to parameter types and inserts references to the closest super class that will make expressions type-safe.
E. Any type-unsafe casts to parameter types will be ignored by the interpreter at run-time.
2.) In Remote method Invocation, what is meant by �marshalling�?
A. Marshalling is the process of synchronizing all parameters to the method being invoked, in order to
prevent data corruption arising from the concurrent method call. 􀀀
B. Marshalling is the process of sending a copy of the remote object to the client JVM in order to
invoke its method locally. 􀀀
C. Marshalling is the process of sending the state of the client JVM on a byte stream to the remote
object in order that the JVM can be started as a separate thread on the remote host. 􀀀
D. Marshalling is the process of suspending the current thread in the client JVM until a result is obtained
from the remote method invocation. 􀀀
E. Marshalling is the process of sending the state of all parameter instances on a byte stream to the remote object.
3.)What is the immediate superclass of javax.swing.JFrame?
A. java.lang.Object 􀀀
B. javax.swing.Window 􀀀
C. javax.swing.JComponent 􀀀
D. java.AWT.Window 􀀀
E. java.AWT.Frame
4.) What is the immediate superclass of javax.swing.JComponent?
A. java.lang.Object 􀀀
B. java.AWT.Component 􀀀
C. java.AWT.Container 􀀀
D. java.AWT.Window 􀀀
E. javax.swing.Object
5.) Which of the following statements about the java.AWT and javax.swing packages is true?
A. All components in both packages are thread-safe􀀀
B. Most components in both packages are thread-safe􀀀
C. Most components in java.AWT are thread-safe, but most in javax.swing are not􀀀
D. Most components in javax.swing are thread-safe, but most in java.AWT are not􀀀
E. No components in either package are thread-safe􀀀
6.) Which of the following best describes how AWT events are handled in Java?
A. There is a special thread that handles all AWT events. 􀀀
B. Each AWT event causes a new thread to be created to handle that event. 􀀀
C. All AWT events are handled in the main thread. 􀀀
D. The programmer must explicitly create one thread to handle all AWT events. 􀀀
E. For each AWT event, the programmer must explicitly create a thread to handle that event. 􀀀
7.) Which of the following best describes how component-generated events can be handled in Java?
A. All component-generated events are handled automatically by the Java interpreter. 􀀀
B. The programmer creates instances of appropriate listener classes, and registers these instances with
the component; when the component generates an event, the relevant methods of all registered
listeners are executed. 􀀀
C. The programmer creates instances of appropriate listener classes, and registers these instances with
the component; when the component generates an event, one of the registered listeners is chosen by
the interpreter and the relevant method of that instance is executed. 􀀀
D. The programmer must declare a subclass of the component and add one method for each type of
event the component can generate; when the component generates an event, the appropriate method
is executed. 􀀀
E. Each component class has event-handling methods; the programmer declares a subclass of the
component and overrides those methods; when the component generates an event, the overridden
method is executed. 􀀀
Any help would b great thanks guys. Andy

1.) Java implements generic types by erasure: what
does this mean?
A. The compiler removes references to parameter types
and inserts casts wherever return types refer to
parameter types.
B. The programmer must comment out references to
parameter types before code is compiled.
C. The compiler removes any casts that may be
type-unsafe. 􀀀
D. The compiler removes any references to parameter
types and inserts references to the closest super
class that will make expressions type-safe.
E. Any type-unsafe casts to parameter types will be
ignored by the interpreter at run-time.None of the above (assuming this is not a Google translation of some non-English text).
2.) In Remote method Invocation, what is meant by
�marshalling�?
A. Marshalling is the process of synchronizing all
parameters to the method being invoked, in order to
prevent data corruption arising from the concurrent
method call. 􀀀
B. Marshalling is the process of sending a copy of
the remote object to the client JVM in order to
invoke its method locally. 􀀀
C. Marshalling is the process of sending the state of
the client JVM on a byte stream to the remote
object in order that the JVM can be started as a
separate thread on the remote host. 􀀀
D. Marshalling is the process of suspending the
current thread in the client JVM until a result is
obtained
from the remote method invocation. 􀀀
E. Marshalling is the process of sending the state of
all parameter instances on a byte stream to the
remote object.None of the above. Although there is one answer that at least describes how Marshalling is used.
3.)What is the immediate superclass of
javax.swing.JFrame?
A. java.lang.Object 􀀀
B. javax.swing.Window 􀀀
C. javax.swing.JComponent 􀀀
D. java.AWT.Window 􀀀
E. java.AWT.FrameAt least this one does have the correct answer. It's in the API docs, so I guess it'd be hard to be wrong.
4.) What is the immediate superclass ofDitto.
5.) Which of the following statements about the
java.AWT and javax.swing packages is true?
A. All components in both packages are
thread-safe􀀀
B. Most components in both packages are
thread-safe􀀀
C. Most components in java.AWT are thread-safe, but
most in javax.swing are not􀀀
D. Most components in javax.swing are thread-safe,
but most in java.AWT are not􀀀
E. No components in either package are
thread-safe􀀀Again, none of the above.
6.) Which of the following best describes how AWT
events are handled in Java?
A. There is a special thread that handles all AWT
events. 􀀀
B. Each AWT event causes a new thread to be created
to handle that event. 􀀀
C. All AWT events are handled in the main thread.
􀀀
D. The programmer must explicitly create one thread
to handle all AWT events. 􀀀
E. For each AWT event, the programmer must explicitly
create a thread to handle that event. 􀀀One answer is almost, sort of, correct. Wow.
I can understand why you're having problems answering these questiosn. Well, there's no excuse for the questions that come out fo the Javadocs, but for the others ... it explains a lot about the quality of recent graduates.

Similar Messages

  • Stupid Java Question (Help Needed!!!)

    I have a piece of Java Code that dynamically builds a SQL statement (including VARCHAR2 columns). Oracle gives an error if my string has a single quote in it. I need to replace each single quote with two single quotes in Java, i.e. I need a Java equivalent of PL/SQL REPLACE function.
    Java str.replace only replaces an individual character (see below).
    String l_str = "O'Hara";
    String l_str2 = l_str.replace('\'', '\'');
    I need to replace "O'Hara" with "O''Hara". Any help is appreciated

    Please don't post same question on both forums.
    Please find the answer at:
    Re: ORA-09004

  • Simple java question, help please

    please help
    -i am just starting out in java and im havin an early problem. Im trying to run a small java script from a commant prompt but im getting the following error after i enter this command at my prompt
    c:\javatest>javac HelloARP.java
    javac is not as an internal or external command, operable program or batch file.
    when i enter
    c:\java -version
    i get the following message: registry key software\javasoft\java runtime enviornment\current version has value of 1.1 but 1.4 is requiured
    error: could not find java.dll
    error: could not find java 2 runtime enviornment
    -im sure this is a simple error on my part. all im trying to do is run my first lil program that i saved in notepad, its only 5 lines long. here is the lil test program im trying to execute
    class HelloARP {
    public static void main (String[] arguments) {
    System.out.println("What's good ARP?");
    - all responses and help are welcomed. Thank you ahead of time for anyone that can help me get started.

    Hi
    First of all uninstall your current JDK installation, if you can get to the registry delete the registry entries for the old version of java which was there on your machine.
    Now do a fresh install of your j2sdk1.4.1, make sure that you will install the JRE with the J2SDK1.4.1.
    Once you are done, set your classpath in autoexec.bat if you are using Windows 95/98
    or set your environment variables if you are using Win NT/2000/XP.
    If using solaris or other unix flavors see the included installation instructions provided.
    Let me if you face the same problem.
    Thanks
    Swaraj

  • Java question help (applying binary search)

    please show me how do i apply a binary search inside this program where i can use the binary serach to search for the book author or book title
    // objectSort.java
    // demonstrates sorting objects (uses bubble sort)
    // to run this program: C>java libmainsys
    class libary
    private String booktitle;
    private String bookauthor;
    private String publisher;
    private int yearpublished;
    private int edition;
    private int nofcop;
    public libary(String title, String author, String pub, int yrpub, int edt, int nfcp)
    {                // constructor
    booktitle = title;
    bookauthor = author;
    publisher = pub;
    yearpublished = yrpub;
    edition = edt;
    nofcop = nfcp;
    public void displaylibary()
    System.out.print(" Book Title: " + booktitle);
    System.out.print(", Book Author: " + bookauthor);
    System.out.print(", Book Publisher: " + publisher);
    System.out.print(", Year Published: " + yearpublished);
    System.out.print(", Edition: " + edition);
    System.out.println(",No Of Copies : " + nofcop);
    public String getLast() // get title
    { return booktitle; }
    } // end class libary
    class ArrayInOb
    private libary[] nfcp; // ref to array ypub
    private int nElems; // number of data items
    public ArrayInOb(int max) // constructor
    nfcp = new libary[max]; // create the array
    nElems = 0; // no items yet
    // put libary into array
    public void insert(String title, String author, String pub, int yrpub, int edt, int nofcop)
    nfcp[nElems] = new libary(title, author, pub, yrpub, edt, nofcop);
    nElems++; // increment size
    public void display() // displays array contents
    for(int j=0; j<nElems; j++) // for each element,
    nfcp[j].displaylibary(); // display it
    System.out.println("");
    public void bubbleSort()
    int i, j;
    libary temp;
    for (i = nElems-1; i >= 0; i--)
    for (j = 1; j <= i; j++)
    if (nfcp[j-1].getLast().compareTo(nfcp[j].getLast())>0)
    temp = nfcp[j-1];
    nfcp[j-1] = nfcp[j];
    nfcp[j] = temp;
    } // end class ArrayInOb
    class libmainsys
    public static void main(String[] args)
    int maxSize = 1000; // array size
    ArrayInOb arr; // reference to array
    arr = new ArrayInOb(maxSize); // create the array
    arr.insert("Java_how__to_program", "Patty_John", "Deitel", 2001, 1, 430);
    arr.insert("System_Design", "Dexter_Smith", "Thomson", 2002, 3, 450);
    arr.insert("Program_Design", "Lorraine_Paul", "About", 1996, 2, 196);
    arr.insert("Computer_Architecture", "Paul_Andrew","Dzone", 2006, 5, 199);
    arr.insert("Visual_Basic_How_To_ Program", "Tom_Jones", "Jeffereson_publication", 2007, 4, 207);
    arr.insert("Information_ Management", "William_Peter", "Mcgraw_Hill", 1995, 3, 204);
    arr.insert("Sofware_ Application", "Henry_Sam", "Pearson", 2001, 6, 278);
    arr.insert("English", "Samantha_Julia", "James_Hill", 2005, 1, 200);
    arr.insert("Web_Publishing", "Audrey_Cynthia", "Surg", 2004, 3, 201);
    arr.insert("Human_Computer_Interaction", "Tony_Edward", "Telde", 2003, 3, 199);
    System.out.println("Before sorting:");
    arr.display(); // display items
    arr.bubbleSort(); // insertion-sort them
    System.out.println("After sorting:");
    arr.display(); // display them again
    } // end main()
    } // end class libmainsys

    I see you haven't worked out bubbleSort either. Since binary search only works on sorted arrays, I suggest you start there. Do you have the algorithms somewhere?
    If you really need to be able to search using either author or title, I suggest you create 2 Comparators that compare using the desired property. Comparator is just an interface that defines methods to compare 2 objects. You have to write your own implementation of it to compare library objects. You'll always have to sort and search using the same Comparator.

  • Java Question... please help

    I am running  Snow Leopard  (mac os x version 10.6.8)
    For the past couple of years I've played gin in yahoo games.  
    Yesterday when I entered the gin lobby ...the font was so tiny
    I wasn't able to read it.   I checked Java on my computer and
    it is enabled, however I just realized when I go into the gin
    lobby... there is no java icon on the dock.   Since the font size
    is fine in all other applications, I am presuming this is a Java
    issue.  
    Help if you are able.. please and thanks

    Huh? Is this a Java question? Where's the Java? I just see a little JavaScript. Do you know how to use servlets and JSPs?
    Jesper

  • About Java 2 opaque font color question, help needed!

    About Java 2 opaque font color question, help needed!
    I was trying to test opaque font (the string has a foreground color and a background color), but i can't find the method for doing that.
    i can change foreground by Graphics2D.setPaint(Color.black).
    Anybody know how to change the background of the string?
    Thanks!

    Hi. The way I'd do it would be to use the font metrics to find the length of a string and draw a rectangle and then drawstring over the rectangle. If you want an example, I can post it although I suspect theres a better way.

  • Java Access Helper Jar file problem

    I just downloaded Java Access Helper zip file, and unzipped, and run the following command in UNIX
    % java -jar jaccesshelper.jar -install
    I get the following error message, and the installation stopped.
    Exception in thread "main" java.lang.NumberFormatException: Empty version string
    at java.lang.Package.isCompatibleWith(Package.java:206)
    at jaccesshelper.main.JAccessHelperApp.checkJavaVersion(JAccessHelperApp.java:1156)
    at jaccesshelper.main.JAccessHelperApp.instanceMain(JAccessHelperApp.java:159)
    at JAccessHelper.main(JAccessHelper.java:39)
    If I try to run the jar file, I get the same error message.
    Does anyone know how I can fix this?
    Thanks

    Cross-posted, to waste yours and my time...
    http://forum.java.sun.com/thread.jsp?thread=552805&forum=54&message=2704318

  • Java Access Helper problem

    I just downloaded Java Access Helper zip file, and unzipped, and run the following command in UNIX
    % java -jar jaccesshelper.jar -install
    I get the following error message, and the installation stopped.
    Exception in thread "main" java.lang.NumberFormatException: Empty version string
    at java.lang.Package.isCompatibleWith(Package.java:206)
    at jaccesshelper.main.JAccessHelperApp.checkJavaVersion(JAccessHelperApp.java:1156)
    at jaccesshelper.main.JAccessHelperApp.instanceMain(JAccessHelperApp.java:159)
    at JAccessHelper.main(JAccessHelper.java:39)
    If I try to run the jar file, I get the same error message.
    Does anyone know how I can fix this?
    Thanks

    sorry ab the multiple post, it was urgent for me to
    know the answer.
    I've JDK 1.4.2 and JAccessHelper should work with 1.3
    or later
    Can there be some kind of path problems?No, I doubt it. It's just some internal app failure - looks like it's trying to determine the running Java version, and is not doing a good job at it. But the failure has nothing per se to Java, it's that specific app - what are we supposed to know about that app though?

  • Apple id is disabled, to reset the password I do not know the email and security question. help what to do?

    apple id is disabled, to reset the password I do not know the email and security question. help what to do?

    Hi ingaosk,
    Thanks for the question. Based on what you stated, it seems like you did not receive the reset email. I would recommend that you read this article, it may be able to help you isolate or resolve the issue.
    If you didn't receive your Apple ID verification or reset email - Apple Support
    Thanks for using Apple Support Communities.
    Cheers,
    Mario

  • HT1349 I for get security question help my too rest , send to my mail :

    I send email for serves and send to my by email ling I tray eat not help my to rest my security question .
    No we to send security question to my email or what I down I tray from many days
    The serves send that and it,s not help : read it
    Hello,
    The following information for your Apple ID *********** was updated on 02/03/2013:
    Phone number(s)
    If these changes were made in error, or if you believe an unauthorized person accessed your account, please reset your account password immediately by going to iforgot.apple.com.
    To review and update your security settings, sign in to appleid.apple.com.
    This is an automated message. Please do not reply to this email. If you need additional help, visit Apple Support.
    Thanks,
    Apple Customer Support
    Tel my what I do I need my program and my many in my account and wan I need to seal program he asking security question , what I do
    I for get security question help my too rest , send to my mail : ***********
    <E-mail Edited by Host>

    Do not post your email adress here.
    Open your browser and go to iforgot.apple.com and follow the instructions there.

  • New to java(need help on access specifier)

    hi! i am new to java.plzzzzz help me i have to make a project on access specifier's i know all theroy.but
    i am unable to understand how i can define all specifiers practicly.i mean in a program.
    thanks.plzzzzzzzz help me

    the most common project i can think of is a payroll system..
    you can have real implementation of all the access specifiers
    good luck

  • Pascal to Java Please help me!

    I am truobled in creating a validation method for the user loging in....
    As I am perfect at Pascal can anyone translate the following pascla code to Java Please help me with this.
    PROGRAM USERLOGIN;
    TYPE
      USER_TYPE = RECORD
        USERNAME : STRING[15];
        PASSWORD : STRING[15];
    END;
        USFILE = FILE OF USER_TYPE;
    VAR
       USER: USER_TYPE;
       CKUSER: USER_TYPE;
       RECFILE : USFILE;
       I,J     : INTEGER;
    BEGIN
    WRITE('ENTER USERNAME:');READLN(CKUSER.USERNAME);
    WRITE('ENTER PASSWORD:');READLN(CKUSER.PASSWORD);
    FILESPEC :='USERFILE.USR';
    ASSIGN(RECFILE, FILESPEC);
    RESET(RECFILE);
      WHILE NOT EOF(RECFILE) DO
       BEGIN
         READ(RECFILE, USER);
         IF CKUSER.USERNAME = USER.USERNAME AND CKUSER.PASSWORD = USER.PASSWORD THEN
              LOGIN
        ELSE
              WRITE('USER NOT FOUND');
       END;
    END.Thank you

    Don't bother:
    http://forum.java.sun.com/thread.jsp?forum=54&thread=539277

  • What kind of Java questions can I ask?

    Here's a change:
    I want to interview some good java people. I have lots of Java questions in mind which I could ask them, however fellow JavaGuru's
    I would like some potential questions from you which I could ask someone who claims he/she is a good java programmer??
    I am asking because I want to be as fair as possible to the applicant and not ask them questions which I think are tough etc...

    Touchy subject.
    The language is not as important, as understanding programming concepts.
    So fine, when the programmer's horizont involves some abstraction levels.
    If a programmer can write an UML class diagram for a linked list.
    If a programmer knows a design pattern Singleton.
    If a programmer can write his/her own single linked list class with sorted insertion.
    Language concepts:
    - Why:
    import java.util.*;
    Map map = new HashMap();
    - Answer:
    Hiding the choice of implementation (HashMap) by using the more general
    interface Map.
    Don't expect much on an interview though. The situation might not be
    adequate to distinghuish between the good and the bad apples.
    Talking code is a good starting point, code of your making unfortunately.
    A good programmer will hesitate to show really useful code.
    A bad programmer might have stolen his/her code.
    The problem you might have, that you are in search of an expert, not
    having the expertise in-house. In that case you might get a better
    picture, talking about which IDE would be opportune, whether he/she
    has experience with the source version system CVS, what would his/her
    ideas be about coming projects.
    That would establish a common line of communication.

  • HT201363 I forget security question, help me recover?

    I forget security question, help me recover?

    You need to ask Apple to reset your security questions; ways of contacting them include phoning AppleCare and asking for the Account Security team, clicking here and picking a method for your country, and filling out and submitting this form.
    They wouldn't be security questions if they could be bypassed without Apple verifying your identity.
    (104340)

  • How I can enable Java ssv helper plugin silently for win7 users with IE9

    here is what happens:
    when I deploy java 7.21 on win7 users, after deployment when users try to Open their IE they get a login screen and apparently it is related to Java ssv helper plugin. it is trying to enable it and needs admin account/password. I am trying to deploy this to about 3000 computers and I dont want all of them start calling helpdesk for this.
    your help is appreciated.

    The following article describes how to create a shared preference file. You can either create preferences that individual users can override, or create locked preferences that individual users cannot override.
    http://kb.mozillazine.org/Lock_Prefs
    (Note: I don't have any personal experience with these files, but another volunteer might post some additional tips and tricks.)

Maybe you are looking for

  • Iterate through RichTable with custom cells

    Hi. I create a RichTable by drag and drop a view in DataControls. View is from table xxx and table contains only one column, binding description field in the table. This description is shown in an OutputText UI component. Then, I add a column with a

  • What caused the Windows 2008R2 Security event discarded

    Dear Support team, I have a windows 2008 R2 server, The security events didn't recorded from last year. 1. The maximum log size set to 100 MB, But the log file is 300 MB.  The retention was set to "archive the log when full,do not overwrite events".

  • MacBook Pro Retina 13 inch Late 2013 Wireless installation

    Hi, I want to install arch on my MBP, but Apple forgot to ship my thunderbolt-to-ethernet adapter. So I am currently trying to install arch without a wired connection. My problem is, that I am not able to achieve a wireless connection. ifconfig just

  • Safe to connect it without iTunes?

    This is actually more of a question before I risk trying something than a help post after something happens. I am currently relegated to using a computer that I don't have permission to install things on, so I can't install iTunes, and I forgot to br

  • Digital Cinema Display View grayed out sometimes

    This view is there sometimes and sometimes it is grayed out. At first I thought it was because I didn't have the Timeline selected but then I figured out I can't figure out why it's there only sometimes LOL. Any ideas?