7/29/2019 GlobalLogic 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:GlobalLogic Sample Programming Placement Paper Level1
(Bolded option is your answer)
1.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];
2.Declare the following statement?
"A pointer to a function which receives nothing and returns nothing".
A void
*(ptr)*int;
B void *(*ptr)() C void *(*ptr)(*) D void (*ptr)()
3.What will be the output of the program?
#include
int main()
{
int y=128;
const int x=y;printf("%d\n", x);
return 0;
}
A 128 B Garbage value C Error D 0
4.What will be the output of the program?
#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 GlobalLogic 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
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
5.What will be the output of the program?
#include
int main()
{
const char *s = "";
char str[] = "Hello";
s = str;
while(*s)printf("%c", *s++);
return 0;
}
A Error B H C Hello D Hel
6.What will be the output of the program?
#include
int get();
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 GlobalLogic 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
int main()
{
const int x = get();
printf("%d", x);
return 0;
}
int get()
{
return 20;
}
A 20 B Garbage value C Error D 0
7.What will be the output of the program?
#include
#include
void fun(char *msg, ...);
int main(){
fun("IndiaBIX", 1, 4, 7, 11, 0);
return 0;
}
void fun(char *msg, ...)
{
va_list ptr;
int num;va_start(ptr, msg);
num = va_arg(ptr, int);
num = va_arg(ptr, int);
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 GlobalLogic 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
printf("%d", num);
}
A IndiaBIX 1 711 0 B 1 C 4 D 7
8.What will be the output of the program?
#include
#include
void dumplist(int, ...);
int main(){
dumplist(2, 4, 8);
dumplist(3, 6, 9, 7);
return 0;
}
void dumplist(int n, ...)
{
va_list p; int i;
va_start(p, n);
while(n-->0)
{
i = va_arg(p, int);
printf("%d", i);
}
va_end(p);
printf("\n");
}
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 GlobalLogic 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
A 2 4
3 6
B 2 4 8
3, 6, 9, 7
C 4 8
6 9 7
D 1 1 1
1 1 1 1
9.What will be the output of the program?
#include
#include
void fun1(int num, ...);
void fun2(int num, ...);
int main()
{fun1(1, "Apple", "Boys", "Cats", "Dogs");
fun2(2, 12, 13, 14);
return 0;
}
void fun1(int num, ...)
{
char *str;
va_list ptr;va_start(ptr, num);
str = va_arg(ptr, char *);
printf("%s ", str);
}
void fun2(int num, ...)
{
va_list ptr;
va_start(ptr, num);num = va_arg(ptr, int);
printf("%d", num);
}
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 GlobalLogic 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
A Dogs 12 B Cats 14 C Boys 13 D Apple 12
10.In the following code, the P2 is Integer Pointer or Integer?typedef int *ptr;
ptr p1, p2;
A Integer B Integer
pointer
C Error in
declaration
D None of above
11.What will be the output of the C#.NET code snippet given below?
byte b1 = 0xF7;byte b2 = 0xAB;
byte temp;
temp = (byte)(b1 & b2);
Console.Write (temp + " ");
temp = (byte)(b1^b2);
Console.WriteLine(temp);
A 163 92 B 92 163 C 192 63 D 0 1
12.Which of the following statements is correct about the C#.NET code
snippet given below?
int d;
d = Convert.ToInt32( !(30 < 20) );
A A value 0 will
be assigned to
d.
B A value 1 will
be assigned to
d.
C A value -1 will
be assigned to
d.
D The code
reports an error.
13.What will be the output of the C#.NET code snippet given below?
int num = 1, z = 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 GlobalLogic 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
if (!(num 2);
Console.WriteLine(temp);
A 102 1 38 B 108 0 32 C 102 0 38 D 1 0 1
15.What will be the output of the C#.NET code snippet given below?
int i, j = 1, k;
for (i = 0; i < 5; i++)
{
k = j++ + ++j;
Console.Write(k + " ");
}
A 8 4 16 12 20 B 4 8 12 16 20 C 4 8 16 32 64 D 2 4 6 8 10
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 GlobalLogic 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
16.What will be the output of the C#.NET code snippet given below?
int a = 10, b = 20, c = 30;
int res = a < b ? a < c ? c : a : b;
Console.WriteLine(res);
A 10 B 20 C 30 D Error
17.What will be the output of the C#.NET code snippet given below?
namespace IndiabixConsoleApplication
{class Sample
{
static Sample()
{
Console.Write("Sample class ");
}
public static void Bix1()
{Console.Write("Bix1 method ");
}
}
class MyProgram
{
static void Main(string[ ] args)
{
Sample.Bix1();}
}
}
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 GlobalLogic 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
A Sample class
Bix1 method
B Bix1 method C Sample class D Bix1 method
Sample class
18.Which of the following will be the correct output for the C#.NETcode snippet given below?
String s1 = "ALL MEN ARE CREATED EQUAL";
String s2;
s2 = s1.Substring(12, 3);
Console.WriteLine(s2);
A ARE B CRE C CR D REA
19.Which of the following will be the correct output for the C#.NET
code snippet given below?
String s1 = "Nagpur";
String s2;
s2 = s1.Insert(6, "Mumbai");
Console.WriteLine(s2);
A
NagpurMumbai
B Mumbai C Nagpur D
NagpuMumbair
20.If s1 and s2 are references to two strings, then which of the
following is the correct way to compare the two references?
A s1 is s2 B s1.Equals(s2) C s1 = s2 D s1 == s2
21.void start() {
A a = new A();B b = new B();
a.s(b);
b = null; /* Line 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 GlobalLogic 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
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.
22.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];
}
}
Where will be the most chance of the garbage collector being invoked?
A After line 9 B After line 10 C After line 11 D Garbage
collector neverinvoked in
methodA()
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 GlobalLogic 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
23.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 after line 14 C after line 7,
when doBar()
completes
D after line 15,
when main()
completes
24.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();
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 GlobalLogic 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 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
25.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
26.class X2
{
public X2 x;
public static void main(String [] args)
{
X2 x2 = new X2(); /* Line 6 */
X2 x3 = new X2(); /* Line 7 */
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 GlobalLogic 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
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 2 B 1 C 0 D 3
27.What will be the output of the program?
class PassA
{
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)
{
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 GlobalLogic 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
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
28.What will be the output of the program?
class Test
{
public static void main(String [] args){
Test p = new Test();
p.start();
}
void start()
{
boolean b1 = false;boolean b2 = fix(b1);
System.out.println(b1 + " " + b2);
}
boolean fix(boolean b1)
{
b1 = true;
return b1;}
}
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 GlobalLogic 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 false true B true true C true false D false false
29.What will be the output of the program?
class PassS
{
public static void main(String [] args)
{
PassS p = new PassS();
p.start();
}
void start()
{
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 slipstreamstream
C stream slipstream
D slipstreamslip stream
30.What will be the output of the program?
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 GlobalLogic 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
class Equals
{
public static void main(String [] args)
{
int x = 100;
double y = 100.1;
boolean b = (x = y); /* Line 7 */
System.out.println(b);
}
}
A true B false C Compilationfails D An exceptionis thrown at
runtime
31.What will be the output of the program?
class Test
{
public static void main(String [] args)
{int x=20;
String sup = (x < 15) ? "small" : (x < 22)? "tiny" : "huge";
System.out.println(sup);
}
}
A small B tiny C huge D Compilation
fails
32.What will be the output of the program?
class 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 GlobalLogic 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
public static void main(String [] args)
{
int x= 0;
int y= 0;
for (int z = 0; z < 5; z++)
{
if (( ++x > 2 ) && (++y > 2))
{
x++;
}
}System.out.println(x + " " + y);
}
}
A 5 2 B 5 3 C 6 3 D 6 4
33.What will be the output of the program?
class Test{
public static void main(String [] args)
{
int x= 0;
int y= 0;
for (int z = 0; z < 5; z++)
{
if (( ++x > 2 ) || (++y > 2)){
x++;
}
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 GlobalLogic 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
}
System.out.println(x + " " + y);
}
}
A 5 3 B 8 2 C 8 3 D 8 5
34.What will be the output of the program?
class Bitwise
{
public static void main(String [] args){
int x = 11 & 9;
int y = x ^ 3;
System.out.println( y | 12 );
}
}
A 0 B 7 C 8 D 14
35.What will be the output of the program?
class SSBool
{
public static void main(String [] args)
{
boolean b1 = true;
boolean b2 = false;
boolean b3 = true;
if ( b1 & b2 | b2 & b3 | b2 ) /* Line 8 */
System.out.print("ok ");
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 GlobalLogic 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
if ( b1 & b2 | b2 & b3 | b2 | b1 ) /*Line 10*/
System.out.println("dokey");
}
}
A ok B dokey C ok dokey D No output is
produced
36.What will be the output of the program?
class SC2
{
public static void main(String [] args){
SC2 s = new SC2();
s.start();
}
void start()
{
int a = 3;int b = 4;
System.out.print(" " + 7 + 2 + " ");
System.out.print(a + b);
System.out.print(" " + a + b + " ");
System.out.print(foo() + a + b + " ");
System.out.println(a + b + foo());
}
String foo()
{
return "foo";
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 GlobalLogic 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
}
}
A 9 7 7 foo 77foo B 72 34 34foo34 34foo C 9 7 7 foo3434foo D 72 7 34 foo347foo
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/Recommended