You are on page 1of 7

2. What is the expected Output for this code segment?

class ChampsTest {

int x = 1555;

public static void main(String[] args)


{

ChampsTest ct = new ChampsTest();

System.out.println(ct.x);
}
}
* (3 Pontos)

3. What is the expected Output for this code segment?

class ChampsTest {

int y = 5;
int x = y + 9;

public static void main(String[] args)


{

ChampsTest ct= new ChampsTestTest();

System.out.println("x = " + ct.x + ", y = " + ct.y);


}
} * (3 Pontos)
4. What is the expected Output for this code segment?

class ChampsTest {
protected int x, y;
}

class Main {
public static void main(String args[]) {
ChampsTest ct = new ChampsTest();
System.out.println(ct.x + " " + ct.y);
}
}
* (3 Pontos)

5. What is the expected Output for this code segment?

public class ChampsTest{


int x = 500;

ChampsTest(int i) { x = i; }

public static void main(String[] args)


{

ChampsTest ct = new ChampsTest(15);

System.out.println("x = " + ct.x);


}
}
* (3 Pontos)
6. What is the expected Output for this code segment?

public class Champs


{
public static void main (String args[])
{
System.out.println("Champions Academy" + 500 + 500);
}
}
* (5 Pontos)

7. What is the expected Output for this code segment?

public class PolarisingCalculator


{
int num = 333;
public void calc(int num) { this.num = num * 100; }
public void printNum() { System.out.println(num); }

public static void main(String[] args)


{
PolarisingCalculator obj = new PolarisingCalculator();
obj.calc(5);
obj.printNum();
}
} * (5 Pontos)
8. What is the expected Output for this code segment?

public class Main


{
public static void main(String args[])
{
String st = "abcd";
String st2 = st;
st += "e";
System.out.println(st+ " " + st2 + " " + (st== st2));
}
} * (7 Pontos)

9. What is the expected Output for this code segment?

public class Main


{
public static void main(String args[])
{
StringBuffer sb = new StringBuffer("abcde");
StringBuffer sb2 = sb;
sb.append("d");
System.out.println(sb + " " + sb2 + " " + (sb == sb2));
}
} * (7 Pontos)
10. What is the expected Output for this code segment?

import java.util.*;
class I
{
public static void main (String[] args)
{
Object o = new ArrayList().iterator();
System.out.print((o instanceof List) + ", ");
System.out.print((o instanceof Iterator) + ", ");
System.out.print(o instanceof ListIterator);
}
}
* (10 Pontos)

11. What is the expected Output for this code segment?

public class ThreadTest implements Runnable


{
public void run()
{
System.out.printf("%d",5);
}
public static void main(String[] args) throws InterruptedException
{
Thread thread = new Thread(new ThreadTest());
thread.start();
System.out.printf("%d",7);
thread.join();
System.out.printf("%d",3);
}
}
* (12 Pontos)
Logical chapter

Nesta parte vais poder mostrar o teu raciocínio lógico.

12. Which is the next value in the sequence: 2Z3, 4Y5, 6X7, ...?* (2 Pontos)
Indica apenas a sequência no formato 0A0. Exemplo: 0A0

13. If in each number all the digits are arranged in descending order, which among
the following corresponds to the smallest number?
384 475 563 728 849 631 * (2 Pontos)

14. If in each of the words, the first and second letters are interchanged and then
all the words are arranged in alphabetical order from left to right, then which
word would be in the middle?
RAM SIT NET PET CUT
* (2 Pontos)

15. If a butterfly lives for 5 days and each day it flies 4 meters, how many meters it
will be traveled in 2 weeks? * (3 Pontos)
Indicate only the number of meteres. Example: 25

16. If in a car race you leave the 2nd contestant behind, what is your position after
the passing? * (3 Pontos)
Indicate only the number of the place. Example: 3º
17. It takes 5 minutes for 5 robots to make 5 pulleys.
How long does it take for 100 robots to make 100 pulleys?
* (5 Pontos)
Indicate only the number of minutes. Example: 10

18. A baseball bat and a baseball ball cost 1,10€ in total.


The bat is 1€ more expensive than the ball, how much costs the ball?
* (5 Pontos)
Indicate the value in the following format 0,00€. Example: 0,25€

You might also like