BOB Placement Paper : ALAHABAD ,14 October 2003
BOB Placement Paper : BOB Test Paper
Started operations from January 2005, with activities like Software development and Staff augmentation services, BOB Technologies represents an enthusiastic team of bright & experienced business executives with collective strengths moving towards a shared goal!
BOB Technologies, based in Bangalore, Karnataka, provides Business solutions and Staff Augmentation to medium and large sized corporations in the global market.
Our 90+ team will soon emerge to be 150+ software professionals by this financial quarter, consisting of technically sound; handpicked and identified from the Indian IT colleges and industry.
Operating from our state-of-the-art development centers at Bangalore and Hyderabad, BOB Technologies possess the capability to take up mission critical projects and successfully implement them.
Since our inception we have built a reputation with our clients in delivering services faster than expected with a high level of dependency to minimize turnaround times with maximum value and return on investments.
BOB Technologies is also in the process of establishing its presence in the international market by setting up joint ventures in USA and Europe.
Vision
To seize the opportunities of tomorrow, and create a future that is, Clients’ peace-of-mind,
Mission
We aim to provide quality driven, requirement-oriented, cost-effective and value-added software solutions and other related services
We work with competence to build lasting relationships rather than just doing business.
Quality Policy
Our quality policy is to use consistent, repeatable and renewable processes to deliver timely and cost-effective solutions to its clients. We use an effective mix of training programs, quality testing and software development models to deliver bug free and efficient solutions.
Our ISO 9001 compliant quality processes and state of the art technology are the key differentiation factors in providing best of the breed solutions & services to clients across the globe.
Email: info@bob-technologies.com
Web: www.bob-technologies.com
BOB Placement Paper : BOB Technical - Java
Bob Technologies Sample Paper 1 2003 OCT 14 ALAHABAD
1)Which of the following lines will compile without warning or error.
1) float f=1.3; 2) char c="a"; 3) byte b=257; 4) boolean b=null; 5) int i=10;
2)What will happen if you try to compile and run the following code?
public class MyClass {
public static void main(String arguments[]) {
amethod(arguments);
}
public void amethod(String[] arguments) {
System.out.println(arguments);
System.out.println(arguments[1]);
}
}
1) error Can,t make static reference to void amethod.
2) error method main not correct
3) error array must include parameter
4) amethod must be declared with String
3)Which of the following will compile without error
a)
import java.awt.*;
package Mypackage;
class Myclass {}
b)
package MyPackage;
import java.awt.*;
class MyClass{}
c)
/*This is a comment */
package MyPackage;
import java.awt.*;
class MyClass{}
4)A byte can be of what size
1) -128 to 127 2) (-2 power 8 )-1 to 2 power 8 3) -255 to 256 4)depends on the particular implementation of the Java Virtual machine
5)What will be printed out if this code is run with the following command line?
java myprog good morning
public class myprog{
public static void main(String argv[])
{
System.out.println(argv[2]);
}
}
1) myprog 2) good 3) morning 4) Exception raised:
"java.lang.ArrayIndexOutOfBoundsException: 2"
6)Which of the following are keywords or reserved words in Java?
1) if 2) then 3) goto 4) while 5) case
7)Which of the following are legal identifiers
1) 2variable 2) variable2 3) _whatavariable 4) _3_ 5) $anothervar 6) #myvar
8)What will happen when you compile and run the following code?
public class MyClass{
static int i;
public static void main(String argv[]){
System.out.println(i);
}
}
1) Error Variable i may not have been initialized 2) null 3) 1 4) 0
9)What will happen if you try to compile and run the following code?
Pblic class Q {
public static void main(String argv[]){
int anar[]=new int[]{1,2,3};
System.out.println(anar[1]);
}
}
1) 1 2) Error anar is referenced before it is initialized 3) 2 4) Error: size of array must be defined
10)What will happen if you try to compile and run the following code?
public class Q {
public static void main(String argv[]){
int anar[]=new int[5];
System.out.println(anar[0]);
}
}
1) Error: anar is referenced before it is initialized 2) null 3) 0 4) 5
11)What will be the result of attempting to compile and run the following code?
abstract class MineBase {
abstract void amethod();
static int i;
}
public class Mine extends MineBase {
public static void main(String argv[]){
int[] ar=new int[5];
for(i=0;i < ar.length;i++)
System.out.println(ar[i]);
}
}
1) a sequence of 5 0,s will be printed
2) Error: ar is used before it is initialized
3) Error Mine must be declared abstract
4) IndexOutOfBoundes Error
12)
What will be printed out if you attempt to compile and run the following code ?
int i=1;
switch (i) {
case 0:
System.out.println("zero");
break;
case 1:
System.out.println("one");
case 2:
System.out.println("two");
default:
System.out.println("default");
}
1) one 2) one, default 3) one, two, default 4) default
13)What will be printed out if you attempt to compile and run the following code?
int i=9;
switch (i) {
default:
System.out.println("default");
case 0:
System.out.println("zero");
BOB Placement Paper : BOB Technical - Java
BOB Placement Paper : BOB Paper Technical - Java ALAHABAD - 14 October 2003
Bob Technologies Sample Paper 1 2003 OCT 14 ALAHABAD
1)Which of the following lines will compile without warning or error.
1) float f=1.3; 2) char c="a"; 3) byte b=257; 4) boolean b=null; 5) int i=10;
2)What will happen if you try to compile and run the following code?
public class MyClass {
public static void main(String arguments[]) {
amethod(arguments);
}
public void amethod(String[] arguments) {
System.out.println(arguments);
System.out.println(arguments[1]);
}
}
1) error Can,t make static reference to void amethod.
2) error method main not correct
3) error array must include parameter
4) amethod must be declared with String
3)Which of the following will compile without error
a)
import java.awt.*;
package Mypackage;
class Myclass {}
b)
package MyPackage;
import java.awt.*;
class MyClass{}
c)
/*This is a comment */
package MyPackage;
import java.awt.*;
class MyClass{}
4)A byte can be of what size
1) -128 to 127 2) (-2 power 8 )-1 to 2 power 8 3) -255 to 256 4)depends on the particular implementation of the Java Virtual machine
5)What will be printed out if this code is run with the following command line?
java myprog good morning
public class myprog{
public static void main(String argv[])
{
System.out.println(argv[2]);
}
}
1) myprog 2) good 3) morning 4) Exception raised:
"java.lang.ArrayIndexOutOfBoundsException: 2"
6)Which of the following are keywords or reserved words in Java?
1) if 2) then 3) goto 4) while 5) case
7)Which of the following are legal identifiers
1) 2variable 2) variable2 3) _whatavariable 4) _3_ 5) $anothervar 6) #myvar
8)What will happen when you compile and run the following code?
public class MyClass{
static int i;
public static void main(String argv[]){
System.out.println(i);
}
}
1) Error Variable i may not have been initialized 2) null 3) 1 4) 0
9)What will happen if you try to compile and run the following code?
Pblic class Q {
public static void main(String argv[]){
int anar[]=new int[]{1,2,3};
System.out.println(anar[1]);
}
}
1) 1 2) Error anar is referenced before it is initialized 3) 2 4) Error: size of array must be defined
10)What will happen if you try to compile and run the following code?
public class Q {
public static void main(String argv[]){
int anar[]=new int[5];
System.out.println(anar[0]);
}
}
1) Error: anar is referenced before it is initialized 2) null 3) 0 4) 5
11)What will be the result of attempting to compile and run the following code?
abstract class MineBase {
abstract void amethod();
static int i;
}
public class Mine extends MineBase {
public static void main(String argv[]){
int[] ar=new int[5];
for(i=0;i < ar.length;i++)
System.out.println(ar[i]);
}
}
1) a sequence of 5 0,s will be printed
2) Error: ar is used before it is initialized
3) Error Mine must be declared abstract
4) IndexOutOfBoundes Error
12)
What will be printed out if you attempt to compile and run the following code ?
int i=1;
switch (i) {
case 0:
System.out.println("zero");
break;
case 1:
System.out.println("one");
case 2:
System.out.println("two");
default:
System.out.println("default");
}
1) one 2) one, default 3) one, two, default 4) default
13)What will be printed out if you attempt to compile and run the following code?
int i=9;
switch (i) {
default:
System.out.println("default");
case 0:
System.out.println("zero");
BOB Placement Paper : BOB Paper Technical - Java
Bob Technologies Sample Paper2
Questions
1)What will happen when you attempt to compile and run this code?
abstract class Base{
abstract public void myfunc();
public void another(){
System.out.println("Another method");
}
}
public class Abs extends Base{
public static void main(String argv[]){
Abs a = new Abs();
a.amethod();
}
public void myfunc(){
System.out.println("My Func");
}
public void amethod(){
myfunc();
}
}
1) The code will compile and run, printing out the words "My Func"
2) The compiler will complain that the Base class has non abstract methods
3) The code will compile but complain at run time that the Base class has non abstract methods
4) The compiler will complain that the method myfunc in the base class has no body, nobody at all
to looove it
2)What will happen when you attempt to compile and run this code?
public class MyMain{
public static void main(String argv){
System.out.println("Hello cruel world");
}
}
1) The compiler will complain that main is a reserved word and cannot be used for a class
2) The code will compile and when run will print out "Hello cruel world"
3) The code will compile but will complain at run time that no constructor is defined
4) The code will compile but will complain at run time that main is not correctly defined
3)Which of the following are Java modifiers?
1) public 2) private 3) friendly 4) transient 5) vagrant
4)What will happen when you attempt to compile and run this code?
class Base{
abstract public void myfunc();
public void another(){
System.out.println("Another method");
}
}
public class Abs extends Base{
public static void main(String argv[]){
Abs a = new Abs();
a.amethod();
}
public void myfunc(){
System.out.println("My func");
}
public void amethod(){
myfunc();
}
}
1) The code will compile and run, printing out the words "My Func"
2) The compiler will complain that the Base class is not declared as abstract.
3) The code will compile but complain at run time that the Base class has non abstract methods
4) The compiler will complain that the method myfunc in the base class has no body, nobody at all
to looove it
5)Why might you define a method as native?
1) To get to access hardware that Java does not know about
2) To define a new data type such as an unsigned integer
3) To write optimized code for performance in a language such as C/C++
4) To overcome the limitation of the private scope of a method
6)What will happen when you attempt to compile and run this code?
class Base{
public final void amethod(){
System.out.println("amethod");
}
}
public class Fin extends Base{
public static void main(String argv[]){
Base b = new Base();
b.amethod();
}
}
1) Compile time error indicating that a class with any final methods must be declared final itself
2) Compile time error indicating that you cannot inherit from a class with final methods
3) Run time error indicating that Base is not defined as final
4) Success in compilation and output of "amethod" at run time.
7)What will happen when you attempt to compile and run this code?
public class Mod{
public static void main(String argv[]){
}
public static native void amethod();
}
1) Error at compilation: native method cannot be static
2) Error at compilation native method must return value
3) Compilation but error at run time unless you have made code containing native amethod available
4) Compilation and execution without error
8)What will happen when you attempt to compile and run this code?
private class Base{}
public class Vis{
transient int iVal;
public static void main(String elephant[]){
}
}
1)Compile time error: Base cannot be private
2)Compile time error indicating that an integer cannot be transient
3)Compile time error transient not a data type
4)Compile time error malformed main method
9)What happens when you attempt to compile and run these two files in the same directory?
//File P1.java
package MyPackage;
class P1{
void afancymethod(){
System.out.println("What a fancy method");
}
}
//File P2.java
public class P2 extends P1{
public static void main(String argv[]){
P2 p2 = new P2();
p2.afancymethod();
}
}
1) Both compile and P2 outputs "What a fancy method" when run
2) Neither will compile
3) Both compile but P2 has an error at run time
4) P1 compiles cleanly but P2 has an error at compile time
Question 10)
You want to find out the value of the last element of an array. You write the following code. What
will happen when you compile and run it.?
public class MyAr{
public static void main(String argv[]){
int[] i = new int[5];
System.out.println(i[5]);
}
}
1) An error at compile time
2) An error at run time
3) The value 0 will be output
4) The string "null" will be output
11)You want to loop through an array and stop when you come to the last element. Being a good java programmer and forgetting everything you ever knew about C/C++ you know that arrays contain information about their size. Which of the following can you use?
1)myarray.length(); 2)myarray.length; 3)myarray.size 4)myarray.size();
12)What best describes the appearance of an application with the following code?
import java.awt.*;
public class FlowAp extends Frame{
public static void main(String argv[]){
FlowAp fa=new FlowAp();
fa.setSize(400,300);
fa.setVisible(true);
}
FlowAp(){
add(new Button("One"));
add(new Button("Two"));
add(new Button("Three"));
add(new Button("Four"));
}//End of constructor
}//End of Application
1) A Frame with buttons marked One to Four placed on each edge.
2) A Frame with buutons marked One to four running from the top to bottom
3) A Frame with one large button marked Four in the Centre
4) An Error at run time indicating you have not set a LayoutManager
13)How do you indicate where a component will be positioned using Flowlayout?
1) North, South,East,West
2) Assign a row/column grid reference
3) Pass a X/Y percentage parameter to the add method
4) Do nothing, the FlowLayout will position the component
14)How do you change the current layout manager for a container
1) Use the setLayout method
2) Once created you cannot change the current layout manager of a component
3) Use the setLayoutManager method
4) Use the updateLayout method
15)Which of the following are fields of the GridBagConstraints class?
1) ipadx 2) fill 3) insets 4) width
16)What most closely matches the appearance when this code runs?
import java.awt.*;
public class CompLay extends Frame{
public static void main(String argv[]){
CompLay cl = new CompLay();
}
CompLay(){
Panel p = new Panel();
p.setBackground(Color.pink);
p.add(new Button("One"));