lehman brothers sample programming placement paper level1
TRANSCRIPT
-
7/29/2019 Lehman Brothers Sample programming Placement Paper Level1
1/20
Visitwww.latestoffcampus.com for placement papers, interview tips & job updates. Toget
freeupdates tomailhttps://groups.google.com/group/latestoffcampusLive updates on Facebook @
https://www.facebook.com/LatestOffCampus
Visitwww.latestoffcampus.com for placement papers, interview tips & job updates. Toget
freeupdates tomailhttps://groups.google.com/group/latestoffcampusLive updates on Facebook @
https://www.facebook.com/LatestOffCampus
TITLE:Lehman Brothers Sample Programming Placement Paper Level1
(Bolded option is your answer)
1.void start() {
A a = new A();
B b = new B();
a.s(b);
b = null; /* Line 5 */
a = null; /* Line 6 */
System.out.println("start completed"); /* Line 7 */
}
When is the B object, created in line 3, eligible for garbage collection?A after line 5 B after
line 6
C after line 7 D There is no
way to be
absolutely
certain.
2.class HappyGarbage01
{
public static void main(String args[])
{HappyGarbage01 h = new HappyGarbage01();
h.methodA(); /* Line 6 */
}
Object methodA()
{
Object obj1 = new Object();
Object [] obj2 = new Object[1];
obj2[0] = obj1;obj1 = null;
return obj2[0];
}
}
http://www.latestoffcampus.com/http://www.latestoffcampus.com/http://www.latestoffcampus.com/https://groups.google.com/group/latestoffcampushttps://groups.google.com/group/latestoffcampushttps://www.facebook.com/LatestOffCampushttps://www.facebook.com/LatestOffCampushttp://www.latestoffcampus.com/http://www.latestoffcampus.com/http://www.latestoffcampus.com/https://groups.google.com/group/latestoffcampushttps://groups.google.com/group/latestoffcampushttps://www.facebook.com/LatestOffCampushttps://www.facebook.com/LatestOffCampushttps://www.facebook.com/LatestOffCampushttps://groups.google.com/group/latestoffcampushttp://www.latestoffcampus.com/https://www.facebook.com/LatestOffCampushttps://groups.google.com/group/latestoffcampushttp://www.latestoffcampus.com/ -
7/29/2019 Lehman Brothers Sample programming Placement Paper Level1
2/20
Visitwww.latestoffcampus.com for placement papers, interview tips & job updates. Toget
freeupdates tomailhttps://groups.google.com/group/latestoffcampusLive updates on Facebook @
https://www.facebook.com/LatestOffCampus
Visitwww.latestoffcampus.com for placement papers, interview tips & job updates. Toget
freeupdates tomailhttps://groups.google.com/group/latestoffcampusLive updates on Facebook @
https://www.facebook.com/LatestOffCampus
Where will be the most chance of the garbage collector being invoked?
A After line 9 B Afterline 10 C After line 11 D Garbagecollector
never
invoked in
methodA()
3.class Bar { }
class Test
{
Bar doBar(){
Bar b = new Bar(); /* Line 6 */
return b; /* Line 7 */
}
public static void main (String args[])
{
Test t = new Test(); /* Line 11 */
Bar newBar = t.doBar(); /* Line 12 */System.out.println("newBar");
newBar = new Bar(); /* Line 14 */
System.out.println("finishing"); /* Line 15 */
}
}
At what point is the Bar object, created on line 6, eligible for garbage
collection?
A after line 12 B afterline 14
C after line 7, when
doBar() completes
D after line
15, when
main()
completes
http://www.latestoffcampus.com/http://www.latestoffcampus.com/http://www.latestoffcampus.com/https://groups.google.com/group/latestoffcampushttps://groups.google.com/group/latestoffcampushttps://www.facebook.com/LatestOffCampushttps://www.facebook.com/LatestOffCampushttp://www.latestoffcampus.com/http://www.latestoffcampus.com/http://www.latestoffcampus.com/https://groups.google.com/group/latestoffcampushttps://groups.google.com/group/latestoffcampushttps://www.facebook.com/LatestOffCampushttps://www.facebook.com/LatestOffCampushttps://www.facebook.com/LatestOffCampushttps://groups.google.com/group/latestoffcampushttp://www.latestoffcampus.com/https://www.facebook.com/LatestOffCampushttps://groups.google.com/group/latestoffcampushttp://www.latestoffcampus.com/ -
7/29/2019 Lehman Brothers Sample programming Placement Paper Level1
3/20
Visitwww.latestoffcampus.com for placement papers, interview tips & job updates. Toget
freeupdates tomailhttps://groups.google.com/group/latestoffcampusLive updates on Facebook @
https://www.facebook.com/LatestOffCampus
Visitwww.latestoffcampus.com for placement papers, interview tips & job updates. Toget
freeupdates tomailhttps://groups.google.com/group/latestoffcampusLive updates on Facebook @
https://www.facebook.com/LatestOffCampus
4.public class X
{
public static void main(String [] args)
{
X x = new X();
X x2 = m1(x); /* Line 6 */
X x4 = new X();
x2 = x4; /* Line 8 */
doComplexStuff();
}
static X m1(X mx){
mx = new X();
return mx;
}
}
After line 8 runs. how many objects are eligible for garbage collection?
A 0 B 1 C 2 D 3
5.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?
http://www.latestoffcampus.com/http://www.latestoffcampus.com/http://www.latestoffcampus.com/https://groups.google.com/group/latestoffcampushttps://groups.google.com/group/latestoffcampushttps://www.facebook.com/LatestOffCampushttps://www.facebook.com/LatestOffCampushttp://www.latestoffcampus.com/http://www.latestoffcampus.com/http://www.latestoffcampus.com/https://groups.google.com/group/latestoffcampushttps://groups.google.com/group/latestoffcampushttps://www.facebook.com/LatestOffCampushttps://www.facebook.com/LatestOffCampushttps://www.facebook.com/LatestOffCampushttps://groups.google.com/group/latestoffcampushttp://www.latestoffcampus.com/https://www.facebook.com/LatestOffCampushttps://groups.google.com/group/latestoffcampushttp://www.latestoffcampus.com/ -
7/29/2019 Lehman Brothers Sample programming Placement Paper Level1
4/20
Visitwww.latestoffcampus.com for placement papers, interview tips & job updates. Toget
freeupdates tomailhttps://groups.google.com/group/latestoffcampusLive updates on Facebook @
https://www.facebook.com/LatestOffCampus
Visitwww.latestoffcampus.com for placement papers, interview tips & job updates. Toget
freeupdates tomailhttps://groups.google.com/group/latestoffcampusLive updates on Facebook @
https://www.facebook.com/LatestOffCampus
A just after line
5
B just
after line 6
C just after line 7 D just after
line 8
6.class X2{
public X2 x;
public static void main(String [] args)
{
X2 x2 = new X2(); /* Line 6 */
X2 x3 = new X2(); /* Line 7 */
x2.x = x3;
x3.x = x2;x2 = new X2();
x3 = x2; /* Line 11 */
doComplexStuff();
}
}
after line 11 runs, how many objects are eligible for garbage collection?
A 0 B 1 C 2 D 3
7.What allows the programmer to destroy an object x?
A x.delete() B
x.finalize()
C
Runtime.getRuntime().gc()
D Only the
garbage
collection
system can
destroy anobject.
8.What will be the output of the program?
class PassA
http://www.latestoffcampus.com/http://www.latestoffcampus.com/http://www.latestoffcampus.com/https://groups.google.com/group/latestoffcampushttps://groups.google.com/group/latestoffcampushttps://www.facebook.com/LatestOffCampushttps://www.facebook.com/LatestOffCampushttp://www.latestoffcampus.com/http://www.latestoffcampus.com/http://www.latestoffcampus.com/https://groups.google.com/group/latestoffcampushttps://groups.google.com/group/latestoffcampushttps://www.facebook.com/LatestOffCampushttps://www.facebook.com/LatestOffCampushttps://www.facebook.com/LatestOffCampushttps://groups.google.com/group/latestoffcampushttp://www.latestoffcampus.com/https://www.facebook.com/LatestOffCampushttps://groups.google.com/group/latestoffcampushttp://www.latestoffcampus.com/ -
7/29/2019 Lehman Brothers Sample programming Placement Paper Level1
5/20
Visitwww.latestoffcampus.com for placement papers, interview tips & job updates. Toget
freeupdates tomailhttps://groups.google.com/group/latestoffcampusLive updates on Facebook @
https://www.facebook.com/LatestOffCampus
Visitwww.latestoffcampus.com for placement papers, interview tips & job updates. Toget
freeupdates tomailhttps://groups.google.com/group/latestoffcampusLive updates on Facebook @
https://www.facebook.com/LatestOffCampus
{
public static void main(String [] args)
{
PassA p = new PassA();
p.start();
}
void start()
{
long [] a1 = {3,4,5};
long [] a2 = fix(a1);System.out.print(a1[0] + a1[1] + a1[2] + " ");
System.out.println(a2[0] + a2[1] + a2[2]);
}
long [] fix(long [] a3)
{
a3[1] = 7;
return a3;}
}
A 12 15 B 15 15 C 3 4 5 3 7 5 D 3 7 5 3 7 5
9.What will be the output of the program?
class Test
{public static void main(String [] args)
{
Test p = new Test();
http://www.latestoffcampus.com/http://www.latestoffcampus.com/http://www.latestoffcampus.com/https://groups.google.com/group/latestoffcampushttps://groups.google.com/group/latestoffcampushttps://www.facebook.com/LatestOffCampushttps://www.facebook.com/LatestOffCampushttp://www.latestoffcampus.com/http://www.latestoffcampus.com/http://www.latestoffcampus.com/https://groups.google.com/group/latestoffcampushttps://groups.google.com/group/latestoffcampushttps://www.facebook.com/LatestOffCampushttps://www.facebook.com/LatestOffCampushttps://www.facebook.com/LatestOffCampushttps://groups.google.com/group/latestoffcampushttp://www.latestoffcampus.com/https://www.facebook.com/LatestOffCampushttps://groups.google.com/group/latestoffcampushttp://www.latestoffcampus.com/ -
7/29/2019 Lehman Brothers Sample programming Placement Paper Level1
6/20
Visitwww.latestoffcampus.com for placement papers, interview tips & job updates. Toget
freeupdates tomailhttps://groups.google.com/group/latestoffcampusLive updates on Facebook @
https://www.facebook.com/LatestOffCampus
Visitwww.latestoffcampus.com for placement papers, interview tips & job updates. Toget
freeupdates tomailhttps://groups.google.com/group/latestoffcampusLive updates on Facebook @
https://www.facebook.com/LatestOffCampus
p.start();
}
void start()
{
boolean b1 = false;
boolean b2 = fix(b1);
System.out.println(b1 + " " + b2);
}
boolean fix(boolean b1){
b1 = true;
return b1;
}
}
A true true B false
true
C true false D false false
10.What will be the output of the program?
class PassS
{
public static void main(String [] args)
{
PassS p = new PassS();
p.start();
}
void start()
{
http://www.latestoffcampus.com/http://www.latestoffcampus.com/http://www.latestoffcampus.com/https://groups.google.com/group/latestoffcampushttps://groups.google.com/group/latestoffcampushttps://www.facebook.com/LatestOffCampushttps://www.facebook.com/LatestOffCampushttp://www.latestoffcampus.com/http://www.latestoffcampus.com/http://www.latestoffcampus.com/https://groups.google.com/group/latestoffcampushttps://groups.google.com/group/latestoffcampushttps://www.facebook.com/LatestOffCampushttps://www.facebook.com/LatestOffCampushttps://www.facebook.com/LatestOffCampushttps://groups.google.com/group/latestoffcampushttp://www.latestoffcampus.com/https://www.facebook.com/LatestOffCampushttps://groups.google.com/group/latestoffcampushttp://www.latestoffcampus.com/ -
7/29/2019 Lehman Brothers Sample programming Placement Paper Level1
7/20
Visitwww.latestoffcampus.com for placement papers, interview tips & job updates. Toget
freeupdates tomailhttps://groups.google.com/group/latestoffcampusLive updates on Facebook @
https://www.facebook.com/LatestOffCampus
Visitwww.latestoffcampus.com for placement papers, interview tips & job updates. Toget
freeupdates tomailhttps://groups.google.com/group/latestoffcampusLive updates on Facebook @
https://www.facebook.com/LatestOffCampus
String s1 = "slip";
String s2 = fix(s1);
System.out.println(s1 + " " + s2);
}
String fix(String s1)
{
s1 = s1 + "stream";
System.out.print(s1 + " ");
return "stream";
}}
A slip stream B
slipstream
stream
C stream slip stream D slipstream
slip stream
11.Which of the following is the correct output for the C#.NET code
snippet given below?
enum color{
red,
green,
blue
}
color c;
c = color.red;
Console.WriteLine(c);A 1 B -1 C red D 0
http://www.latestoffcampus.com/http://www.latestoffcampus.com/http://www.latestoffcampus.com/https://groups.google.com/group/latestoffcampushttps://groups.google.com/group/latestoffcampushttps://www.facebook.com/LatestOffCampushttps://www.facebook.com/LatestOffCampushttp://www.latestoffcampus.com/http://www.latestoffcampus.com/http://www.latestoffcampus.com/https://groups.google.com/group/latestoffcampushttps://groups.google.com/group/latestoffcampushttps://www.facebook.com/LatestOffCampushttps://www.facebook.com/LatestOffCampushttps://www.facebook.com/LatestOffCampushttps://groups.google.com/group/latestoffcampushttp://www.latestoffcampus.com/https://www.facebook.com/LatestOffCampushttps://groups.google.com/group/latestoffcampushttp://www.latestoffcampus.com/ -
7/29/2019 Lehman Brothers Sample programming Placement Paper Level1
8/20
Visitwww.latestoffcampus.com for placement papers, interview tips & job updates. Toget
freeupdates tomailhttps://groups.google.com/group/latestoffcampusLive updates on Facebook @
https://www.facebook.com/LatestOffCampus
Visitwww.latestoffcampus.com for placement papers, interview tips & job updates. Toget
freeupdates tomailhttps://groups.google.com/group/latestoffcampusLive updates on Facebook @
https://www.facebook.com/LatestOffCampus
12.Which of the following will be the correct output for the C#.NET
code snippet given below?
enum color : int
{
red = -3,
green,
blue
}
Console.Write( (int) color.red + ", ");
Console.Write( (int) color.green + ", ");Console.Write( (int) color.blue );
A -3, -2, -1 B -3, 0, 1 C 0, 1, 2 D red, green,
blue
13.Which of the following is the correct output for the C#.NET code
snippet given below?
enum color: int
{red,
green,
blue = 5,
cyan,
magenta = 10,
yellow
}
Console.Write( (int) color.green + ", " );Console.Write( (int) color.yellow );
A 2, 11 B 1, 11 C 2, 6 D 1, 5
http://www.latestoffcampus.com/http://www.latestoffcampus.com/http://www.latestoffcampus.com/https://groups.google.com/group/latestoffcampushttps://groups.google.com/group/latestoffcampushttps://www.facebook.com/LatestOffCampushttps://www.facebook.com/LatestOffCampushttp://www.latestoffcampus.com/http://www.latestoffcampus.com/http://www.latestoffcampus.com/https://groups.google.com/group/latestoffcampushttps://groups.google.com/group/latestoffcampushttps://www.facebook.com/LatestOffCampushttps://www.facebook.com/LatestOffCampushttps://www.facebook.com/LatestOffCampushttps://groups.google.com/group/latestoffcampushttp://www.latestoffcampus.com/https://www.facebook.com/LatestOffCampushttps://groups.google.com/group/latestoffcampushttp://www.latestoffcampus.com/ -
7/29/2019 Lehman Brothers Sample programming Placement Paper Level1
9/20
Visitwww.latestoffcampus.com for placement papers, interview tips & job updates. Toget
freeupdates tomailhttps://groups.google.com/group/latestoffcampusLive updates on Facebook @
https://www.facebook.com/LatestOffCampus
Visitwww.latestoffcampus.com for placement papers, interview tips & job updates. Toget
freeupdates tomailhttps://groups.google.com/group/latestoffcampusLive updates on Facebook @
https://www.facebook.com/LatestOffCampus
14.Which of the following is the correct output of the C#.NET code
snippet given below?
int[ , , ] a = new int[ 3, 2, 3 ];
Console.WriteLine(a.Length);
A 20 B 4 C 18 D 10
15.Which of the following is the correct output of the C#.NET code
snippet given below?
int[][] a = new int[2][];a[0] = new int[4]{6, 1, 4, 3};
a[1] = new int[3]{9, 2, 7};
Console.WriteLine(a[1].GetUpperBound(0));
A 2 B 3 C 4 D 5
16.What will be the output of the C#.NET code snippet given below?
namespace IndiabixConsoleApplication
{
class SampleProgram
{
static void Main(string[ ] args)
{
int i, j;
int[ , ] arr = new int[ 2, 2 ];
for(i = 0; i < 2; ++i)
{
for(j = 0; j < 2; ++j)
{
http://www.latestoffcampus.com/http://www.latestoffcampus.com/http://www.latestoffcampus.com/https://groups.google.com/group/latestoffcampushttps://groups.google.com/group/latestoffcampushttps://www.facebook.com/LatestOffCampushttps://www.facebook.com/LatestOffCampushttp://www.latestoffcampus.com/http://www.latestoffcampus.com/http://www.latestoffcampus.com/https://groups.google.com/group/latestoffcampushttps://groups.google.com/group/latestoffcampushttps://www.facebook.com/LatestOffCampushttps://www.facebook.com/LatestOffCampushttps://www.facebook.com/LatestOffCampushttps://groups.google.com/group/latestoffcampushttp://www.latestoffcampus.com/https://www.facebook.com/LatestOffCampushttps://groups.google.com/group/latestoffcampushttp://www.latestoffcampus.com/ -
7/29/2019 Lehman Brothers Sample programming Placement Paper Level1
10/20
Visitwww.latestoffcampus.com for placement papers, interview tips & job updates. Toget
freeupdates tomailhttps://groups.google.com/group/latestoffcampusLive updates on Facebook @
https://www.facebook.com/LatestOffCampus
Visitwww.latestoffcampus.com for placement papers, interview tips & job updates. Toget
freeupdates tomailhttps://groups.google.com/group/latestoffcampusLive updates on Facebook @
https://www.facebook.com/LatestOffCampus
arr[i, j] = i * 17 + i * 17;
Console.Write(arr[ i, j ] + " ");
}
}
}
}
}
A 0 0 34 34 B 0 0 17
17
C 0 0 0 0 D 17 17 0 0
17.Which of the following will be the correct output for the C#.NET
program given below?
namespace IndiabixConsoleApplication
{
class Sample
{
int i;
Single j;
public void SetData(int i, Single j){
i = i;
j = j;
}
public void Display()
{
Console.WriteLine(i + " " + j);
}}
class MyProgram
{
http://www.latestoffcampus.com/http://www.latestoffcampus.com/http://www.latestoffcampus.com/https://groups.google.com/group/latestoffcampushttps://groups.google.com/group/latestoffcampushttps://www.facebook.com/LatestOffCampushttps://www.facebook.com/LatestOffCampushttp://www.latestoffcampus.com/http://www.latestoffcampus.com/http://www.latestoffcampus.com/https://groups.google.com/group/latestoffcampushttps://groups.google.com/group/latestoffcampushttps://www.facebook.com/LatestOffCampushttps://www.facebook.com/LatestOffCampushttps://www.facebook.com/LatestOffCampushttps://groups.google.com/group/latestoffcampushttp://www.latestoffcampus.com/https://www.facebook.com/LatestOffCampushttps://groups.google.com/group/latestoffcampushttp://www.latestoffcampus.com/ -
7/29/2019 Lehman Brothers Sample programming Placement Paper Level1
11/20
Visitwww.latestoffcampus.com for placement papers, interview tips & job updates. Toget
freeupdates tomailhttps://groups.google.com/group/latestoffcampusLive updates on Facebook @
https://www.facebook.com/LatestOffCampus
Visitwww.latestoffcampus.com for placement papers, interview tips & job updates. Toget
freeupdates tomailhttps://groups.google.com/group/latestoffcampusLive updates on Facebook @
https://www.facebook.com/LatestOffCampus
static void Main(string[ ] args)
{
Sample s1 = new Sample();
s1.SetData(10, 5.4f);
s1.Display();
}
}
}
A 0 0 B 10 5.4 C 10 5.400000 D 10 5
18.Which of the following will be the correct output for the C#.NETprogram given below?
namespace IndiabixConsoleApplication
{
class Sample
{
int i;
Single j;public void SetData(int i, Single j)
{
this.i = i;
this.j = j;
}
public void Display()
{
Console.WriteLine(i + " " + j);}
}
class MyProgram
http://www.latestoffcampus.com/http://www.latestoffcampus.com/http://www.latestoffcampus.com/https://groups.google.com/group/latestoffcampushttps://groups.google.com/group/latestoffcampushttps://www.facebook.com/LatestOffCampushttps://www.facebook.com/LatestOffCampushttp://www.latestoffcampus.com/http://www.latestoffcampus.com/http://www.latestoffcampus.com/https://groups.google.com/group/latestoffcampushttps://groups.google.com/group/latestoffcampushttps://www.facebook.com/LatestOffCampushttps://www.facebook.com/LatestOffCampushttps://www.facebook.com/LatestOffCampushttps://groups.google.com/group/latestoffcampushttp://www.latestoffcampus.com/https://www.facebook.com/LatestOffCampushttps://groups.google.com/group/latestoffcampushttp://www.latestoffcampus.com/ -
7/29/2019 Lehman Brothers Sample programming Placement Paper Level1
12/20
Visitwww.latestoffcampus.com for placement papers, interview tips & job updates. Toget
freeupdates tomailhttps://groups.google.com/group/latestoffcampusLive updates on Facebook @
https://www.facebook.com/LatestOffCampus
Visitwww.latestoffcampus.com for placement papers, interview tips & job updates. Toget
freeupdates tomailhttps://groups.google.com/group/latestoffcampusLive updates on Facebook @
https://www.facebook.com/LatestOffCampus
{
static void Main(string[ ] args)
{
Sample s1 = new Sample();
s1.SetData(36, 5.4f);
s1.Display();
}
}
}
A 0 0.0 B 36 5.4 C 36 5.400000 D 36 5
19.What does the following C#.NET code snippet will print?
int i = 0, j = 0;
label:
i++;
j+=i;
if (i < 10){
Console.Write(i +" ");
goto label;
}
A Prints 1 to 9 B Prints 0
to 8
C Prints 2 to 8 D Prints 2 to
9
20.Which of the following is the correct output for the C#.NET program
given below?
int i = 20 ;
for( ; ; )
http://www.latestoffcampus.com/http://www.latestoffcampus.com/http://www.latestoffcampus.com/https://groups.google.com/group/latestoffcampushttps://groups.google.com/group/latestoffcampushttps://www.facebook.com/LatestOffCampushttps://www.facebook.com/LatestOffCampushttp://www.latestoffcampus.com/http://www.latestoffcampus.com/http://www.latestoffcampus.com/https://groups.google.com/group/latestoffcampushttps://groups.google.com/group/latestoffcampushttps://www.facebook.com/LatestOffCampushttps://www.facebook.com/LatestOffCampushttps://www.facebook.com/LatestOffCampushttps://groups.google.com/group/latestoffcampushttp://www.latestoffcampus.com/https://www.facebook.com/LatestOffCampushttps://groups.google.com/group/latestoffcampushttp://www.latestoffcampus.com/ -
7/29/2019 Lehman Brothers Sample programming Placement Paper Level1
13/20
Visitwww.latestoffcampus.com for placement papers, interview tips & job updates. Toget
freeupdates tomailhttps://groups.google.com/group/latestoffcampusLive updates on Facebook @
https://www.facebook.com/LatestOffCampus
Visitwww.latestoffcampus.com for placement papers, interview tips & job updates. Toget
freeupdates tomailhttps://groups.google.com/group/latestoffcampusLive updates on Facebook @
https://www.facebook.com/LatestOffCampus
{
Console.Write(i + " ");
if (i >= -10)
i -= 4;
else
break;
}
A 20 16 12 84 0
-4 -8
B 20 16 12
8 4 0
C 20 16 12 8 4 0 -4 -8 -12 D 16 12 8 4 0
21.What is the output of the C#.NET code snippet given below?
namespace IndiabixConsoleApplication
{
public enum color
{ red, green, blue };
class SampleProgram
{
static void Main (string[ ] args){
color c = color.blue;
switch (c)
{
case color.red:
Console.WriteLine(color.red);
break;
case color.green:
Console.WriteLine(color.green);
break;
http://www.latestoffcampus.com/http://www.latestoffcampus.com/http://www.latestoffcampus.com/https://groups.google.com/group/latestoffcampushttps://groups.google.com/group/latestoffcampushttps://www.facebook.com/LatestOffCampushttps://www.facebook.com/LatestOffCampushttp://www.latestoffcampus.com/http://www.latestoffcampus.com/http://www.latestoffcampus.com/https://groups.google.com/group/latestoffcampushttps://groups.google.com/group/latestoffcampushttps://www.facebook.com/LatestOffCampushttps://www.facebook.com/LatestOffCampushttps://www.facebook.com/LatestOffCampushttps://groups.google.com/group/latestoffcampushttp://www.latestoffcampus.com/https://www.facebook.com/LatestOffCampushttps://groups.google.com/group/latestoffcampushttp://www.latestoffcampus.com/ -
7/29/2019 Lehman Brothers Sample programming Placement Paper Level1
14/20
Visitwww.latestoffcampus.com for placement papers, interview tips & job updates. Toget
freeupdates tomailhttps://groups.google.com/group/latestoffcampusLive updates on Facebook @
https://www.facebook.com/LatestOffCampus
Visitwww.latestoffcampus.com for placement papers, interview tips & job updates. Toget
freeupdates tomailhttps://groups.google.com/group/latestoffcampusLive updates on Facebook @
https://www.facebook.com/LatestOffCampus
case color.blue:
Console.WriteLine(color.blue);
break;
}
}
}
}
A red B blue C 0 D 1
22.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];
23.What do the following declaration signify?
char **argv;
A argv is a
pointer topointer.
B argv is a
pointer toa char
pointer.
C argv is a function
pointer.
D argv is a
member offunction
pointer.
24.What will be the output of the program?
#include
int main()
{int y=128;
const int x=y;
printf("%d\n", x);
return 0;
http://www.latestoffcampus.com/http://www.latestoffcampus.com/http://www.latestoffcampus.com/https://groups.google.com/group/latestoffcampushttps://groups.google.com/group/latestoffcampushttps://www.facebook.com/LatestOffCampushttps://www.facebook.com/LatestOffCampushttp://www.latestoffcampus.com/http://www.latestoffcampus.com/http://www.latestoffcampus.com/https://groups.google.com/group/latestoffcampushttps://groups.google.com/group/latestoffcampushttps://www.facebook.com/LatestOffCampushttps://www.facebook.com/LatestOffCampushttps://www.facebook.com/LatestOffCampushttps://groups.google.com/group/latestoffcampushttp://www.latestoffcampus.com/https://www.facebook.com/LatestOffCampushttps://groups.google.com/group/latestoffcampushttp://www.latestoffcampus.com/ -
7/29/2019 Lehman Brothers Sample programming Placement Paper Level1
15/20
Visitwww.latestoffcampus.com for placement papers, interview tips & job updates. Toget
freeupdates tomailhttps://groups.google.com/group/latestoffcampusLive updates on Facebook @
https://www.facebook.com/LatestOffCampus
Visitwww.latestoffcampus.com for placement papers, interview tips & job updates. Toget
freeupdates tomailhttps://groups.google.com/group/latestoffcampusLive updates on Facebook @
https://www.facebook.com/LatestOffCampus
}
A 128 B Garbagevalue C Error D 0
25.What will be the output of the program?
#include
int main()
{
const int x=5;const int *ptrx;
ptrx = &x;
*ptrx = 10;
printf("%d\n", x);
return 0;
}
A 5 B 10 C Error D Garbage
value
26.What will be the output of the program?
#include
int main()
{
const char *s = "";char str[] = "Hello";
s = str;
while(*s)
printf("%c", *s++);
http://www.latestoffcampus.com/http://www.latestoffcampus.com/http://www.latestoffcampus.com/https://groups.google.com/group/latestoffcampushttps://groups.google.com/group/latestoffcampushttps://www.facebook.com/LatestOffCampushttps://www.facebook.com/LatestOffCampushttp://www.latestoffcampus.com/http://www.latestoffcampus.com/http://www.latestoffcampus.com/https://groups.google.com/group/latestoffcampushttps://groups.google.com/group/latestoffcampushttps://www.facebook.com/LatestOffCampushttps://www.facebook.com/LatestOffCampushttps://www.facebook.com/LatestOffCampushttps://groups.google.com/group/latestoffcampushttp://www.latestoffcampus.com/https://www.facebook.com/LatestOffCampushttps://groups.google.com/group/latestoffcampushttp://www.latestoffcampus.com/ -
7/29/2019 Lehman Brothers Sample programming Placement Paper Level1
16/20
Visitwww.latestoffcampus.com for placement papers, interview tips & job updates. Toget
freeupdates tomailhttps://groups.google.com/group/latestoffcampusLive updates on Facebook @
https://www.facebook.com/LatestOffCampus
Visitwww.latestoffcampus.com for placement papers, interview tips & job updates. Toget
freeupdates tomailhttps://groups.google.com/group/latestoffcampusLive updates on Facebook @
https://www.facebook.com/LatestOffCampus
return 0;
}
A Error B H C Hello D Hel
27.What will be the output of the program?
#include
int get();
int main(){
const int x = get();
printf("%d", x);
return 0;
}
int get()
{
return 20;}
A Garbage
value
B Error C 20 D 0
28.What will be the output of the program?
#include
int main()
{
const int i=0;
printf("%d\n", i++);
http://www.latestoffcampus.com/http://www.latestoffcampus.com/http://www.latestoffcampus.com/https://groups.google.com/group/latestoffcampushttps://groups.google.com/group/latestoffcampushttps://www.facebook.com/LatestOffCampushttps://www.facebook.com/LatestOffCampushttp://www.latestoffcampus.com/http://www.latestoffcampus.com/http://www.latestoffcampus.com/https://groups.google.com/group/latestoffcampushttps://groups.google.com/group/latestoffcampushttps://www.facebook.com/LatestOffCampushttps://www.facebook.com/LatestOffCampushttps://www.facebook.com/LatestOffCampushttps://groups.google.com/group/latestoffcampushttp://www.latestoffcampus.com/https://www.facebook.com/LatestOffCampushttps://groups.google.com/group/latestoffcampushttp://www.latestoffcampus.com/ -
7/29/2019 Lehman Brothers Sample programming Placement Paper Level1
17/20
Visitwww.latestoffcampus.com for placement papers, interview tips & job updates. Toget
freeupdates tomailhttps://groups.google.com/group/latestoffcampusLive updates on Facebook @
https://www.facebook.com/LatestOffCampus
Visitwww.latestoffcampus.com for placement papers, interview tips & job updates. Toget
freeupdates tomailhttps://groups.google.com/group/latestoffcampusLive updates on Facebook @
https://www.facebook.com/LatestOffCampus
return 0;
}
A 10 B 11 C No output D Error:++needs a
value
29.What will be the output of the program?
#include
int main()
{const c = -11;
const int d = 34;
printf("%d, %d\n", c, d);
return 0;
}
A Error B -11, 34 C 11, 34 D None of
these
30.How will you print \n on the screen?
A printf("\n"); B echo
"\\n";
C printf('\n'); D
printf("\\n");
31.If the binary eauivalent of 5.375 in normalised form is 0100 0000
1010 1100 0000 0000 0000 0000, what will be the output of the
program (on intel machine)?
#include
#include
int main()
{
http://www.latestoffcampus.com/http://www.latestoffcampus.com/http://www.latestoffcampus.com/https://groups.google.com/group/latestoffcampushttps://groups.google.com/group/latestoffcampushttps://www.facebook.com/LatestOffCampushttps://www.facebook.com/LatestOffCampushttp://www.latestoffcampus.com/http://www.latestoffcampus.com/http://www.latestoffcampus.com/https://groups.google.com/group/latestoffcampushttps://groups.google.com/group/latestoffcampushttps://www.facebook.com/LatestOffCampushttps://www.facebook.com/LatestOffCampushttps://www.facebook.com/LatestOffCampushttps://groups.google.com/group/latestoffcampushttp://www.latestoffcampus.com/https://www.facebook.com/LatestOffCampushttps://groups.google.com/group/latestoffcampushttp://www.latestoffcampus.com/ -
7/29/2019 Lehman Brothers Sample programming Placement Paper Level1
18/20
Visitwww.latestoffcampus.com for placement papers, interview tips & job updates. Toget
freeupdates tomailhttps://groups.google.com/group/latestoffcampusLive updates on Facebook @
https://www.facebook.com/LatestOffCampus
Visitwww.latestoffcampus.com for placement papers, interview tips & job updates. Toget
freeupdates tomailhttps://groups.google.com/group/latestoffcampusLive updates on Facebook @
https://www.facebook.com/LatestOffCampus
float a=5.375;
char *p;
int i;
p = (char*)&a;
for(i=0; i
-
7/29/2019 Lehman Brothers Sample programming Placement Paper Level1
19/20
Visitwww.latestoffcampus.com for placement papers, interview tips & job updates. Toget
freeupdates tomailhttps://groups.google.com/group/latestoffcampusLive updates on Facebook @
https://www.facebook.com/LatestOffCampus
Visitwww.latestoffcampus.com for placement papers, interview tips & job updates. Toget
freeupdates tomailhttps://groups.google.com/group/latestoffcampusLive updates on Facebook @
https://www.facebook.com/LatestOffCampus
return 0;
}
A memfree(intp); Bdealloc(p); C malloc(p, 0); D free(p);
35.How many times "IndiaBIX" is get printed?
#include
int main()
{
int x;
for(x=-1; x
-
7/29/2019 Lehman Brothers Sample programming Placement Paper Level1
20/20
Visitwww.latestoffcampus.com for placement papers, interview tips & job updates. Toget
freeupdates tomailhttps://groups.google.com/group/latestoffcampusLive updates on Facebook @
https://www.facebook.com/LatestOffCampus
Visitwww.latestoffcampus.com for placement papers, interview tips & job updates. Toget
freeupdates tomailhttps://groups.google.com/group/latestoffcampusLive updates on Facebook @
https://www.facebook.com/LatestOffCampus
{
printf("%c %d\n", j, j);
j++;
}
return 0;
}
A Infinite times B 255
times
C 256 times D 254 times
http://www.latestoffcampus.com/http://www.latestoffcampus.com/http://www.latestoffcampus.com/https://groups.google.com/group/latestoffcampushttps://groups.google.com/group/latestoffcampushttps://www.facebook.com/LatestOffCampushttps://www.facebook.com/LatestOffCampushttp://www.latestoffcampus.com/http://www.latestoffcampus.com/http://www.latestoffcampus.com/https://groups.google.com/group/latestoffcampushttps://groups.google.com/group/latestoffcampushttps://www.facebook.com/LatestOffCampushttps://www.facebook.com/LatestOffCampushttps://www.facebook.com/LatestOffCampushttps://groups.google.com/group/latestoffcampushttp://www.latestoffcampus.com/https://www.facebook.com/LatestOffCampushttps://groups.google.com/group/latestoffcampushttp://www.latestoffcampus.com/