Su Swagatam

The Rose flower is for someone special
Please don't touch it.



If u want
S----->Smiling
M----> Magnificient
A---->Awesome
R----> Refreshing
T---->Technical

STUFF

Then U R AT THE RIGHT PLACE


Tuesday, March 8, 2011

Teqnix 2011 Java Paper

The Cradle of Bytes
JAVA Objective Paper
Participant Name:-
College:-
Mobile No:-

1.  public Object m()
{ Object o = new Float(3.14F);
Object [] oa = new Object[l];
oa[0] = o; /* Line 5 */
o = null; /* Line 6 */
oa[0] = null; /* Line 7 */
return o; /* Line 8 */
}
When is the Float object, created in line 3, eligible for garbage collection?
A.
just after line 5
B.
just after line 6
C.
just after line 7
D.
just after line 8

2.  What will be the output of the program?

public class TestDogs
{
public static void main(String [] args)
{
Dog [][] theDogs = new Dog[3][];
System.out.println(theDogs[2][0].toString());
}
}
class Dog { }
A.
Null
B.
theDogs
C.
Compilation fails
D.
An exception is thrown at runtime

3.  What will be the output of the program ?
public class Test
{
public static void main(String [] args)
{
signed int x = 10;
for (int y=0; y<5; y++, x--)
System.out.print(x + ", ");
}
}
A.
10, 9, 8, 7, 6,
B.
9, 8, 7, 6, 5,
C.
Compilation fails.
D.
An exception is thrown at runtime.

4.  Which one of the following will declare an array and initialize it with five numbers?
A.
Array a = new Array(5);
B.
int [] a = {23,22,21,20,19};
C.
int a [] = new int(5);
D.
int [5] array;

5.  Which three are valid declarations of a float?
1.float f1 = -343;
2.float f2 = 3.14;
3.float f3 = 0x12345;
4.float f4 = 42e7;
5.float f5 = 2001.0D;
6.float f6 = 2.81F;
A.
1, 2, 4
B.
2, 3, 5
C.
1, 3, 6
D.
2, 4, 6

6.  What will be the output of the program?
int i = l, j = -1;
switch (i)
{
case 0, 1: j = 1; /* Line 4 */
case 2: j = 2;
default: j = 0;
}
System.out.println("j = " + j);
A.
j = -1
B.
j = 0
C.
j = 1
D.
Compilation fails.

7.  What will be the output of the program?
int i = 1, j = 10;
do
{
if(i > j)
{
break;
}
j--;
} while (++i < 5);
System.out.println("i = " + i + " and j = " + j);
A.
i = 6 and j = 5
B.
i = 5 and j = 5
C.
i = 6 and j = 4
D.
i = 5 and j = 6

8.  What will be the output of the program?
int x = 1, y = 6;
while (y--)
{
x++;
}
System.out.println("x = " + x +" y = " + y);
A.
x = 6 y = 0
B.
x = 7 y = 0
C.
x = 6 y = -1
D.
Compilation fails.

9.  What will be the output of the program?
int I = 0;
outer:
while (true)
{
I++;
inner:
for (int j = 0; j < 10; j++)
{
I += j;
if (j == 3)
continue inner;
break outer;
}
continue outer;
}
System.out.println(I);
A.
1
B.
2
C.
3
D.
4

10.  What will be the output of the program?
int I = 0;
label:
if (I < 2) {
System.out.print("I is " + I);
I++;
continue label;
}
A.
I is 0
B.
I is 0 I is 1
C.
Compilation fails.
D.
None of the above

11.  class Foo
{
class Bar{ }
}
class Test
{
public static void main (String [] args)
{
Foo f = new Foo();
/* Line 10: Missing statement ? */
}
}
which statement, inserted at line 10, creates an instance of Bar?
A.
Foo.Bar b = new Foo.Bar();
B.
Foo.Bar b = f.new Bar();
C.
Bar b = new f.Bar();
D.
Bar b = f.new Bar();

12  What will be the output of the program?
public class Test
{
public static void main(String[] args)
{
int x = 0;
assert (x > 0) ? "assertion failed" : "assertion passed" ;
System.out.println("finished");
}
}
A.
finished
B.
Compiliation fails.
C.
An AssertionError is thrown and finished is output.
D.
An AssertionError is thrown with the message "assertion failed."

13.  public class Test { }
What is the prototype of the default constructor?
A.
Test( )
B.
Test(void)
C.
public Test( )
D.
public Test(void)


14.What will be the output of the program?
try
{
int x = 0;
int y = 5 / x;
}
catch (Exception e)
{
System.out.println("Exception");
}
catch (ArithmeticException ae)
{
System.out.println(" Arithmetic Exception");
}
System.out.println("finished");
A.
Finished
B.
Exception
C.
Compilation fails.
D.
Arithmetic Exception

15.  Which class or interface defines the wait(), notify(),and notifyAll() methods?
A.
Object
B.
Thread
C.
Runnable
D.
Class

16.  public class MyRunnable implements Runnable
{
public void run()
{
// some code here
}
}
which of these will create and start this thread?
A.
new Runnable(MyRunnable).start();
B.
new Thread(MyRunnable).run();
C.
new Thread(new MyRunnable()).start();
D.
new MyRunnable().start();

17.  What will be the output of the program?
class MyThread extends Thread
{
public static void main(String [] args)
{
MyThread t = new MyThread();
t.start();
System.out.print("one. ");
t.start();
System.out.print("two. ");
}
public void run()
{
System.out.print("Thread ");
}
}
A.
Compilation fails
B.
An exception occurs at runtime.
C.
It prints "Thread one. Thread two."
D.
The output cannot be determined.

18.  What will be the output of the program?
class MyThread extends Thread
{
public static void main(String [] args)
{
MyThread t = new MyThread();
Thread x = new Thread(t);
x.start(); /* Line 7 */
}
public void run()
{
for(int i = 0; i < 3; ++i)
{
System.out.print(i + "..");
}
}
}
A.
Compilation fails.
B.
1..2..3..
C.
0..1..2..3..
D.
0..1..2..


19  What will be the output of the program?
String x = new String("xyz");
y = "abc";
x = x + y;
how many String objects have been created?
A.
2
B.
3
C.
4
D.
5


20  What will be the output of the program?
String x = "xyz";
x.toUpperCase(); /* Line 2 */
String y = x.replace('Y', 'y');
y = y + "abc";
System.out.println(y);
A.
abcXyZ
B.
Abcxyz
C.
Xyzabc
D.
XyZabc

21.  What will be the output of the program?
try
{
Float f1 = new Float("3.0");
int x = f1.intValue();
byte b = f1.byteValue();
double d = f1.doubleValue();
System.out.println(x + b + d);
}
catch (NumberFormatException e)
{
System.out.println("bad number");
}
A.
9.0
B.
bad number
C.
Compilation fails on line 13.
D.
Compilation fails on line 14.

22.  What will be the output of the program?
class Q207
{
public static void main(String[] args)
{
int i1 = 5;
int i2 = 6;
String s1 = "7";
System.out.println(i1 + i2 + s1); /* Line 8 */
}
}
A.
18
B.
117
C.
567
D.
Compiler error


23.  What will be the output of the program?
public class StringRef
{
public static void main(String [] args)
{
String s1 = "abc";
String s2 = "def";
String s3 = s2; /* Line 7 */
s2 = "ghi";
System.out.println(s1 + s2 + s3);
}
}
A.
Abcdefghi
B.
Abcdefdef
C.
Abcghidef
D.
Abcghighi

24.  What will be the output of the program?

String a = "ABCD";
String b = a.toLowerCase();
b.replace('a','d');
b.replace('b','c');
System.out.println(b);
A.
abcd
B.
ABCD
C.
Dccd
D.
Dcba

25.  Which class does not override the equals() and hashCode() methods, inheriting them directly from class Object?
A.
java.lang.String
B.
java.lang.Double
C.
java.lang.StringBuffer
D.
java.lang.Character


java key...............





1.c

2.d

3.c

4.b

5.c

6.d

7.d

8.d

9.a

10.c

------------------------------

11.b

12.b

13.c

14.c

15.a

16.c

17.b

18.d

19.c----

20.c-----

21.a---

22.b-------

23.c

24.a--------

25.c--

Teqnix 2011 C paper

The Cradle of Bytes
C Objective Paper
Participant Name:-
College:-
Mobile No:-
1.  What will be the output of the program ?
#include

int main()
{
static char *s[] = {"black", "white", "pink", "violet"};
char **ptr[] = {s+3, s+2, s+1, s}, ***p;
p = ptr;
++p;
printf("%s", **p+1);
return 0;
}
A.
Ink
B.
ack
C.
Ite
D.
let

2.  What will be the output of the program?
#include
int main()
{
float a=0.7;
if(a < 0.7)
printf("C\n");
else
printf("C++\n");
return 0;
}
A.
C
B.
C++
C.
Compiler error
D.
Non of above

3.  What will be the output of the program?
#include
#include
int main()
{
printf("%d, %d, %d\n", sizeof(3.14f), sizeof(3.14), sizeof(3.14L));
return 0;
}
A.
4, 4, 4
B.
4, 8, 8
C.
4, 8, 10
D.
4, 8, 12

4.  What will be the output of the program?
#include
int main()
{
float *p;
printf("%d\n", sizeof(p));
return 0;
}
A.
2 in 16bit compiler, 4 in 32bit compiler
B.
4 in 16bit compiler, 2 in 32bit compiler
C.
4 in 16bit compiler, 4 in 32bit compiler
D.
2 in 16bit compiler, 2 in 32bit compiler

5.  What will be the output of the program ?
#include

int main()
{
union var
{
int a, b;
};
union var v;
v.a=10;
v.b=20;
printf("%d\n", v.a);
return 0;
}
A.
10
B.
20
C.
30
D.
0

6.  What will be the output of the program ?
#include

int main()
{
enum days {MON=-1, TUE, WED=6, THU, FRI, SAT};
printf("%d, %d, %d, %d, %d, %d\n", MON, TUE, WED, THU, FRI, SAT);
return 0;
}
A.
-1, 0, 1, 2, 3, 4
B.
-1, 2, 6, 3, 4, 5
C.
-1, 0, 6, 2, 3, 4
D.
-1, 0, 6, 7, 8, 9
--------------------------------------------------------------------------------------------------
7 What will be the output of the program ?
#include

int main()
{
int i=4, j=8;
printf("%d, %d, %d\n", i|j&j|i, i|j&j|i, i^j);
return 0;
}
A.
12, 12, 12
B.
112, 1, 12
C.
32, 1, 12
D.
-64, 1, 12

8.  What will be the output of the program ?
#include

int main()
{
enum value{VAL1=0, VAL2, VAL3, VAL4, VAL5} var;
printf("%d\n", sizeof(var));
return 0;
}
A.
1
B.
2
C.
4
D.
10

9  Assunming, integer is 2 byte, What will be the output of the program?
#include

int main()
{
printf("%x\n", -1>>1);
return 0;
}
A.
ffff
B.
0fff
C.
0000
D.
fff0

10 What will be the output of the program?
#include

int main()
{
printf("%d >> %d %d >> %d\n", 4 >> 1, 8 >> 1);
return 0;
}
A.
4 1 8 1
B.
4 >> 1 8 >> 1
C.
2 >> 4 Garbage value >> Garbage value
D.
2 4

11 What will be the output of the program ?
#include

int main()
{
int i=32, j=0x20, k, l, m;
k=i|j;
l=i&j;
m=k^l;
printf("%d, %d, %d, %d, %d\n", i, j, k, l, m);
return 0;
}
A.
0, 0, 0, 0, 0
B.
0, 32, 32, 32, 32
C.
32, 32, 32, 32, 0
D.
32, 32, 32, 32, 32

12.  What will be the output of the program?
#include

int main()
{
unsigned int res;
res = (64 >>(2+1-2)) & (~(1<<2));
printf("%d\n", res);
return 0;
}
A.
32
B.
64
C.
0
D.
128

13 Point out the error in the following program.
#include
#include

int main()
{
char *ptr;
*ptr = (char)malloc(30);
strcpy(ptr, "RAM");
printf("%s", ptr);
free(ptr);
return 0;
}
A.
Error: in strcpy() statement.
B.
Error: in *ptr = (char)malloc(30);
C.
Error: in free(ptr);
D.
No error

14.  What will the function rewind() do?
A.
Reposition the file pointer to a character reverse.
B.
Reposition the file pointer stream to end of file.
C.
Reposition the file pointer to begining of that line.
D.
Reposition the file pointer to begining of file.

15 Declare the following statement?
"An array of three pointers to chars".
A.
char *ptr[3]();
B.
char *ptr[3];
C.
char (*ptr[3])();
D.
char **ptr[3];


16 In which stage the following code
#include
gets replaced by the contents of the file stdio.h
A.
During editing
B.
During linking
C.
During execution
D.
During preprocessing

17 What will be the output of the program?
#include
#define SQR(x)(x*x)

int main()
{
int a, b=3;
a = SQR(b+2);
printf("%d\n", a);
return 0;
}
A.
25
B.
11
C.
Error
D.
Garbage value

18 What will be the output of the program?
#include
#define CUBE(x) (x*x*x)

int main()
{
int a, b=3;
a = CUBE(b++);
printf("%d, %d\n", a, b);
return 0;
}
A.
9, 4
B.
27, 4
C.
27, 6
D.
Error

19 What will be the output of the program ?
#include
#include

int main()
{
char str[] = "India\0\BIX\0";
printf("%s\n", str);
return 0;
}
A.
BIX
B.
India
C.
India BIX
D.
India\0BIX

20  What will be the output of the program ?
#include

int main()
{
char str[7] = "IndiaBIX";
printf("%s\n", str);
return 0;
}
A.
Error
B.
IndiaBIX
C.
Cannot predict
D.
None of above


21.  What will be the output of the program ?
#include

int main()
{
printf("%d, %d, %d", sizeof(3.0f), sizeof(“3”), sizeof(3.0));
return 0;
}
A.
8, 1, 4
B.
4, 2, 8
C.
4, 2, 4
D.
10, 3, 4

22 What is the notation for following functions?
1. int f(int a, float b)
{
/* Some code */
}

2. int f(a, b)
int a; float b;
{
/* Some code */
}
A.
1. KR Notation
2. ANSI Notation
B.
1. Pre ANSI C Notation
2. KR Notation
C.
1. ANSI Notation
2. KR Notation
D.
1. ANSI Notation
2. Pre ANSI Notation


23 What will be the output of the program?
#include

int main()
{
int fun(int);
int i = fun(10);
printf("%d\n", --i);
return 0;
}
int fun(int i)
{
return (i++);
}
A.
9
B.
10
C.
11
D.
8
24.  What will be the output of the program if the array begins at 65486 and each integer occupies 2 bytes?
#include

int main()
{
int arr[] = {12, 14, 15, 23, 45};
printf("%u, %u\n", arr+1, &arr+1);
return 0;
}
A.
65488, 65490
B.
64490, 65492
C.
65488, 65496
D.
64490, 65498

25.  What will be the output of the program ?
#include

int main()
{
float arr[] = {12.4, 2.3, 4.5, 6.7};
printf("%d\n", sizeof(arr)/sizeof(arr[0]));
return 0;
}
A.
5
B.
4
C.
6
D.
7



c key................





1.a-

2.a-

3.c-

4.a-

5.b-

6.d-

7.a-

8.b-

9.a--

10.c-

11.c-

12.a-

13.b-

14.d-

15.b

--------------------

16.d-

17.b-

18.c-

19.b-

20.c--

21.b-

22.c-

23.a-

24.c-

25.b-

C ++ Paper

The Cradle of Bytes
C++ Objective Paper
Participant Name:-
College:-
Mobile No:-
1-void main () {
int x=10;
int &y=x;
y=20;
cout << x ; cout<a. 1010 b. 2020 c. 1020 d. 2010
2-11 ^ 5
What does the operation shown above produce?
a. 1 b. error c. 5th power of 11 d. 14
3-What do we mean by containership ?
a. a class can contain object of other classes b. a class can be defined inside another class c. a class can be inherited by many other classes d. None
4-What is the output?
class LD {
int i; }
class CE : public LD {
int j; }
void main() {
CE ce;
ce.i=10; ce.j=20 ;
cout << ce.i; cout <a. 1020 b. 2010 c. compile error d. None
5-. In protected derivation of a class
a. public becomes protected b. private becomes protected c. protected becomes protected d. both a and c
6- void main(){
static int i;
switch(i) {
default:cout<<"garbage";
case 0: cout<<"zero"; break;
case 1:cout<<"one"; break;
case 2: cout<<"two"; break; } }
a. error b. zero c. garbage zero d. zero garbage
7-What is output ?
void main(){
cout<<(-1<<4); }
a. ff00 b. ffff c. 240 d. None
8 -.What is the output ?
#define square(x) x*x
void main(){
int i; i = 64/square(4); cout << i; }
a. 16 b. 64 c. 4 d. error
9-What is the output?
main(){
cout<< main}
a. some address b. undefined symbol error c. 0xfa d. None
10-#define int char
main(){
int i=65 ; j=sizeof(i);
cout<a. error b. 1 c. 2 d. 0
11-int testarray[3][2][2] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12};
What value does testarray[2][1][0] in the sample code above contain?
a. 3 b. 5 c. 7 d. 11
12-What is a difference between a declaration and a definition of a variable?
a. Both can occur multiple times, but a declaration must occur first.
b. A definition occurs once, but a declaration may occur many times.
c. A declaration occurs once, but a definition may occur many times.
d. Both can occur multiple times, but a definition must occur first.
13-What is the output ?
void main() {
int x, y=10 , z=10;
x=(y==z);
cout << x; }
a. 0 b. 1 c. error d. 10
14-Consider following code
class person { };
class Student : protected person { } ;
What happens in above code ?
a. will not compile because class body of person is not defined. b. will not compile becauses class body of student is not defined .c. will not compile because class person is not public inherited. d. will compile successfully.
15-.which of the following is not overloading the function?
int sum(int x,int y)
a. int sum(int x,int y,int z) b. float sum(int x, int y) c. int sum(float x, float y) d. float sum( int x, int y , float z)
16.which of the following functions give the current size of string object?
a. max_size() b. capacity() c. size() d. find()
17.We can make a class abstract by
a. using static key word b. using virtual keyword c. making at least one member function as virtual function d. making at least one member function as pure virtual function
18.Which of the following will produce a value of -22 if x=-22.9?
a. ceil() b. ceiling() c. floor() d. flooring()
19.What is result of the expression
(1 & 2) + ( 3 | 4) in base two?
a. 7 b. 110 c. 111 d. 101
20-.The actual source code for implementing a template function is created when
a. The function is actually created b. The declaration of the function appears
c. The definition of function appears d. The function is invoked
21.Which of the following is a sequence container?
a. stack b. deque c. queue d. set
22-.What is the error in the following code?
Class test {
Virtual void display();}
a.no error b. function display() should be declared static c. function display should be defined d. Test class should contain data members
23-. The friend functions are used in situations where
a. we want to exchange data between classes b. we want to have access to unrelated classes c. dynamic binding is required d. none
24.which of following are legal declarations of a reference?
a. int &a=10 b. int &a=m c. int &a=m++ d. all of these
25.which of the following cannot be passed to a function?
a. aliases b. header files c. both a and b d. none

c++ key
1-b

2-d

3-a

4-c// i is private member of class LD . so it cant be inherited

5-d

6-b// static variables r automatically asssigned 0 value

7-d

8-b// precedence of / is more tham that of * 64/4*4=16*4=64

9-a// functions also have address as variables

1o-b

11-d

12-c

13-b

14-d

15-b

16-c

17-d

18-a

19-c

20-d

21-b

22-a

23-b

24-b

25-b