IDL Constructed Types   «Prev  Next»

IDL-to-Java mapping for sequences - Quiz

Each question is worth one point. Select the best answer or answers for each question.

 
1. How does the mapping of bounded and unbounded sequences differ?
Please select the best answer.
  A. The arrays produced by bounded sequences are length checked everywhere they are used.
  B. The arrays produced by bounded sequences are length checked when they are marshaled.
  C. The arrays produced by unbounded sequences are length checked in the client.

2. What will the ClubBouncerOperations Java interface generated by the following IDL be?
module Module4
{
 //Sequence of names
 typedef sequence<string> NameList;
 
 interface ClubBouncer
     {
  //Takes list of names, pushes back out with un-hip names removed
  void approvePeople(inout NameList clubGoers);
     };
};

Please select the best answer.
  A.
package Module4;
public interface ClubBouncerOperations
{
 public void approvePeople(Module4.NameListHolder clubGoers);
}

  B.
package Module4;
public interface ClubBouncerOperations
{
 public void approvePeople(java.lang.String[] clubGoers);
}

  C.
package Module4;
public interface ClubBouncerOperations
{
 public void approvePeople(NameList clubGoers);
}


3. Which of the following Java code fragments represents correct possible client code for the ClubBouncer interface in the following IDL?
module Module4
{
 //Sequence of names
 typedef sequence<string> NameList;
 
 interface ClubBouncer
     {
  //Takes list of names, pushes back out with un-hip names removed
  void approvePeople(inout NameList clubGoers);
     };
};

Please select the best answer.
  A.
//Initialize ORB ..
  ClubBouncer bouncer = null;
  //Obtain reference to remote ClubBouncer ..
  String[] wannabes = {"Mark", "Gordon", "Madonna"};
  bouncer.approvePeople(wannabes);
  System.out.println("They'll only let in
"+wannabes.length+" of us");
  // ...
  B.
//Initialize ORB ..
  ClubBouncer bouncer = null;
  //Obtain reference to remote ClubBouncer ..
  String[] wannabes = {"Mark", "Gordon", "Madonna"};
  NameListHolder listParam = new NameListHolder(wannabes);
  bouncer.approvePeople(listParam);
  System.out.println("They'll only let in
"+listParam.value.length+" of us");
  // ...

  C.
//Initialize ORB ..
  ClubBouncer bouncer = null;
  //Obtain reference to remote ClubBouncer ..
  NameList wannabes = new NameList("Mark", "Gordon", "Madonna");
  NameListHolder listParam = new NameListHolder(wannabes);
  bouncer.approvePeople(listParam);
  System.out.println("They'll only let in
"+listParam.value.length+" of us");
  // ...


Correct answers:

Your Score: 0