SCJP confusing question

Hello guys,
Recently I came across one web-site with mock-up SCJP questions. One of the questions and especially provided answer to it really grabs my attention:
Can one object access a private variable of another object of the same class?
Answer: Yes.
Private means "private to the class", NOT "private to the object". So two objects of the same class could access each other's private data.
If it would be true it violates the encapsulation principle of OO. Can you please explain this question/answer because it is really confusing me.

All kidding aside here - ask yourself: "Why would I want to make anything private in a class?". Then you might answer "Well, for one thing I do not want to be able to de-stabilize the class when I use it for what it is."
An example of such use is any use of the API classes from SUN. No instantiated Object from these has access to the private members, unless though public methods - which control such access.
But you might ask: "And why would I want to take that ability away from the class itself?" Well: "In answer you maight say that you would not want to, and continue by saying that's not what you mean."
Well since one would need to build in that capability - the previous example used an inner class with a change method - this is not the same as allowing outside access. If you tried to do something like from another toplevel public class without any public alteration methods in the member class you couldn't do it - you'd get a "x has private access in y" type message.
~Bill
.

Similar Messages

  • Oracle BI Mind Confusing Questions

    Hi,
    I am new to Oracle BI. I have been reading documents, tutorials, oracle by example guides and watching some videos.
    But I cannot answer some questions which are confusing my mind.
    1-) Why we have 3 repository layer? In the tutorials, they are dragging objects from physical layer to business model and mapping layer. In this layer they are renaming table names. Then they are dragging objects from Business Model to Presentation Layer. In this layer they are renaming table names again and they are deleting some columns. I think that we can use just physical layer and presentation layer. In presentation layer we can rename table names and remove some columns.
    2-) In physical layer, we are importing objects from data sources. We can import tables, views and foreign keys. What is the best practice for designing business model?
    I created a test repository. I imported tables, views and foreign keys from database. But when I try to check consistency ( afte preparing presentation layer), I took error messages about self joins in the physical layer. Can I solve self join problem?
    3-) Should I import only tables and views from database in physical layer? I think that if I do not ceate joins manually after import operations, Oracle BI Server may not prepare correct sql statements.
    We have a big database (maybe 500 tables), so if I dont import foreign keys, manually creating foreign keys will be a massive manual process. I also do not know which foreign keys are mandatory for a well designed business model?
    4-) When database tables changed( for. ex. added new column), are these changes automatically updated to the physical layer?
    Thank you..
    Edited by: user4030266 on Mar 24, 2011 1:58 PM

    3-) Should I import only tables and views from database in physical layer? Yes you need to import tables, you can create views on those tables if you want in physcial layer.
    I think that if I do not ceate joins manually after import operations, Oracle BI Server may not prepare correct sql >statements.Yes you need to give proper joins between fact and dimension tables in physical and bmm layers.
    We have a big database (maybe 500 tables), so if I dont import foreign keys, manually creating foreign keys will be a massive manual process. I also do not know which foreign keys are >mandatory for a well designed business model?Need to do datamodeling(ETL process first).Convert OLTP to OLAP(into facts and dimesnions) so that you will come to know regarding table and join conditions.
    In BMM layer we write logics,create our own logical tables with logical columns,hierrarchies.We use only columns that we need in this layer and write logics upon them.
    Refer : http://www.oraclebidwh.com/2010/10/obiee-bmm-layer-design-principalsbest-practices/
    Regards,
    Srikanth

  • SCJP Practice Question

    I'm working through the McGraw Hill SCJP study guide for Java 5, and I don't much care for the following question:
    (page 159)
    5. Select the two statements that best indicate a situation whit low coupling. (Choose two.)
    A. The attributes of the class are all private.
    B. The class refers to a small number of other objects.
    C. The object contains only a small number of variables.
    D. The object is referred to using an anonymous variable, not directly.
    E. The reference variable is declared for an interface type, not a class. The interface provides a small number of methods.
    F. It is unlikely that changes made to one class will require any changes in another.
    Answer:
    E and F are correct. Only having access to a small number of methods implies limited coupling. If the access is via a reference of interface type, it may be argued that there is even less opportunity for coupling as the class type itself is not visible. Stating that changes in one part of a program are unlikely to cause consequences in another part is really the essence of low coupling. There is no such thing as an anonymous variable. Referring to only a small number of other objects might imply low coupling, but if each object has many methods, and all are used, then coupling is high. Variables (attributes) in a class should usually be private, but this describes encapsulation, rather than low coupling. Of course, good encapsulation tends to reduce coupling as a consequence.
    I would have thought A and E were the answers here. If the attributes of a class are all private, you're going to have to use accessors and mutators to get to them, which is a prime example of loosely coupled code. I disagree that "F. It is unlikely that changes made to one class will require any changes in another." is a proper answer because although it does cut right to the heart of the matter, it does not describe the mechanism through which this feat has been accomplished and leads me to believe that perhaps the class has been designed with likely future changes in mind such that they will have a low impact but other unforseen changes may cause problems.
    Am I out of line here?
    If so, please enlighten me!
    If not, ... yarrrgh! If there are questions like this on the exam, I expect to have problems with them. Any suggestions? How can I get my reasoning to line up with the test, at least for the day of the exam? ;)
    Thank you in advance for any assistance!

    I think you're making a general mistake you have to come to terms with before you attempt the exam. You're reading stuff into the statements that aren't there. You must learn to consider the statements just as they stand and don't modify them in your mind.
    For example,
    If the attributes of a class are all
    private, you're going to have to use accessors and
    mutators to get to them,That's not what the statement says. It says all attributes are private, nothing else.
    it does cut right to the heart of the
    matter, it does not describe the mechanism through
    which this feat has been accomplishedWho said mechanisms must be provided? The statement cuts right to the heart of the matter as it stands.

  • GT70 - Win7 / Win8 BIOS - Confused + Questions

    I tried posting this in the BIOS forum but I didn't get any responses. I'm not sure if I should have posted here first.
    I have a GT70 Dominator Pro 890. It came with Windows 8.1 preinstalled. I don't want Windows 8.1; I'll be blanking the hard drive and installing Windows 7.
    Since this computer has separate Windows 7 and Windows 8 BIOS's available for download, this leads me to think that I need to change the BIOS from the "Windows 8" version to the "Windows 7" version. But there seems to be conflicting information on the Internet about this. Some posts say you can and should do it, others say you can't and shouldn't do it.
    So, my questions are:
    1) Should I be changing / flashing the BIOS from the "Windows 8" version to the "Windows 7" version for running Windows 7, and
    2) If not, should I continue to upgrade with the "Windows 8" BIOS version, even though I'm running Windows 7, and
    3) Will Windows 7 have any issues or not run right since the computer is running the "Windows 8" BIOS version?
    I *am* using two SATA drives in mirror RAID mode.
    The other thing that confuses me, is how (even for each Win7 / Win8 BIOS version), there are again two different versions.
    In the case of the GT70 Dominator 890 Pro, there is a version "50" for "WIN8 Default AHCI Mode", and version "70" for "WIN8 Default RAID Mode" (and a version 30 and a version 10 for the same two modes for Windows 7).
    Wouldn't the Default AHCI mode or Default RAID mode be something that the user specifies in the BIOS? Why would there need to be a totally separate BIOS version for these two different modes? (I thought RAID already has AHCI enabled?)
    Having four BIOS versions for the same computer is pretty distressing considering that I might brick it by installing the wrong one.

    Quote from: AllNight on 08-May-14, 17:03:50
    I tried posting this in the BIOS forum but I didn't get any responses. I'm not sure if I should have posted here first.
    You won't get always immediatelly response, + don't open new topics for the same subject
    >>Please read and comply with the Forum Rules.<<
    i've just deleted your 1st topic that you opened earlier, since you opened a new one duplicate here.
    Quote
    1) Should I be changing / flashing the BIOS from the "Windows 8" version to the "Windows 7" version for running Windows 7, and
    2) If not, should I continue to upgrade with the "Windows 8" BIOS version, even though I'm running Windows 7, and
    3) Will Windows 7 have any issues or not run right since the computer is running the "Windows 8" BIOS version?
    to 1: No
    to 2: Yes
    to 3: Should be fine
    Quote
    I *am* using two SATA drives in mirror RAID mode.
    The other thing that confuses me, is how (even for each Win7 / Win8 BIOS version), there are again two different versions.
    In the case of the GT70 Dominator 890 Pro, there is a version "50" for "WIN8 Default AHCI Mode", and version "70" for "WIN8 Default RAID Mode" (and a version 30 and a version 10 for the same two modes for Windows 7).
    Wouldn't the Default AHCI mode or Default RAID mode be something that the user specifies in the BIOS? Why would there need to be a totally separate BIOS version for these two different modes? (I thought RAID already has AHCI enabled?)
    Having four BIOS versions for the same computer is pretty distressing considering that I might brick it by installing the wrong one.
    what is your current stock bios version?

  • Confusing question re apple id's as it relates to match

    i have my old apple id that i've used for years - for app and music purchases, etc. when i got my iphone 4s, i set it up using the apple id associated with my mobileme account... thinking that it would make sense for the migration to icloud. so now i want to use match... i purchased it in itunes using the old id (the one i use for purchasing apps) and when i go to turn match on on my iphone, it's requesting the password of the apple id associated with my icloud service!
    forgetting about the $25 i spent for a sec, i'm reluctant to repurchase through itunes using the apple id associated with my icloud service because then all the apps i purchased with the other apple id won't get updated, authorized, etc.
    how do i resolve this?
    thanks.

    I have exactly the same problem here; just wrote to Support about it. Hope there's a resolution to this soon, as I really look forward to using the service. The whole multiple ID thing is very confusing. I'd like to be able to seamlessly link them all.

  • Some Confusing Questions about SAPHCM !!!

    Dear specialists
    I am taking certifications exames next week and have some questions, which i couln't be able to solve, if some one can help me in solving these questions.
    I will be really obligied.

    Some employees leave early on Fridays and are required to enter their absence time. How can you ensure that quotas are not reduced for these types of absences?
    a)      Set the counting rule conditions to query the period work schedule variant
    b)      Set the counting rule conditions to full day absences
    c)      Set the counting rule conditions to query certain days
    d)      Set the counting rule conditions for partial day absences
         A customer wants to generate absence quotas based on seniority, and also reduce for any inactive employment periods. Where do you configure this?
    a)      Schema TQTA (Generate Absence Quotas)
    b)      Table T559L (Quota configuration u2013 Selection Rules)
    c)      Feature QUOMO (Determination of quota type selection rule group)
    d)      Report RPTQTA00 (Generate Absence Quotas)
         A Work Schedule Rule comprises of the following elements:
    a.     Public Holidays
    b.     Daily Work Schedules
    c.     Planned Working Time
    d.     Break Schedules
    e.     Daily Work Schedule Variants
    f.     Core times
    3.     Your employee is on vacation. In addition to entering a vacation at the attendance record on the same day, what do you assign to the absence and attendance type to prevent this?
    a.     Time constraint Class E the new record cannot be added system an ERORR Message.
    b.     Time constraint 1 u2013 the existing record is delimited and the new record is created.
    c.     Time constraint 2 -
    d.     Time constraint 3 u2013 the new record cannot be added and the system is issue and Error Message.

  • Adding arrays - confusing question

    I am in the process of writing a java program where I have to add arrays. The question asks:
    This program asks you to assume that your computer has the very limited capability of being able to read and write only single-digit integers and to add together two integers consisting of one decimal digit each. Write a program that can read in two integers of up to 40 digits each, add these digits together, and display the result. Test your program using pairs of numbers of varying lengths. You must use arrays in this problem.
    I think I understand up to there is says"Write a program that can read in two integers of up to 40 digits each" from there I am lost.
    Can anyone help explain what is needed?
    This is what i have so far:
    import java.util.*;
    public class add
        public static void main(String[] args)
          Scanner in = new Scanner(System.in);
          int x = in.nextInt();
          int y = in.nextInt();
            int[] a = {x};
            int[] b = {y};
            int[] ab = new int[a.length + b.length];
            System.arraycopy(a, 0, ab, 0, a.length);
            System.arraycopy(b, 0, ab, a.length, b.length);
            System.out.println(Arrays.toString(ab));
    }

    Yeh, sorry about that didn't have the time to go ahead and drag some of the code over when I first found this forum, first thing I tried a quick compile and run just to see what problems I'd get and I got this runtime error of: Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 7
         at java.lang.String.charAt(String.java:687)
         at Joseph_Ryan_P2.main(Joseph_Ryan_P2.java:36)
    I threw in some print statements to see how far it gets before the error occurs and it seems to be right before the for loop(see code below)
    In this program I'm reading in from a text file that will read two numbers from the same line that are seperated by a space and eventually add them, is the best way to do that by using a tokenizer or some sort of space delimiter? Or is there an easier way? If the tokenizer is best how would i go about that I haven't learned too much about them besides the fact that they exist so far.
    Thanks for any help you or suggestions you guys can give.
    //Joseph_Ryan_P2.java
    //Big Integer Program
    //Description:
    //     Design and implement a BigInteger class that can add and subtract integers with up to 25 digits. Your
    //     class should also include methods for input and output of the numbers.
    // Must Use Arrays
    import java.io.*;               //neccessary imported libraries
    import java.util.*;
    public class Joseph_Ryan_P2          
         public static void main(String[] args)          //the programs main method
              try
                   Scanner scan = new Scanner(new File("BigInts")); //Scanner to read in from plaintext file
              String numline = scan.next();
              int x=0;
              int [] big1 = new int [numline.length()];
              System.out.println(numline);
                   int [] big2 = new int [numline2.length()];
                   String numline2= scan.nextLine();
                   System.out.println(numline2);
              for(int i = numline.length() - 1; i >= 0; i++)
              char current = numline.charAt(i);
              int d = (int) current - (int) '0';
                   big1[i] = d;
              }//end for loop
              }//end try
              catch(FileNotFoundException exception)
    System.out.println("The file could not be found.");
    catch(IOException exception)
    System.out.println(exception);
    } //end catch statements
         }//end main
    }//end class

  • Really easy, but confusing question about SW installation.....

    Hello:
    I have a pc desktop (Win XP Home SP 2) and a new HP wireless laptop I want to connect with my new WRT54GS.
    Question.....When I open the box, it says "STOP - LOAD THE CD FIRST".
    Ok, fine. Load the cd where????? Desktop (wired to router), laptop, or both?????
    Thanks for answering a silly question.
    William Hollingsworth

    Is your PC going to be wired or wireless? Anyway, set-up CD usually does not work properly. Connect a PC directly to the modem and go to www.linksys.com/easy and run the EasyLink Connect Tool.

  • ICloud confused question

    How do I create a new iCloud account on my iPhone?  I have an account on my phone already, but I do not know my password and want to use an e mail account address that I have.  (if it makes a difference, I just upgraded to an iPhone 5s from an iPhone 4)

    Hello, wjgia5. 
    Thank you for visiting Apple Support Communities.
    I would recommend reaching out to us via the link below to assist you with resetting your iCloud password.  Once this is done you can change your the email address that is associated with your iCloud account as outlined in the second article below. 
    Apple ID: Contacting Apple for help with Apple ID account security
    http://support.apple.com/kb/HT5699
    Apple ID: Changing your Apple ID
    http://support.apple.com/kb/ht5621
    Cheers,
    Jason H.

  • Bean confusion - questions - beginner

    jsp A
    <jsp:useBean id="searchHeaders" scope="session" class="database.Tool"/>
    <p><c:out value="${searchHeaders.searchHeaderMap}"/> // This shows my bean info
    <p><a href="/<c:out value="${param.newID}"/>/searchTooling.jsp?newID=<c:out value="${param.newID}"/>">Tool Lookup </a>Quick Background
    When a user clicks on the above link they are taken to a form with two input fields where they can search by an asset number or a serial number. However, depending on what site they are on - the wording might be different - asset number might be called quality number or something else.
    <jsp:useBean id="searchHeaders" scope="session" class="database.Tool"/> 
    <c:forEach var="i" items="${searchHeaders.searchHeaderMap}" varStatus="status">
              <c:forEach var="h" items="${i.key}" varStatus="status">
                  <c:choose>
                  <c:when test='${(i.key) <= "2"}'>
                      <c:forEach var="d" items="${i.value}" varStatus="status">
                      <td><c:out value="${d}"/><INPUT TYPE='text' NAME='<c:out value="${d}"/>' SIZE='30'></td> 
                   </c:forEach>     
                  </c:when>
                  </c:choose>
              </c:forEach>
              </c:forEach>My problem is that jsp A has the bean information showing but once I click on a link the bean information doesnt show until I submit the form on jsp B( which forwards back to jsp B through servlet). I thought that once I called the bean and put it in a session scope I would be able to use it/call it until I expired the session...
    How can I share a bean between two jsp's without using a form?

    First of all - sorry if my terms dont make sense - still new and learning. I dont understand what you are asking me..
    Here is the servlet that is calling/creating the bean
    public class tooling_index extends HttpServlet {
        protected void doGet(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
            DataFactory dbf = DataFactory.getDataFactory(DataFactory.sybase);
            ToolSearchInformation searchInfo = dbf.getToolSearchInformation();
            Tool searchHeaders = searchInfo.findSearchTableHeaders(newID);
            request.setAttribute("searchHeaders", searchHeaders);
            RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/index.jsp?newID="+ newID);
            dispatcher.forward(request, response);
        protected void doPost(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
            doGet(request, response);
    }This forwards to my jsp A. Is this what you are asking ?

  • Question on Dynamic Select Lists and Checkboxes

    Hello,
    I am new to APEX, and this is my first posting, I have a question about how to implement dynamic checkboxes from a select list.
    Basically I would have a select list, and based on what item is selected a set of checkboxes would appear.
    I was originally using the Select and Submit property on the select box, which works fine, all of the checkboxes appear appropriately. But the thing is, APEX refreshes the page each time, and since this select box is lower in the page, the user would have to scroll all the way down to where they were before.
    The main requirement is so that the user won't have to scroll down the that position where the select box is each time they select a new option.
    So a work around attempt is to create a javascript that will automatically scroll down to that position on page load ...
    i.e.
    function pageScroll() {
    window.scrollBy(0,50);
    But that didn't work, because for some reason the javascript wasn't appearing.
    Is there a way to either:
    1. Have a dynamic checkbox appear using ajax? -or-
    2. Have the javascript scrolling effect
    Sorry if this is a confusing question, I was wondering if anyone else came across this issue.
    Thanks in advance!!

    Since this Select List plays such an important role on the page, why not create a side-region and put that select list there so you don't have to overwhelm the user and his 'persistence of vision ' with a page that scrolls all by itself to the 1000th line to, then , change the options ?
    just an idea.

  • SQL PLUS QUESTIONS

    According to the tables and attributes below I need to solve 25 questions. I answered some of them and some of them I couldn't solve. I need your help please.
    school (sch_code, sch_name, sch_phone, sch_dean)
    advisor (adv_code, adv_fname, adv_lname, adv_phone, sch_code)
    major (maj_code, maj_desc, sch_code)
    maj_adv (maj_code, adv_code)
    student (std_code     , std_lname, std_fname, std_gend, maj_code, std_dob)
    grade (std_code,     gr_lname, gr_fname, gr_t1, gr_t2, gr_hw, gr_pr)
    create table school
    (sch_code varchar2(8) constraint school_sch_code_pk primary key,
    sch_name varchar2(50),
    sch_phone varchar2(12),
    sch_dean varchar2(20));
    insert into school values (‘BUS’, ‘School of Business’, ‘281-283-3100’, ‘Ted Cummings’);
    insert into school values (‘EDU’, ‘School of Education’, ‘281-283-3600’,’Dennis Spuck’);
    insert into school values (‘HSH’, ‘School of Humanities and Human Sciences’, ‘281-283-3333’, ‘Bruce Palmer’);
    insert into school values (‘SCE’, ‘School of Science and Computer Engineering’, ‘281-283-3700’,’Sadegh Davari’);
    create table advisor
    (adv_code     varchar2(08)     constraint advisor_adv_code_pk primary key,
    adv_lname     varchar2(15),
    adv_fname     varchar2(15),
    adv_phone     varchar2(12),
    sch_code     varchar2(8) constraint advisor_sch_code_fk references school (sch_code));
    insert into advisor values (‘A1’, ‘Porter’, ‘Mattie’, ‘281-283-3163’, ‘BUS’);
    insert into advisor values ( ‘A2’, ‘Grady’, ‘Perdue’ ,‘281-283-3400’, ‘BUS’);
    insert into advisor values (‘A3’, ’Tran’, ’Van’, ‘281-283-3203’, ‘BUS’);
    insert into advisor values (‘A4’, ‘Saleem’, ‘Naveed’, ‘281-283-3202’, ‘BUS’);
    insert into advisor values (‘A5’, ‘Kwok-Bon’, ‘Yue’, ‘281-283-3864’, ‘SCE’);
    insert into advisor values (‘A6’, ‘Jones’, ‘Lisa’, ‘281-283-3551’, ‘EDU’);
    insert into advisor values (‘A7’, ‘Palmer’, ‘Bruce’, ‘281-283-3445’, ‘HSH’);
    create table major
    (maj_code     varchar2(10)     constraint major_maj_code_pk primary key,
    maj_desc      varchar2(30),
    sch_code     varchar2(8)      constraint major_sch_code_fk references school(sch_code));
    insert into major values (‘ACCT’, ‘Accounting’, ‘BUS’);
    insert into major values (‘FINC’, ‘Finance’, ‘BUS’);
    insert into major values (‘ISAM’, ‘Management Information Systems’, ‘BUS’);
    insert into major values (‘CSCI’, ‘Computer Science’, ‘SCE’);
    insert into major values (‘HIST’, ‘History’, ‘HSH’);
    insert into major values (‘INST’, ‘Instructional Technology’, ‘EDU’);
    create table maj_adv
    (maj_code      varchar2(10)     constraint maj_adv_maj_code_fk references major (maj_code),
    adv_code     varchar2(08)     constraint maj_adv_adv_code_fk references advisor (adv_code),
    constraint maj_adv_maj_code_adv_code_cpk primary key (maj_code, adv_code));
    insert into maj_adv values (‘ACCT’, ’A1’);     
    insert into maj_adv values (‘ACCT’, ‘A2’);
    insert into maj_adv values (‘FINC’, ’A2’);
    insert into maj_adv values (‘ISAM’, ’A3’);
    insert into maj_adv values (‘ISAM’, ’A4’);
    insert into maj_adv values (‘CSCI’, ‘A5’);
    insert into maj_adv values (‘INST’, ‘A6’);
    insert into maj_adv values (‘HIST’, ‘A7’);
    create table student
    (std_code     varchar2(9),
    std_lname     varchar2(15)     constraint student_std_lname_nn not null,
    std_fname     varchar2(15)     constraint student_std_fname_nn not null,
    std_gend     varchar2(8),     
    maj_code     varchar2(10)     constraint student_maj_code1_fk references major (maj_code),
    std_dob     date,
    constraint student_std_code_pk primary key (std_code));
    insert into student values (‘S1’, ‘Jordan’, ‘Michael’, ‘F’, ‘FINC’, to_date(‘10-Mar-1962’, 'DD-Mon-YYYY'));
    insert into student values (‘S2’, ‘Barkley’, ‘Charles’, ‘M’, null, to_date(‘12-Sep-1964’, 'DD-Mon-YYYY'));
    insert into student values (‘S3’, ‘Johnson’, ’Magic’, ‘M’, ‘ACCT’, to_date(‘13-Sep-1960’, 'DD-Mon-YYYY'));
    insert into student values (‘S4’, ‘Williams’, ‘Serena’, ‘F’,‘ISAM’, to_date(‘23-Oct-1980’, 'DD-Mon-YYYY'));
    insert into student values (‘S5’, ‘Duncan’, ‘Tim’, ‘M’, ‘ISAM’, to_date(‘07-Aug-1972’, 'DD-Mon-YYYY'));
    insert into student values (‘S6’, ‘Graff’, ’Steffi’, ‘F’, ‘CSCI’, to_date(‘30-Apr-1962’, 'DD-Mon-YYYY'));
    insert into student values (‘S7’, ‘Navratilova’, ’Martina’, ‘F’, ’ACCT’, to_date(‘18-Dec-1972’, 'DD-Mon-YYYY'));
    REMARK insert into student (std_code, std_lname, std_fname, std_dob)
    REMARK values (‘S2’, ‘Barkley’, ‘Charles’, to_date(‘12-Sep-1964’,'DD-Mon-YYYY'));
    create table grade
    (std_code     varchar2(9)     constraint grade_std_code_pk primary key
                        constraint grade_std_code_fk references student (std_code),
    gr_lname     varchar2(15)     constraint grade_gr_lname_nn not null,
    gr_fname     varchar2(15)     constraint grade_gr_fname_nn not null,
    gr_t1          number(5),     constraint grade_gr_t1_cc check (gr_t1 between 0 and 100),
    gr_t2          number(5),     
    gr_hw          number(5),     
    gr_pr          number(5));
    insert into grade values (‘S1’, ‘Jordan’, ‘Michael’, 90, 80, 98, 90);
    insert into grade values (‘S2’, ‘Barkley’, ‘Charles’, 60, 100, 100, 60);
    insert into grade values (‘S3’, ‘Johnson’, ’Magic’, 88, 98, 96, 98);
    insert into grade values (‘S4’, ‘Williams’, ‘Serena’, 92, 92, 92, 92);
    insert into grade values (‘S5’, ‘Duncan’, ‘Tim’, 94, 90, 94, 96);
    insert into grade values (‘S6’, ‘Graff’, ’Steffi’, 80, 84, 83, 72);
    insert into grade values (‘S7’, ‘Navratilova’, ’Martina’, 91, 88, 94, 95);
    the questions are:
    Give the commands for the following:
    1.     Display the names of students who don't have a major.
    2.     Display the names of students whose last name has two "o" in it.
    3.     Display the names of students whose first name includes an "e" in it.
    4.     Display the names of students whose first name has exactly five characters in it.
    5.     Display the names of students whose test 1 grade is higher than test 2 grade.
    6.     Display the names of students whose project grade is between tests 1 and test 2 grades.
    7.     Give the name of student whose last name starts with the character "B" or who never turned in homework.
    8.     Give the command that will list two columns and one record. The first column will have the heading "Major" and "ACCT" as the value. The second column will have the heading “MIS_Count” and will display the number of accounting advisors.
    9.     Display the name of the student whose test 1 score is higher than the average on test 1.
    10.     Give the first and last names of students who scored above average on test 1 as well as above average on test 2.
    11.     Display the system date variable using the dual table.
    12.     Display the system date variable using the grade table making sure that the date is displayed only once.
    13.     Give the name of the student who is the oldest student and scored the highest on the first test.
    14.     List different majors and number of advisors for these majors.
    15.     Display the names of students who don't have grade for any item.
    16.     Display the names of the students who don't have grade for at least one item.
    17.     Display names of students who have the same major as “Michael Jordan.”
    18.     Give the names of students whose average on test 1 and test 2 is greater than the average on homework and project.
    19.     Display the name and average on test 1 and test 2 for each student.
    20.     Display the number of students in student table using three different methods.
    21.     Display the number accounting students in the student table.
    22.     Display the number of accounting and finance students in the student table.
    23.     Display the average on test 1 and test 2 for female students.
    24.     Display the number of accounting and finance students whose test 1 grades are higher than the average on test 1.
    25.     Display the name of the major that has more than two students.
    I am stuck with the following questions(1,12,13, 15,16,17,24) and the rest I finished them but I am not quite sure.
    Thank you and looking forward to hear your suggestions.

    Hi,
    user11956564 wrote:
    13.     Give the name of the student who is the oldest student and scored the highest on the first test.
    I can get the oldest student and the highest score but in two different queries. My question is how can I use them together in one query
    List oldest student in class
    select std_fname, std_lname from student
    where std_dob = (select min(std_dob) from student);
    List highest grade in class
    select gr_fname, gr_lname from grade
    where gr_t1 = (select max(gr_t1) from grade);
    because they are two tables. I think this is a confusing question: I'm not sure what the expected output is, or what the lesson you're supposed to learn is.
    One way of combining results from different tables is UNION. As long as two queries produce the same number of columns, and the same datatypes, they can be combined with UNION.
    For example: the following query displays the name of the employee whose job is 'PRESIDENT' (from the scott.emp table) and the name of department 10 (from the scott.dept table) in one query:
    SELECT  ename
    ,       job
    FROM  scott.emp
    WHERE   job = 'PRESIDENT'
        UNION
    SELECT  dname
    ,       TO_CHAR (deptno)
    FROM    scott.dept
    WHERE   deptno = 10
    ;Both SELECT clauses have 2 columns.
    This 1st column in the 1st part is a VARCHAR2, so the 1st column of the 2nd part must also be a VARCHAR2. It is.
    The 2nd column in the 1st part is a VARCHAR2, so the 2nd column of the 2nd part must also be a VARCHAR2. However, deptno (which we want to display here) is not a VARCHAR2, but a NUMBER; that's why I used TO_CHAR to put a VARCHAR2 value in that place.
    17.     Display names of students who have the same major as “Michael Jordan.”
    here is what I did
    select std_fname, std_lname, maj_code
    from student
    where maj_code=(select maj_code
    from studentJordan');
    I am not sure if my answer is correct or not because in the output I got Michael JordanThis question is unclear, too.
    Assuming you do not want Michael Jordan in the results, add a 2nd condition to the WHERE clause, so that you select
    people who have the right major (which you say you are doing correctly, but the query seems to have lost something when you posted it)
    AND
    people who are not named Micheal Jordan
    24.     Display the number of accounting and finance students whose test 1 grades are higher than the average on test 1.
    It was too confusing for me.Are you sure?
    Look at what you tried for 13.
    select  std_fname, std_lname from student
    where   std_dob = (select min(std_dob) from student);
    select  gr_fname, gr_lname from grade
    where   gr_t1 = (select max(gr_t1) from grade);The function for average (AVG) is used very much like the other aggregate function, like MIN and MAX.

  • PI Configuration question....

    Hi,
    It is for PI SP12 on AIX and Oracle.
    I am configuring the CRM 5.0 to PI 7.0. The CRM 5.0 is ABAP+J2EE system. I have created two RFCs in CRM ABAP side (SAPSLDAPI and LCRSAPRFC). Both of these RFCs are pointing to PIHOST and PIGATEWAY.
    The application system has a J2EE as well so there must be a setting in visual administrator as well. So I go to Server -> Services - JCo RFC Provider.
    As far as I have understood I have to maintain two entries for two RFCs with the name of the program ID (e.g. LCRSAPRFC_<SID>).
    My question is that the values in the section <b>RFC Destination</b>  and <b>Repository</b> should point to PIHOST and PIGATEWAT or it should point to CRMHOST and CRM-GATEWAY.
    I think it should point to PIHOST and PIGATEWAY and the value of “Gateway Host” and “Application Server host” will be same.
    Please correct me if I am wrong.
    I will appreciate your help.
    Regards.
    Sume

    Thank you for a very helpful answer.
    One more confusion/question.
    Suppose my SLDHOST and SLDGATEWAY is different than PIHOST and PIGATEWAY then
    Will your above reply  still be true?
    Because when we create an entry in SLDAPICUST in Application System we enter the HOST and PORT of system where SLD is running. We do not enter the host and port of PI system. And yes, this PI should also be poitinng to same SLD.
    Please reply.
    I will appreciate your reply.
    regards.
    Sume

  • Classes intercommunication question

    hello folks,
    another newbie question:
    I have a JDialog with 3 components:
    pane with 2 JRadioButton's
    JButton,
    and JScrollPane with a JList in it
    elements of a Jlist are of my own class A and I am rewriting its toString() method, so elements of my class are correctly displayed in JList.
    Now here comes the question:
    this toString() method must depend on what JRadioButton is selected in a JDialog.
    how do I do it? should I send the JDialog reference to my Class constructor?
    thanks

    That's a pretty confusing question without any code to look at. My first reaction is to say to pass some argument (something unique about the JRadioButton that's selected) to your toString() method so it can choose what to return.

  • Some background porcess question

    Hi~
    I have some confuse question about background process.
    1.When I set ALTER SYSTEM CHECKPOINT,all dirty buffers are written,is it include non commit transaction entry??
    2.When there is 1MB of redo log buffer,LGWR writes redo entries to the redo log files,is it include non commit transaction redo ?
    when a datafile damaged,we restore it from backup,and roll forward from all archive log and online redo log file,how did oracle know what data need rollback? is the undo segment will keep these uncommit transaction so it know who need rollback?

    Shu shic chun -
    1.
    When a buffer in the database buffer cache is modified, it is marked dirty. A cold buffer is a buffer that has not been recently used according to the least recently used (LRU) algorithm. The DBWn process writes cold, dirty buffers to disk so that user processes are able to find cold, clean buffers that can be used to read new blocks into the cache
    2.Sometimes, if more buffer space is needed, LGWR writes redo log entries before a transaction is committed.
    These entries become permanent only if the transaction is later committed.
    After rolling forward, the data blocks contain all committed changes. They may also contain uncommitted changes that were either saved to the datafiles before the failure, or were recorded in the redo log and introduced during cache recovery.
    Undo blocks (whether in rollback segments or automatic undo tablespaces) record database actions that should be undone during certain database operations. In database recovery, the undo blocks roll back the effects of uncommitted transactions previously applied by the rolling forward phase.
    After the roll forward, any changes that were not committed must be undone. Oracle applies undo blocks to roll back uncommitted changes in data blocks that were either written before the crash or introduced by redo application during cache recovery. This process is called rolling back or transaction recovery.

Maybe you are looking for