Test on JAVA P10 test

  1. Question 1. Given str = 'Yunlin university', what is the result of str.lastIndexOf ('i')?
    1. 4
    2. 14
    3. 7
    4. There is no right answer
  2. Question 2. Given str = 'Yunlin university', what is the result of str.lastIndexOf ('i', 7) returning results?
    1. 4
    2. 14
    3. 7
    4. -first
  3. Question 3. Given str = 'Yunlin university', what is the result of str.lastIndexOf ('sti')?
    1. 4
    2. 14
    3. false
    4. -first
  4. Question 4. After running the command block s =?
     int s = 0; 

    for (int i = 3; i <10; i ++)

    s + = i;
    1. 42
    2. 55
    3. 9
    4. 29
  5. Question 5. After running the command block s =?
     for (int i = 0; i <= 10; i ++) { 

    int s = 0;

    s + = i;}

    System.out.print (s);
    1. 0
    2. 55
    3. 45
    4. Wrong command
  6. Question 6. After running the command block s =?
     int s = 0; 

    for (int i = 0; i <= 10; i ++)

    s + = i;
    1. 45
    2. 55
    3. 56
    4. 0
  7. Question 7. If the program runs with the java message -g cruel world command, what is the value of the args [1] parameter?
     public static void main (String [] args) { 

    if (args [0] .equals ('- g'))

    System.out.print ('Goodbye,');

    for (int i = 1; i
    System.out.print ('' + args [i]); }
    1. -g
    2. cruel
    3. world
    4. -g cruel world
  8. Question 8. If the program runs with the java message -g cruel world, what is the result?
     public static void main (String [] args) { 

    if (args [0] .equals ('- g'))

    System.out.print ('Goodbye,');

    for (int i = 1; i
    System.out.print ('' + args [i]); }
    1. -g cruel world
    2. cruel world
    3. Goodbye, cruel world
    4. Goodbye cruel world
  9. Question 9. If initializing two class A objects extending KiemTra and class B extends KiemTra, the id of object A is valid:
     class KiemTra { 

    private int i;

    private int nextId;

    public void setId () {

    id = nextId;

    nextId ++;

    }

    }
    1. 0
    2. first
    3. 2
    4. Void
  10. Question 10. If initializing two class A objects, the KiemTra and class B extends extends KiemTra, the id of object B is valid?
     class KiemTra { 

    private int i;

    private int nextId;

    public void setId () {

    id = nextId;

    nextId ++;

    }

    }
    1. 0
    2. first
    3. 3
    4. Void
3.2 ★ | 5 Vote

May be interested

  • What do you know about Smalltalk programming language?Photo of What do you know about Smalltalk programming language?
    smalltalk is the first, dynamically and reflexively object-oriented programming language developed at xerox palo alto research center (parc) in early 1970. the quiz below is with network administrator. let's learn more about this programming language.
  • Multiple choice questions about P2 computer virusesPhoto of Multiple choice questions about P2 computer viruses
    for computer users, viruses are the fear of many people. when your computer unfortunately gets infected with the virus it will put your computer at risk of losing all important data, slowing down your computer, causing system errors ... in the following article please join network administrators learn about this topic through the quiz below.
  • The Microsoft Access test has the answer P9Photo of The Microsoft Access test has the answer P9
    the following access database quiz will provide you with useful information on this topic, invite readers to try the same questions below.
  • Test about database security P12Photo of Test about database security P12
    testing of databases will help you gain more useful knowledge about this topic to apply to learning and working. the question set will have 10 sentences to test your knowledge
  • What do you know about data queries?Photo of What do you know about data queries?
    query is a way to search and compile data from one or more tables. query execution is like asking a detailed question about databases. when creating a query in access, you are defining specific search conditions to find exactly the data you need. in the quiz below, go with the network administrator to learn about this topic.
  • Test about database security P13Photo of Test about database security P13
    please read your knowledge of the database through the multiple choice questions below. hope with these interesting questions will give you lots of useful information.