Techno programmer

Techno programmer page is about test the the students skills in various progamming languages this page is to develop your technical skills in programming...

Bring all your camera in one app and take pictures
11/05/2014

Bring all your camera in one app and take pictures

13/08/2013

Runnable r = new Runnable()
{
public void run()
{
System.out.print("Cat");
}
};
Thread t = new Thread(r)
{
public void run()
{
System.out.print("Dog");
}
};
t.start();
What is the result?
A Cat
B Dog
C Compilation fails.
D The code runs with no output.
E An exception is thrown at runtime.

13/08/2013

public class TestOne implements Runnable
{
public static void main (String[] args) throws Exception
{
Thread t = new Thread(new TestOne());
t.start();
System.out.print("Started");
t.join();
System.out.print("Complete");
}
public void run()
{
for (int i = 0; i < 4; i++)
{
System.out.print(i);
}
}
}
What can be a result?
A Compilation fails.
B An exception is thrown at runtime.
C The code executes and prints "StartedComplete".
D The code executes and prints "StartedComplete0123".
E The code executes and prints "Started0123Complete".

13/08/2013

public class Drink implements Comparable
{
public String name;
public int compareTo(Object o)
{
return 0;
}
}
and:
Drink one = new Drink();
Drink two = new Drink();
one.name= "Coffee";
two.name= "Tea";
TreeSet set = new TreeSet();
set.add(one);
set.add(two);
A programmer iterates over the TreeSet and prints the name of each Drink object. What is the result?
A Tea
B Coffee
C Coffee Tea
D Compilation fails
E The code runs with no output.

13/08/2013

int[] myArray = new int[] {1, 2, 3, 4, 5};
What allows you to create a list from this array?
A List myList = myArray.asList();
B List myList = Arrays.asList(myArray);
C List myList = new ArrayList(myArray);
D List myList = Collections.fromArray(myArray);

13/08/2013

public class Score implements Comparable
{
private int wins, losses;
public Score(int w, int 1)
{ wins = w; losses = 1; }
public int getWins()
{ return wins; }
public int getLosses()
{ return losses; }
public String toString()
{
return “”;
}
// insert code here
}
Which method will complete this class?
A public int compareTo(Object o) {/*mode code here*/}
B public int compareTo(Score other) {/*more code here*/}
C public int compare(Score s1,Score s2){/*more code here*/}
D public int compare(Object o1,Object o2){/*more code here*/}

13/08/2013

A programmer has an algorithm that requires a java.util.List that provides an efficient implementation of add(0, object), but does NOT need to support quick random access.
What supports these requirements?
A java.util.Queue
B java.util.ArrayList
C java.util.LinearList
D java.util.LinkedList
E none

13/08/2013

public static Iterator reverse(List list)
{
Collections.reverse(list);
return list.iterator();
}
public static void main(String[] args)
{
List list = new ArrayList();
list.add("1"); list.add("2"); list.add("3");
for (Object obj: reverse(list))
System.out.print(obj + ", ");
}
What is the result?
A 3, 2, 1,
B 1, 2, 3,
C Compilation fails.
D The code runs with no output.
E An exception is thrown at runtime.

13/08/2013

import java.util.*;
public class Example
{
public static void main(String[] args)
{
// insert code here
set.add(new Integer(2));
set.add(new Integer(1));
System.out.println(set);
}
}
Which code, inserted at line 4, guarantees that this program will output [1, 2]?
A Set set = new TreeSet();
B Set set = new HashSet();
C Set set = new SortedSet();
D List set = new SortedList();
E Set set = new LinkedHashSet();

13/08/2013

Given classes defined in two different files:
package util;
public class BitUtils
{
public static void process(byte[])
{
/* more code here */
}
}

package app;
public class SomeApp
{
public static void main(String[] args)
{
byte[] bytes = new byte[256];
// insert code here
}
}
What is required at line 5 in class SomeApp to use the process method of BitUtils?
A process(bytes);
B BitUtils.process(bytes);
C util.BitUtils.process(bytes);
D SomeApp cannot use methods in BitUtils.
E import util.BitUtils.*; process(bytes);

13/08/2013

public class Yippee2
{
static public void main(String [] yahoo)
{
for(int x = 1; x < yahoo.length; x++)
{
System.out.print(yahoo[x] + " ");
}
}
}
and the command line invocation:
java Yippee2 a b c.

What is the result?
A a b
B b c
C a b c
D Compilation fails.
E E. An exception is thrown at runtime

Address

Hyderabad

Telephone

8019512448

Website

Alerts

Be the first to know and let us send you an email when Techno programmer posts news and promotions. Your email address will not be used for any other purpose, and you can unsubscribe at any time.

Contact The Business

Send a message to Techno programmer:

Share