Java Programming Competition Sample Questions

Hi,
I am interested in participating the Java Programming Competition in my University. For pratice can you point me to some website with sample questions or any question u have in mind.
Thanks
Satish

I was thinking of putting up on-forum competitions, winner gets dukes etc.
Someone find an empty forum and we can get on it.

Similar Messages

  • Astrology Java Program- a tough question

    I need someone to help me in my project...here is the question:
    Write an astrology program. The user types in his or her birthday(month,day,year),
    and the program responds with the user's zodiac sign, the traits associated with each sign
    the user's age(in years,months,day), the animal sign for the year(e.g., Year of the Pig,
    Year of the Tiger), the traits associated with each animal sign, and if the year is a leap
    year or not. The dates covered for each sign can be searched through the horoscope section
    of a newspaper or through the internet. Then enhance your program so that if the user is one
    or two days away from the adjacent sign, the program outputs the nearest adjacent sign as well
    as the traits associated with the nearest sign. The month may be entered as a number from 1 to 12
    or in words, i.e.,January to December. Limit the year of the birthday from 1900 to 2010 only.
    The program should allow the user to repeat the entire process as often as desired.
    You can use this imports:
    import java.text.DateFormat;
    import java.util.Date;
    import java.util.Calendar;
    thanks for your reply! I am hoping for your kind consideration!

    edit
    1. Please continue in your [_earlier thread_|http://forums.sun.com/thread.jspa?threadID=5429726], don't flood the forum with your homework assignment.
    2. Please confine your questions to the "New to Java" forum until such time as you can regard yourself as a Java Programmer.
    I'm locking this thread and it will be removed later.
    Edited by: DarrylBurke

  • How to do "java Program 50 7" when using Eclipse?

    If you use the command-line environment to compile and run a java program called Sample.java instead of using Eclipse, you could compile by writing "java Sample 30 5" or replace the 30 and 5 with other numbers (lets suppose the Sample.java needs 2 int inputs). How would you do the equivalent of that when using Eclipse?
    Thanks!

    In the Run , there is an arguments tab ..

  • How to eliminate ^M in files thru java program

    Hi guys,
    SOS!!!
    I need to know how to eliminate ^M from files using a java program. This question was posted many times, but no one answered the question. Does anyone know the answer. Post the answer if anyone knows it.
    Thanks guys n gals.

    You need to create new strings with the /r stripped off
    /** Takes a string, and replaces the replace text with new text.
    * @param str String to replace into
    * @param pattern Pattern of text to replace.
    * @param replace What to replace it with.
    * @return str with the replace text replaced with the new text.
    protected static String replace(String str,String pattern, String replace) {
    int s = 0;
    int e = 0;
    StringBuffer result = new StringBuffer();
    while ((e = str.indexOf(pattern, s)) >= 0) {
    result.append(str.substring(s, e));
    result.append(replace);
    s = e+pattern.length();
    result.append(str.substring(s));
    return result.toString();
    }

  • Java programing contest

    Is there any Java programing competition?
    open to any programmer ?
    where ? (url ?)

    if your a student, try http://www.topcoder.com

  • Java Programming Language questions...???

    Hi everybody....
    Can I post here my questions about Java Programming Language....or only to to the relevant Sun's forum....http://forum.java.sun.com/index.jspa???
    My greetings,
    Simon

    Simon,
    sure, the worst thing that could happen is that people point you to the SUN forum. Usually this forum answers general Java questions.
    Frank

  • Java programming language main method question?

    Hello everyone I am quite new to the Java programming language and I have a question here concerning my main method. As you can see I am calling 4 others methods with my main method. What does the null mean after I call the method? I really don't understand is significance, what else could go there besides null?
    public static void main(String[] args)
              int cansPerPack = 6;
              System.out.println(cansPerPack);
              int cansPerCrate = 4* cansPerPack;
              System.out.println(cansPerCrate);
              have_fun(null);
              user_input(null);
              more_java(null);
              string_work(null);
         }Edited by: phantomswordsmen on Jul 25, 2010 4:29 PM

    phantomswordsmen wrote:
    ..As you can see I am calling 4 others methods with my main method. 'Your' main method? Your questions indicate that you did not write the code, who did?
    ..What does the null mean after I call the method?.. 'null' is being passed as an argument to the method, so there is no 'after the method' about it.
    ..I really don't understand is significance, what else could go there besides null? That would depend on the method signatures that are not shown in the code snippet posted. This is one of many reasons that I recommend people to post an SSCCE *(<- link).*
    BTW - method names like have_fun() do not follow the common nomenclature, and are not good code for a newbie to study. The code should be put to the pointy end of your sword.

  • Java Programming Question

    Hi,Everybody:
    I have a question about Java programming. If I want to write a java class code called if.java like below, how should I do to make it pass the java compiler and make it work. I know the words "if" and "for" are reserved words. I just try to figure it out that is it possible??? Do I need to create my own java compiler or recompiler?
    public class if
    public if() { }
    public static for test()
    return new for();
    public class for
    public for() { System.out.println("for class constructor"); }
    }

    I don't think you can bypass the compiler's rejection of this. There is little point to naming the classes after keywords. Not sure if it's case sensitive though, so maybe "If" or "For"? Otherwise, try "if_" or "for_"

  • Question about Java programming development

    There are five phases in java program development. They are: edit -> compile -> load -> verify -> execute
    However, every time I develops program. I only experience phase 1, phase 2 and phase 5. I always miss phase 3 and 4. When do the class loader and bytecode verifier work? How do they work?
    Second question, how the legitimate programs can execute automatically without typing command java to invoke the interpreter?

    lighthero wrote:
    I still have some questions.
    1. I want to run the program just like the commercial software such as Adobe and MS Office.(just double click to run the program.) How do I execute a java program without typing command java every time?Create an executable JAR: [http://java.sun.com/docs/books/tutorial/deployment/jar/index.html]
    >
    2. How does the JIT compiler work?[http://www.google.ca/search?q=Java+JIT]

  • I want to write a java program that can add a user to a role or sub role to the Profile Database in iPlanet Portal Server 3.0. Does anyone has any idea or a sample program do such thing. Thanks, Tommy

    I want to write a java program that can add a user to a role or sub role to the Profile Database in iPlanet Portal Server 3.0. Does anyone has any idea or a sample program do such thing? Thanks, Tommy

    // create the user profile, get the handle back,
    // and set the membership profile attributes.
    ProfileAdmin newProfile = null;
    try {
    // the users profile name is the domain      
    // he belongs to plus their userName
    // you will request.domain if your doing this from a servlet, domain_name is the domain_name the user belongs too
    String profileName = domain_name + "/" + user;
         if (debug.messageEnabled()) {
    debug.message("creating profile for " + profileName);
    // create the user profile object
    newProfile = ProfileManager.createProfile(
    getSession(), profileName ,Profile.USER);
    UserProfile userProfile = (UserProfile)newProfile;
         // set the role the user is a member of. Default is to set
         // the users to the default role of the domain they surfed to
         StringBuffer roleName = new StringBuffer(64);
    // request.domain instead of domain_name if your doing this from a servlet ..
    Profile dp = getDomainProfile(domain_name);
    roleName.append(dp.getAttributeString("iwtAuth-defaultRole"));
         if (debug.messageEnabled()) {
    debug.message("setting role for " + user + " = " + roleName);
    userProfile.setRole(roleName.toString());
    newProfile.store(false);
    } catch (ProfileException pe) {
         debug.error("profile exception occured: ",pe);
    return;
    } catch (ProfileException pe) {
         debug.error("login exception occured: ",le);
    return;
    HTH ..

  • Java Programming Questions

    I have taken a couple class in Java programming in just regular programming with GUI/console. I am looking to further my programming skills and wonder what course I need to take to become a java programmer for companies. I am confused on all this language in Java and there does not seem to be any reference to explain exactly what these technologies are. Example is.....What is J2EE? What is .JSP? Are they the same things? What environment is most commonly used in jobs? What about Java certifications?

    Here's the path tree to become a Java Programmer from Sun Microsystems:
    http://education.oracle.com/pls/web_prod-plq-dad/db_pages.getlppage?page_id=212&path=SJPF
    There are other paths like Web Development and Databasing, so click around if you're interested in those. I think for a standard Java Programming job you will want the "Java Programming for Professionals - Sun Certified Java Programmer".
    However, most Jobs are specialized and require skills like JSP Development or Java Enterprise. Look around at a job search site and see what types of skills Java jobs are asking for.
    I've noticed, for example, that Java web jobs generally require: PHP, HTML, JSP, XML, SQL, etc.

  • Question about Java Program

    I have a question here that I cant seem to figure out.
    I would really appreciate it if someone would help me out with the answer. I just got started learning Java and have a question:
    Suppose list is an array of five components of the type int. What is stored in list after the following Java code executes?
    for(int index = 0; index < 5; index++)
    list(index) = 2 * index + 5;
    if(index % 2 ==0)
    list[index] = list[index] -3;
    I would really appreiciate it if someone could help me out with this problem.

    This doesn't seem like a JSC-related problem, but I'll answer it anyways...
    list(index) = 2 * index + 5;This should probably be list[index] = 2 * index + 5
    The array will, after execution, contain
    {2, 7, 6, 11, 10}

  • Accessing oracle DB from a java program - question for oracle driver

    Hi,
    I have Oracle 10 G under vista on my desktop. I am trying to write a simple java program to access/update database tables. I saw in one of oracle example to import 2 packages - namely --- import oracle.jdbc.driver.*; import oracle.sql.*;
    Where do I find these 2 packages. Also I read some documentation to download drivers. I would like to use 2 drivers, the thin driver and the OCI driver. Can someone tell me where I can find these drivers and where do I copy these two drivers - so javac and java command can recognize it.
    I will greatly appreciate the help. Julia
    My program is as follows
    (It was working few years ago but things have changed now and I have Vista because my old machine died):
    import java.sql.*; // JDBC package
    //import com.inet.tds.JDBCRowSet;
    import java.util.*;
    import oracle.jdbc.driver.*;
    import oracle.sql.*;
    public class HomeDB
    run as follows:
    C:\Documents and Settings\MMM>cd \jj
    C:\john>set CLASSPATH=.;c:\oracle9i\classes12;%CLASSPATH%
    C:\john>javac HomeDB.java
    C:\john>java HomeDB
    King: 24000.0
    Kochhar: 17000.0
    De Haan: 17000.0
    Hunold: 9000.0
    Ernst: 6000.0
    Austin: 4800.0
    public static void main(String[] argv)throws SQLException
    Connection conn=null;
    try // may throw a SQLException
    conn = getConnection();
    doQuery (conn);
    catch (SQLException e)
    System.err.println(e.getErrorCode() + ": " + e.getMessage());
    finally // make sure the connection is closed
    if (conn != null) try {conn.close();} catch (SQLException e) {};
    //out.close(); // close PrintWriter stream
    private static Connection getConnection() throws SQLException
    String username = "scott";
    String password = "tiger";
    String url = "jdbc:oracle:thin:@localhost:1521:newora";
    // "jdbc:oracle:thin:@localhost:1521:COCKYJOB";
    Connection conn = null;
    String driver = "oracle.jdbc.driver.OracleDriver";
    try {
    Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
    } catch ( ClassNotFoundException cnfex ) {
    System.err.println(
    "Failed to load JDBC/ODBC driver." );
    cnfex.printStackTrace();
    }catch (Exception e){
    e.printStackTrace();
    //DriverManager.registerDriver(new oracle.jdbc.OracleDriver());
    conn = java.sql.DriverManager.getConnection(url,username,password);
    conn.setAutoCommit(false);
    return conn;
    private static void doQuery (Connection c) throws SQLException
    // statement to be executed
    String query = "SELECT ename, job, mgr FROM EMP";
    Statement st = null;
    ResultSet rs = null;
    try // make sure the close statements are executed (in the finally block)
    // create the statement
    st = c.createStatement();
    // execute the query
    rs = st.executeQuery(query);
    // process results
    while (rs.next())
    // get the employee last name
    String eName = rs.getString("ename");
    String eJob = rs.getString("job");
    String eMgr = rs.getString("mgr");
    System.out.println("Emp Name:" + eName +
    "Job: " + eJob +
    "MGR: " + eMgr);
    finally // make sure the close statements are executed
    // close the result set if it exists
    if (rs != null) try {rs.close();} catch (Exception e) {};
    // close the statement if it exists
    if (st != null) try {st.close();} catch (Exception e) {};
    Edited by: user455788 on Dec 19, 2008 9:13 PM

    You can download the drivers from http://www.oracle.com/technology/software/tech/java/sqlj_jdbc/index.html.
    Note that oracle.jdbc.driver is desupported after 10.2, http://forums.oracle.com/forums/ann.jspa?annID=201, so you might want to consider using a DataSource to provide Connections.
    E.G.
    {message:id=2819114}

  • Need help with Java programming installation question

    Sorry for my lack of knowledge about Java programming, but:....
    A while back I thought I had updated my Java Runtime Environment programming. But I now apparently have two programs installed, perhaps through my not handling the installation properly. Those are:
    J2SE Runtime Environment 5.0 update 5.0 (a 118MB file)
    and:
    Java 2 Runtime Environment, SE v 1.4.2_05 (a 108MB file)
    Do I need both of these installed? If not, which should I uninstall?
    Or, should I just leave it alone, and not worry about it?
    Yeah, I don't have much in the way of technical knowledge...
    Any help or advice would be appreciated. Thank you.
    Bob VanHorst

    Thanks for the feedback. I think I'll do just that. Once in a while I have a problem with Java not bringing up a webcam shot, but when that happens, it seems to be more website based than a general condition.

  • Java program question

    how would i write a java program that takes as input the distance of the commute in miles, the automobiles fuel consumption rate in miles per gallon, and the price of a gallon of gas. this program should then after output the cost of the commute.

    how would i write a java program that takes as input
    the distance of the commute in miles, the automobiles
    fuel consumption rate in miles per gallon, and the
    price of a gallon of gas. this program should then
    after output the cost of the commute.The same way anyone else would do it.

Maybe you are looking for

  • Objects look like bitmaps when importing vector files

    Hello, I am absolute beginner with ID CS5. I am going trough a bunch of tutorials, and there is one thing I cannot solve. When I am importing vector file content (Illustrator CS5 file with vector objects - strokes) into InDesign frame, imported objec

  • Problem with an iTunes gift

    I received an iTunes gift code from some relatives who live in the Uk. I live in Italy, so my account is italian and, apparently, I can't use the code in the italian iTunes store. Is that correct? I tried to create a new english account, but it's nec

  • Macbook pro 2011 mouse / keyboard not response in heavy load

    When I am playing games in the 2011 Macbook pro. Mouse clicks / keyboard sometimes not response or delay, this occur when the machine under heavy load. This won't happened in my old BLACK core duo Macbook. Does everyone notice this?

  • "why siri" doesn't seem to work unless we are charging the phone

    "why Siri" doesn't work unless we are charging our phones, why?

  • Skype not recognising web camera

    I have tried everything to get skype to recognise my web cam again. It used to work fine in a previous version of skype but now nothing seems to work. I have tried reverting back to an earlier version and only get the message "page not found". Skype