Beruflich Dokumente
Kultur Dokumente
}
class multithreaded_programing
{
public static void main(String args[])
{
newthread obj1 = new newthread("one");
newthread obj2 = new newthread("two");
try
{
obj1.t.wait();
System.out.print(obj1.t.isAlive());
}
catch(Exception e)
{
System.out.print("Main thread interrupted");
}
}
}
A. True B. false C. Main thread interrupted D. NONE
3. What will be the output of the following Java program?
}
class multithreaded_programing
{
public static void main(String args[])
{
newthread obj1 = new newthread("one");
newthread obj2 = new newthread("two");
try
{
System.out.print(obj1.t.equals(obj2.t));
}
catch(Exception e)
{
System.out.print("Main thread interrupted");
}
}
}
import java.io.*;
class filesinputoutput
{
public static void main(String args[])
{
InputStream obj = new FileInputStream("inputoutput.java");
System.out.print(obj.available());
}
}
import java.io.*;
public class filesinputoutput
{
public static void main(String[] args)
{
String obj = "abc";
byte b[] = obj.getBytes();
ByteArrayInputStream obj1 = new ByteArrayInputStream(b);
for (int i = 0; i < 2; ++ i)
{
int c;
while((c = obj1.read()) != -1)
{
if(i == 0)
{
System.out.print(Character.toUpperCase((char)c));
obj2.write(1);
}
}
System.out.print(obj2);
}
}
}
A. AaBaCa B. ABCaaa C. AaaBaaCaa D. AaBaaCaaa
7. What will be the output of the following Java program?
import java.util.*;
public class genericstack <E>
{
Stack <E> stk = new Stack <E>();
public void push(E obj)
{
stk.push(obj);
}
public E pop()
{
E obj = stk.pop();
return obj;
}
}
class Output
{
public static void main(String args[])
{
genericstack <Integer> gs = new genericstack<Integer>();
gs.push(36);
System.out.println(gs.pop());
}
}A. Runtime Error B. Compilation Error
8. What will be the output of the following Java code?
import java.util.*;
class properties
{
public static void main(String args[])
{
Properties obj = new Properties();
obj.put("AB", new Integer(3));
obj.put("BC", new Integer(2));
obj.put("CD", new Integer(8));
System.out.print(obj.keySet());
}
}
enum Enums
{
A, B, C;
private Enums()
{
System.out.println(10);
}
}
16. Select how you would start the program to cause it to print: Arg is 2
switch (z)
{
case 4: System.out.println("4 ");
case 5: System.out.println("5 ");
default: assert z < 10;
}
if ( z < 10 )
assert z > 4: z++; /* Line 22 */
System.out.println(z);
}
}
A. Line 11 B. Line 12 C. Line 14 D. Line 22
20. Find the Missing statement in the bellow code
Public class foo
{
Public static void main(String[] args)throw Exception
{
Java.io.PrintWriter out = new java.io.PrintWriter();
New java.io.Output.StreamWriter(System.out,true);
Out.println(“Hello”);
}
}
What line of code should replace the missing statement to make this program
compile?
A. import java.io.*; B. include java.io.*;
C. import java.io.PrintWriter; D. No statement required
21. The ……………………… class provides the capacity to read primitive data types from an input
stream.
A. pushbackInputStream B. DataInputStream
C. BufferedInputStream D. PipeInputStream
22. Which of the following is/are the methods of the DataOutputStream class.
i) void writeChar(intV) ii) void writeLong(longV)
iii) void writeInt(intV) iv) int size( )
System.out.println("\n");
}
}
A. 11 10 22 5 12 2 B. 2 12 5 22 10 11
C. 2 5 10 11 12 22 D. 22 12 11 10 5 2
24. What is the output of following Java Program?
import java.util.ArrayList;
class Demo {
public void show()
{
ArrayList<Integer> list = new ArrayList<Integer>();
list.add(4);
list.add(7);
list.add(1);
for (int number : list) {
System.out.print(number + " ");
}
}
} public class Main {
public static void main(String[] args)
{
Demo demo = new Demo();
demo.show();
}
}
A. Compilation Error B. 4 7 1
C. 1 4 7 D. None
25. What is the Output of following Java Program?
import java.util.LinkedList;
class Demo {
public void show()
{
LinkedList<String> list = new LinkedList<String>();
System.out.println(list.getClass());
}
} public class Main {
public static void main(String[] args)
{
Demo demo = new Demo();
demo.show();
}
}
Theory
SQL
1. Write a SQL query to fetch employee names who are under project id p1
2. Write a query to fetch employee names and projectId records. Return employee details even if
the
3. Write a SQL query to fetch all the Employee name and his/her manager name
4. Write a SQL query to fetch all employee records from EmployeeDetails table who have a project id
5. Write SQL query to read nth record to (n + 15)th record from table.
Table - EmployeeDetails
EmpId FullName ManagerId DateOfJoining
121 John Snow 321 01/31/2014
321 Walter White 986 01/30/2015
421 Kuldeep Rana 876 27/11/2016
Table - EmployeeSalary
EmpId Project Salary
121 P1 8000
321 P2 1000
421 P1 12000