Java Test Help.  Very little experience

Ok, first off I am taking a Java test for my school's computer science team. I was just placed on the team because they needed an extra person, so my Java experience is close to 0. I would just like to know how to find out some of the answers and what some things mean in the following questions:
1: What is the Sum of 123(subscript16) and DEF(subscript16)
The answer is F12(sub16).
What I need to know about this is how 123 and DEF = F12.
2. Here is the code:
int accum = 0;
for(int i = 1; i <= 25; i++)
accum = accum + 1;
System.out.print ( sub ) ;
The answer is 25. What do these terms mean like accum and i++? How would you get this answer?
3. They are asking what the output would be. Here is the code:
double b = 1.5;
b = b * 2 + 5 / 2;
System.out.println ( b ) ;
The answer is 5.0 What does double b mean and how would you find the answer to that?
4. They are asking for what the output would be. Here is the code:
boolean p = false;
boolean q = true;
System.out.print ( !p && !q ) ;
System.out.print ( " " ) ;
System.out.print ( ! (p && q) );
The answer is false true. I know that boolean has something to do with logic, but I do not understand this question.
Thanks a ton if you can help me. I'm just trying to know a couple of things so I can make a better score on the test. I know it would be easier if I learned step by step, but I am limited on time and any shortcuts and hints will be helpful.
Thanks.

schmidt1302 wrote:
2. Here is the code:
int accum = 0;
for(int i = 1; i <= 25; i++)
accum = accum + 1;
System.out.print ( sub ) ;
The answer is 25.No it's not. You must not have copied the problem correctly. Either that or it's a stupid trick question. sub hasn't been defined there.
Thanks a ton if you can help me. I'm just trying to know a couple of things so I can make a better score on the test. I know it would be easier if I learned step by step, but I am limited on time and any shortcuts and hints will be helpful.Well, it's OK to cheat then.
Just go learn step-by-step.

Similar Messages

  • I had a very bad experience with apple maps. It is not at all useful. How such application is developed by apple I dont undersatand. Pl help me how to remove it from my Iphone. Vijay from Hyderabad. India

    I had a very bad experience with apple maps. It is not at all useful. How such application is developed by apple I dont undersatand. Pl help me how to remove it from my Iphone. Vijay from Hyderabad. India

    Tell Apple.
    http://www.apple.com/feedback/iphone.html

  • About to fail Java..HELP

    Here's the story..I am horrable at Java. I took this class..I am having a lot of trouble and the teacher will not help me.. Here's my assignment..
    Write a program to compute mileage statistics for an automobile. Mr. Magoo has kept track of several tankfuls of gasoline by recording miles driven and gallons used for each tankful. Develop a Java application that will let Mr. Magoo input miles driven and gallons used (both ints) for each tankful and then display the miles per gallon obtained (a double). When Mr. Magoo enters -1 for miles, the program will display the total miles, total gallons, (both ints) and overall miles per gallon (a double, display rounded to 2 decimal places).Use a priming read similar to that found on page 4 of the Chap 4 handout. Continue processing input values until Mr. Magoo enters the sentinel value of -1. Use a message dialog at the start of the program that tells him what the valid input values are and what sentinel value to use to end processing. When Mr. Magoo enters an invalid amount (<= 0) for either value, there should be an error dialog box. Mr. Magoo might possibly enter two (or more) invalid amounts in a row! Make sure the program catches all invalid data.After Mr. Magoo enters the sentinel value, print out the totals. Invalid values are not included in the totals. There should be 1 information message which says "Valid miles and gallons are >0 and on the next line.."Enter -1 for miles to end processing" and then 1 box to enter mmiles, 1 to enter gallons, and an information message to say "MPG this tankful is: " TEST DATA:
         MILES     GALLONS
         155     6
         -300
         375     11
         284     8
         145     -5
         309     10
         -1
    heres my code which is very wrong, not complete and generated many errors:
    import javax.swing.JOptionPane;
    public class Mpg
    public static void main(String args[])
              String getMpg;
              double Mpg, gallons, miles;
              JOptionPane.INFORMATION_MESSAGE (null, "Valid miles and gallons are >0
              "\nEnter -1 for miles to end processing.");
              Mpg = Double.parseDouble(getMpg);
              Mpg = miles / gallons;
              JOptionPane.showInputDialog (null, "Number of miles: " + miles +","Results", JOptionPane.QUESTION_MESSAGE );
              JOptionPane.showInputDialog (null, "Number of gallons: " + gallons +", "Results", JOptionPane.QUESTION_MESSAGE );
              JOptionPane.showInputDialog (null, "MPG this tankful: " + Mpg +", "Results", JOptionPane.INFORMATION_MESSAGE );
              System.exit(0);
    I would be thankful for any help I can recieve. I have no idea how to make this program work. I am banging my head against walls!!!! Thanks Everyone!

    Hi,
    Whilst not agreeing with the tone of some of the messages the principle is correct up to a point.
    Anyway a little help is needed here :)
    Your program could be done in any language as its basically a procedural task. Lets look at that first.
    Your input screen - be it the command line or a JOptionPane must have a "switch" behind it that filters out unwanted input and only calls the mpg formula if the input is correct.
    To make the calculation you need to temporarily store two values "milestravelled" and "gallonsused"
    The input reciever should look for "milestravelled" first and when that has been correctly input ( > 0 ) it will treat the next input as "gallonsused".
    Once the two values are stores it should automatically - or by request - calculate the MPG figure and display it.
    Secondly, your code had some syntax errors I've corrected - there was an extra +" after the miles, gallons and Mpg variables
    JOptionPane.showInputDialog (null, "Number of miles: " + miles ,"Results", JOptionPane.QUESTION_MESSAGE );
    JOptionPane.showInputDialog (null, "Number of gallons: " + gallons , "Results", JOptionPane.QUESTION_MESSAGE );
    JOptionPane.showInputDialog (null, "MPG this tankful: " + Mpg , "Results", JOptionPane.INFORMATION_MESSAGE );
    Your information message declaration is not correct either. I suggest you check your syntax using the JDK documentation or your book.
    I hope that helps a little and will encourage you to work out the rest on your own.
    PS: Why are you using swing? A simple command line application would do fine for this task. Is it a course requirement or are you using a java development program to learn java. If its the second reason I think I can see why you're a bit lost. The IDE programs stick in a load of code that may not be necessary at all. The best way to learn is using the trusty JDK and notepad :)
    Bye

  • Java Card Help!!!!!!1

    hi all!
    please excuse me all along that i can make you lose, my name is Victor Romero I am student of 3 semester of systems engeniering at the University of Antioquia (Medellin-Colombia), here in my country the truth is that the new technologies are very little as much to study as to develop them, but I have conformed a training group to investigate about Java Card technology from Sun Microsystems. we have obtained two readers towitoko chipdrive and we are so happy by this step, but the truth until I have not been able to put work the environtmen correctly, i need to know if you can lend me some type of help. i know that you are a occupied persons and if I must pay some money by its collaboration please lets know me. At the moment I am working under windowsME what I must do? Thanks a lot

    The best you can do when you start with Java Card development downlaod the Sun tools from java.sun.com/products/javacard. Set up your environment as described in the documentations that comes with the tools. This allows you to get familar with Java Card. Later you can purchase a tool to do development for a real card product. You can use OCF to integrate your stuff into Java application that run on the desktop. There is also a good book about Java Card http://java.sun.com/docs/books/javacard/

  • Fundamental questions in Java, please help to answer.

    I am a beginner of a Java Programming. Although I had few programming experiences on Java. But there are few conceptal questions. Hope every experts can help to explain more to me.
    1. How <b>Encapsulation</b> works in Java? Why is it needed? What benefits can be given from encapsulation? Can give some examples for me to know more?
    2. How <b>Overloading</b> works in Java? Why is it needed? What benefits can be given from it in the extensibility of programs? Can give some examples for me to know more?
    3. How <b>inheritance</b> works in Java? What benefits can be given from inheritance? Can give further explanation, such as class hierarchy for me to know more?
    4. What is <i>object class</i> and <i>object distances</i> ? What is their differences?
    5. What is <b>Reusability</b>? What benefits can it gives? Why it is needed? Can give me further examples?
    Thanks for help very much

    Maybe I'm not getting this, but you want one of us to give you a nice short answer convenient enough for you to copy down, right? Well, there aren't many people here that are willing to do that. There are many people who won't even bother answering homework questions. I don't mind, but you need to show us some work you've done, like the previous poster said. The effort has to come from you, not us. If you are learning Java, you must put some effort into it.
    How can you get an answer out of us?
    Example: I understand that inheritance is ..............., but I'm not sure about this part.............. Can anyone provide some clarification please?
    Anyway, this question has been crossposted on at least 5 forums already, which I'm sure is one of the reasons people aren't bothering with this question. Please DO NOT CROSSPOST, it's considered poor forum etiquette.
    Please don't take anything that I said negatively, but you have to understand that we are taking our time to respond to your queries, and asking us to provide short answers without doing any work on your part, and crossposting is not going to get you answers out of us.
    Cheers

  • HT204266 My iphone keeps crashing and turning itself off.....even though battery life is fine...as soon as i plug charger in it comes bcak on....help very frustrating...3g

    My iphone keeps crashing and turning itself off.....even though battery life is fine...as soon as i plug charger in it comes bcak on....help very frustrating...3g

    absolutely that is frustrating. if the battery life is fine there could be two things software or hardware. to find out if your back up your information in itunes and import pictures and then restore the phone as NEW then you can test it out. if it is still shutting off it is hardware related

  • I have very little space left on the hard drive on my macbook, on my storage report it says "other" is taking up more than two thirds of the space on the hardrive. How can I identify what these files are?

    I have very little space left on the hard drive on my macbook, on my storage report it says "other" is taking up more than two thirds of the space on the hardrive. How can I identify what these files are?

    Hello,
    There is free software you can download that gives you a graphical image of what files are used on your hard drive. http://www.derlien.com/
    This may help you clean down your hard drive for more space.
    Best of luck

  • My Maxx HD keeps dropping calls and always has very little signal

    My maxx hd keeps dropping calls and always has very little signal.

        AngelMunoz2011,
    I am sorry to hear about your troubles with service on your phone. We definitely want to make sure that you are always receiving the best service options. What zip in general are you having the most trouble in? How many bars of signal are you typically getting?  Could you try clearing the cache on your device http://vz.to/KRifEf and also try removing/reinserting your 4g sim card. We are here to help, so please keep us updated.
    Thank you,
    TonyG_VZW
    Follow us on Twitter @VZWSupport

  • Solaris 8 rebooting with very little info as to why.

    I have a Sun E-250 with 2 400MHz CPUs and 1GB of memory. Lately my box will reboot without warning. I get a panic message in the logfile /var/adm/messages with very little other information. Those messages are as follows:
    Feb 22 10:48:01 storrs SUNW,UltraSPARC-II: [ID 727572 kern.warning] WARNING: [AFT1] EDP event on CPU0 Instruction access at TL=0, errID 0x00000262.3179c556
    Feb 22 10:48:01 storrs AFSR 0x00000000.80400008<PRIV,EDP> AFAR 0xffffffff.ffffffff
    Feb 22 10:48:01 storrs AFSR.PSYND 0x0008(Score 95) AFSR.ETS 0x00 Fault_PC 0x100db82c
    Feb 22 10:48:01 storrs UDBH 0x0000 UDBH.ESYND 0x00 UDBL 0x0000 UDBL.ESYND 0x00
    Feb 22 10:48:01 storrs SUNW,UltraSPARC-II: [ID 868619 kern.info] [AFT2] errID 0x00000262.3179c556 No error found in ecache (No fault PA available)
    Feb 22 10:48:01 storrs unix: [ID 836849 kern.notice]
    Feb 22 10:48:01 storrs ^Mpanic[cpu0]/thread=30001fa8f00:
    Feb 22 10:48:01 storrs unix: [ID 249780 kern.notice] [AFT1] errID 0x00000262.3179c556 EDP Error(s)
    Feb 22 10:48:01 storrs See previous message(s) for details
    Has anyone ever seen this before? Anybody have a clue as what to look into?
    Also, this box seems to be very slow in performing relatively simple commands. It gets hung up on "format" and "pkgadd". So it appears that anything I do which may affect or use the kernal hangs for a long period of time and then most times the system reboots.
    Please help if you can.

    I'm not quite sure what the error is about, but check the version of Solaris your running on the server. If it's less than Solaris 8, check that the server was built using the "Special Operating Environment CD".
    This CD has to be used when installing solaris 2.5, 2.6 or 2.7 ( I think ) on the new hardware like E220, E250, E420 etc.

  • Order number: {removed per fourm guidelines} - Very pathetic experience

    With the help of social media, I want to bring the very pathetic experience I had with best buy this festival season.
    Here is the brief details for my case  Order number: {removed per forum guidelines} Order date: 12/25/2014. I ordered brand new Samsung smart LED TV.
    First I have been billed more than I have placed order online. When I called customer care they told sorry for it and told that bill has been adjusted and provided me reference number. Second  I received the order with missing stand. When I called to customer care I have been informed that may be product is shipped by mistake as open box and they will give me 40 dollar gift card and replace the item. But  till date after writing around 15 email and 20 calls still my issue is not resolved. I have escalated the issue to escalation team/supervisor also but seems like there is no process for escalation.
    Till date issue is not resolved and neither I get the gift card not I got the correct bill. I will not recommend anybody to purchase any product from best buy.
    I was believing that best Buy is global brand and we can trust but seems like there is no process for escalation and they don’t care about any customer any more.

    Hello arvindstring,
    I apologize for the lateness of my reply. We've been playing catch up on the forum ever since Thanksgiving, so I appreciate your patience while waiting for assistance.  It’s disappointing to hear your TV arrived without a TV stand, especially as it was purchased during the holiday season.  As it seems there might be a few different issues surrounding your order, I’d be happy to look into this on your behalf.
    Using the email address provided to register on the forum, I pulled up your account, and I see that you’ve reached out to us quite a few times for assistance.  As I’d like to take this time to fully explain every issue you have clearly detailed, I’ve numbered out each issue you’ve brought to our attention.
    1)      Billing Issue: After looking at your online order, I see you purchased your Samsung TV for $349.99 (before tax).  When looking through your account, you mentioned the TV was supposed to be on sale for $329.99 on the day you purchased it. Using the SKU for the TV, I pulled up your item in our internal systems, and I was able to confirm the TV’s purchase price was $349.99. This could explain why you didn’t see the price adjustment on your billing statement.
    2)      $40 Gift Card: Please know that until you mentioned this gift card to us in one of your previous emails we have on file, we don’t have a record of offering you this credit. This may be why our agents are confused when you keep referring to this amount.
    3)      Missing Stand: While the order reflects a brand new TV was delivered to you, mistakes do occasionally happen, and I apologize if you incorrectly received an open box item. In order for us to correct this, it appears we provided you a return label on 1/05 and attempted to reship you a new TV at no cost to you. However, we have canceled this reshipment upon your request, as you wished to receive the aforementioned $40.00 gift card.
    As previously advised by our call center agents, please know that today is the final day you may return or your TV underneath your Return & Exchange Promise. In order to make sure you meet this deadline, please visit your local store for assistance or go to your local UPS hub with the return label we provided you.
    Respectfully,
    Alex|Social Media Specialist | Best Buy® Corporate
     Private Message

  • PLEASE HELP (Very New to web content)

    Hi guys. I made a website for a client in ImageReady. They
    wanted to be able to update with business news on thier own, and
    have me do the major site updates. I was thinking they could do
    this by me creating a blog on blogger for them and trying to figure
    out a way insert the blog into the website I created. I want to put
    into a specific spot on the website and the client wanted it to
    scroll so that customers can see previous posts. I know alot of you
    think that scrolling boxes kind of suck but for this purpose I
    really think it would work really cool. Can you please help me. I
    have very little knowledge of code. I am actually a video motion
    graphics guy, and because of my knowledge of photoshop started to
    move into web. So if you have to talk to me like an infant about
    the code, please do. : ) Here is the wbsite I want to add it to:
    http://www.xtremefitnessco.com.
    Text
    You can see on the main page the section I am using for the
    news. Thats were I want to put the scroll box. I guess I am asking
    how to do two things here:
    1. Insert a scroll box.
    2. And have that box pull from a web log that the client
    updates.
    Thanks for any help you can give me guys. Sorry for the
    novice question.
    P.S. Let me know if you think my design needs work or if you
    like it. : )

    >> if you think my design needs work
    All you have is a series of interchangeable images. You
    really haven't built
    a website. You have built an online PowerPoint show. There is
    no text. Turn
    off graphics in your browser and look at your site. Is that
    what you want
    some visitors to see?
    The mistake is building a site in Image Ready. Build your
    images there but
    add your text in DreamWeaver.
    Sorry, but were I you I would get a good book or two and
    start over. Might
    as well do it right than have a competent designer tell your
    client you did
    it wrong.
    Walt
    "lodus411" <[email protected]> wrote in
    message
    news:[email protected]...
    > Hi guys. I made a website for a client in ImageReady.
    They wanted to be
    able to
    > update with business news on thier own, and have me do
    the major site
    updates.
    > I was thinking they could do this by me creating a blog
    on blogger for
    them and
    > trying to figure out a way insert the blog into the
    website I created. I
    want
    > to put into a specific spot on the website and the
    client wanted it to
    scroll
    > so that customers can see previous posts. I know alot of
    you think that
    > scrolling boxes kind of suck but for this purpose I
    really think it would
    work
    > really cool. Can you please help me. I have very little
    knowledge of code.
    I am
    > actually a video motion graphics guy, and because of my
    knowledge of
    photoshop
    > started to move into web. So if you have to talk to me
    like an infant
    about the
    > code, please do. : ) Here is the wbsite I want to add it
    to:
    >
    http://www.xtremefitnessco.com.
    http://www.xtremefitnessco.com
    >
    > You can see on the main page the section I am using for
    the news. Thats
    were I
    > want to put the scroll box. I guess I am asking how to
    do two things here:
    >
    > 1. Insert a scroll box.
    >
    > 2. And have that box pull from a web log that the client
    updates.
    >
    > Thanks for any help you can give me guys. Sorry for the
    novice question.
    >
    > P.S. Let me know if you think my design needs work or if
    you like it. : )
    >

  • Help Very Very Very Ugent

    Hi
    I have problem with installing Oracle Developer Suite 10g (9.04.01) on Windows XP 2002 , sp2. The Universal Installer Comes and then checks the requirement then says all requirements met please wait after that it vanishes.I do not know what to do? Please help me.

    It is important to clearly specify the OS edition you currently are referring to.
    In this case, when the oracle installer window suddenly disappears without a trace means that the java.exe required to launch the Oracle Universal Installer is missing or is not the right jre version. Please check if your PATH environment variable points to some JRE different from the one that is included with the OUI.
    Additionally, the installer leaves a log, please check the contents of the logfile, in case OUI has added some further information on why it has closed.
    By the way, using "Help Very Very Very Ugent" as a thread title won't make all volunteers in the forum to leave what they are doing and go running to assist you. All threads are treated on a first come first served basis, and how fast it is answered depends on how many free volunteers are available, we all have real paid job to do and he we all are doing our best to help others for free. Urgent requirements can be raised at metalink where you can set a priority to your problem.
    ~ Madrid

  • Runtime.getRuntime().exec(java test)

    Hi,
    As part of a thesis for college, I am trying to execute a test java program. The program executes okay and I can read the results okay.
    Sample code.
    process = Runtime.getRuntime().exec("java test");
    InputStream iOutStream = process.getInputStream();
    InputStream ErrorStream = process.getErrorStream();
    However, I need to be able to execute a progam that reads a parameter from the screen. I tried to pass a parameter file but it doesn't work.
    process = Runtime.getRuntime().exec("java test <input.txt");
    I also tried just passing the parameters as a string array but it doesn't work either.
    process = Runtime.getRuntime().exec("java test 2, 2");
    Is there any other way that I can get the process to accept parameters?
    My deadline is looming so any help would be greatly appreciated.
    Thanks
    Eleanor
    [email protected]

    I think you are waiting when reading the output before you write to the stream until it becomes NULL or -1. That will never finish if the program you execute is expecting input!
    See a working example:
    This class does nothing than print a line on the console, then waits for a line of input, then prints the result again on the console. This is the class you'd execute from some other java code:
    import java.io.*;
    public class Input {
        public static void main(String args[]) {
            try {
                System.out.println("Before input");
                BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
                String s=r.readLine();
                System.out.println("Got line : " + s);
            } catch(Exception e) {
                    System.out.println(e.getMessage());
    }The following 'controls' the input-test class above, so compile the classes and execute the following one:
    import java.io.*;
    import java.lang.*;
    public class test {
        public static void main(String args[]) {
            try {
                Process p = Runtime.getRuntime().exec("java Input");
                BufferedReader r = new BufferedReader(new InputStreamReader(p.getInputStream()));
                BufferedWriter w = new BufferedWriter(new OutputStreamWriter(p.getOutputStream()));
                String s=r.readLine(); // You cannot read until NULL because that will not happen before you have 'input' something
                System.out.println("Got: " + s);
                w.write("cvxcvxcvx\n\r");
                w.flush();
                System.out.println("waiting result:");
                while( (s=r.readLine()) != null) { // read until finished.
                    System.out.println("after : " + s);
            } catch(Exception e) {
                    System.out.println(e.getMessage());               
    }

  • Error Pl help-Very urgent!

    Am getting the following error.Please help very urgent
    500 Translator.CompilationFailedExceptionCompiler errors:
    Found 1 semantic error compiling "D:/JRun4/servers/default/default-ear/default-war/WEB-INF/jsp/jrun__quicklinks2ejspf.java":
    502. for (Enumeration e = prioLinkBean.getGlobalTop() ; e.hasMoreElements() ;)
    <---------->
    *** Error: "prioLinkBean" is either a misplaced package name or a non-existent entity.
    Translator.CompilationFailedExceptionCompiler errors:
    Found 1 semantic error compiling "D:/JRun4/servers/default/default-ear/default-war/WEB-INF/jsp/jrun__quicklinks2ejspf.java":
    502. for (Enumeration e = prioLinkBean.getGlobalTop() ; e.hasMoreElements() ;)
    <---------->
    *** Error: "prioLinkBean" is either a misplaced package name or a non-existent entity.

    prioLinkBean.getGlobalTop();
    are u sure this method returns an Enumeration ???
    post ur code!
    [email protected]

  • 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

  • Re: Filters in Weblogic 5.1?

    No, I seriously doubt that 5.1 will ever support Servlet 2.3 spec, so,           you will not be able to use filters. On the bright side, 6.x doesn't support           final Servlet 2.3 spec either, so, if you really want to use filters you can      

  • Guiones cortos al exportar Word a Indesign CS4

    Cuando importo un archivo Word a Indesign, me elimina todos los guiones cortos. ¿Hay alguna manera de solucionar este problema? Gracias.

  • Can't drag across

    I'm trying (unsuccessfully) to exchange music files between my iMac and my laptop. Both machines are showing [in iTunes] each others libraries however when I try for example on the laptop to drag a song over from the iMac's library it doesn't drag ac

  • What happens when charger gives a green light

    If I left the charger on after a green light is shown and kept using it, which of the following is the real case? 1. the charge goes directly to the CPU, GPU, Harddisk, etc. without charging of the battery, or 2. the components above are still powere

  • TIP: Fix for crashing iPods on (notebook) USB ports!

    I've read many stories here about iPods crashing on updates, or otherwise behaving unpredictable whilst connected to a computer. I also encountered such problems. Now I've found that, particularly on notebooks, there is an energy setting on the USB p