0% found this document useful (0 votes)
14 views56 pages

Sec Website

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views56 pages

Sec Website

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 56

ANS: 1-5

ANS: 543214321321211
ANS: public List<Integer> foo (set<CharSequenece>m){…}
Public List<Integer>foo(TreeSet<String>m){…}

ANS: 4
ANS: 08

ANS: NumberFormat formatter =


NumberFormat.getCurrencyInstance(locate);
ANS: short sh = (short) ‘a’; , float x=1f , int x=12_34;

ANS: privilage escalation attack against the OS running the


Customer code.
ANS: Joe-
null

ANS: [A,B,C]
[A,B,C]
ANS: module PrintServiceProvider {
Requires PrintServiceAPI;
Provides org.printservice.spi.Print with
Com.provier.printservice.spi;
}
ANS: The compilation fails.

ANS: to process the current item and return a stream.

ANS: abcd
ANS: Double d= list.get(0);

ANS: @Meal(mainCourse= “Pizza”)


@Meal(mainCourse= “salad”)
Pubic class Main{
}
@Meal(mainCourse= “pizza”, starter= “snack”, dessert=
“pudding”) public class main{ }

ANS: System.out.println(Season.SPRING);
System.out,println(Season.valueOf(“SPRING”));
System.out.println(sA[1]);
ANS: setGCount(g);
aCount=a;

ANS: Resource Bundle msg =


ResourceBundle.getBundle("messages", Locale. JAPAN); D
String names = "Joe", "Jane");
String message =
MessageFormat.format(msg.getString("message"), names);
ANS: Test.class -> java.sql-
Java.sql->java.base

ANS: module com.company.sales_app {


requires commons.beanutils;
requires org.apache.commons.collections4;
requires org.apache.commons.lang3;
requires org.apache.commons.text;
}

ANS: BiPredicate<Integer,Integer> test = (var x,final var y)->


(x.equals(y));
BiPredicate<Integer,Integer>test=(Integer x, final integer y) ->
(x.equals(y));
ANS: Green

ANS: left and right must be private.


ANS: reader.read(characters);

ANS: e f j B
ANS: new Comparator<String>() {
public int compareTo(String str1, String str2) {
return str1.compareTo(str2);
};

ANS: It never finishes.


ANS:Cylinder requires an implementaion of
calculateSurfaceArea with two parameters.

ANS: .map(testName::compareTolgnoreCase) .filter(Memb


er::getYearsMembership()>=testMembershipLength)
ANS: System.out.print(p2.relativize(p3));
System.out.print(p1.relativize(p3));

ANS: studentNo and classes.


ANS: -----
-----
Banana orange apple lemon apple banana lemon
orange

ANS: Hello world!


Bonjour le mondel!

ANS: This may not print the same result each time the
program runs.

ANS: The compilation fails.


ANS: The compilation fails.

ANS: replace line 3 with


Synchronized (test) {
Test.count++;
}
Replace line 1 with private Atomicinteger count=new
Atomicinteger(0); and replace line 3 with
test.count.incrementAndGet();

ANS: change Line 2 to public Double sum (C collection) {

ANS: the compilation fails due to an error in line 3.


ANS: foo(n-> Integer.toHexString(n))
Foo(integeer::toHerString)

ANS: @interface Author{


Stringname() default””;
String date();
}

ANS: The program prints Process() called 2.

ANS: Myinterface1
Myinterface3
ANS: Good night, Potter.

ANS: 357
ANS: line n4

ANS: A java.lang.UnsupportedOperationException is thrown.


ANS: 9001: APPLICATION ERROR -9001-MyFile.txt.

ANS: @FunctionalInterface
interface InterfaceD {
int breed(int x);
}
interface InterfaceB {
int GERM = 13;
public default int getGERM() { return get(); }
private int get() { return GERM; }
public boolean equals(Object o);
int breed(int x);
}

ANS: private java.util.ServiceLoader loader =


ServiceLoader.load(print.class)
ANS: The compilation fails.

ANS: The code does not compile susccessfully.


ANS: 42

ANS: Consumer function = (String f)->(System.out.print(f);};


ANS: A java.util.NoSuchElementExeption is thrown at run
time.

ANS: @interface JsonField {


String name();
enum Type {
INT, STRING, BOOLEAN
};
Type type();
}

ANS: The compilation fails.


ANS: D inherits a() from B and C but the return types are
incompatible.

ANS: You reject the change because -noverify is a critical


security risk.

ANS: Replace Line 3 public void addProcess(T w) {


ANS: Object value 25

ANS: The code may produce a different result.


ANS: nothing

ANS: f1.foo(li) prints Bonjour le mondel


F2 foo(li) prints Hello world!
B1.foo(li) prints Hola Mundol
ANS: The compilation fails at line 13.

ANS: static String getFirstLetter() { return A.toString();}


ANS: 15

ANS: @Resource(“Customer1”)
ANS: A cannot be final.
B cannot be final.
B is a Subtype of A.

ANS: 1 2 [1,2,3,four] 3 4
ANS: UnaryOperator u =(var i) -> (i*2);

ANS: c
C++
JAVA-
GO-
KOTLIN

ANS: A ConcurrentModificationException is thrown at run


time.

ANS: public static final String ALPHA = “alpha”;


ANS: public String methodD();
Public abstract void methodB();

ANS: hey oh hi yo ey
ANS:java.base

ANS: Double b= Double.valueOf(i);


Double d=i;
ANS: ab action

ANS: Make foo and setB synchronized.


ANS: module com.company.clients{
Exports com.company.clients;
}

ANS: a module must be declared in module-info.java file,


Java.base exports all of the java platforms core
packages.

ANS: DriverManager.getConnection(“jdbc:derby:com”)

ANS: The compilation fails due to an error in line 9


The compilation fails due to an error in line 6
ANS: Map<Optional<String>, List<Employee>> r4 =
roster.stream()
.collect (Collectors.groupingBy(f, Collectors.filtering(p,
Collectors.toList())));

ANS:Sphynx
Oxical
Laperm
Koral
Bengal
abyssinian

ANS: 1.99,2.99,0.0
ANS: The memory allocated for john object can be reused in
line 1.

ANS: The method Y .print(Object..) cannot override the final


method X.print (Object..).
ANS: the loop starting line 11

ANS:
System.out.println(IntStream.rangeClosed(1,100).count());
System.out.println(IntStream.rangeClosed(0,100).map(x-
>x).count());
ANS: 80

ANS:var names =new ArrayList<>();


Var var = “hello”;
ANS: Change Line 2 to an abstract method:
public abstract void checkValue(Object value)
throws IllegalArgumentException;

Change Line 1 to an abstract class:


public abstract class API {
ANS: public void x() {}
Public void z() {}

ANS: public class MainClass implements AdaptorFirst {


public void showFirst() {
System.out.println("first");
}
}
public abstract class MainClass implements AdaptorFirst
public abstract void showFirst();
}
public abstract class MainClass implements AdaptorFirst
public void showFirst() {
System.out.println("first");
}
}

ANS: set(map.values());
Super.set(map.values());
ANS: The program prints nothing.

ANS: Replace line 12 with public static void printValue


(Funtion f, int num) {
Replace line 12 with public static void printvalue(Funtion
f,Integer num) {
ANS: Add catch (L e)

ANS: Main.prefix + Main.getName()


New Main().prefix+new Main().name
ANS: [Lettuce,kale]
[Seabass,Salmon]

ANS: Remove the parameter from wheels method in line 3.


ANS: java.desktop

106) javac jlink


107) s.replace(s.indexOf(“B”),s.indexOf(“C”), “Q”)
108) return the value of tCount.
retrive thhe sum of all fields not a single value for some
field
109) interface -> variable final static
110)
111)

You might also like