Easy Tutorial
For Competitive Exams
Placement Papers Oracle Page: 2
13853.Oracle Technical TestWhat will be the output of the following program on GCC compiler?

#include

int main() {

char str[]=`MalayalaM`;

char $\times$ s;

s= str + 8;

while(s>=str){

printf("%c", $\times$ s);

s--;

}

return 0;

}

M
MalayalaM
MM
Garbage Value
Explanation:

The address of the 8th character from the base address of the string` is stored in the character pointer `s`.Here, `s` is pointing to the 8th value in the `str` i.e. `M`.

In the start of the loop, since the address at `s` is greater than the address at `str`, the condition evaluates to true. Then printf() prints the value at address at s` i.e. `M` and the value of `s` is decremented which will now point to the 7th value in the `str` i.e. `a`.

In the same way loop is executed and the characters `str` are printed in reverse order. When the address at `s` becomes less than the address at `str`, the loop is terminated. Hence, we get the output "MalayalaM".

13854.Which of the statements is correct about the following program on GCC compiler?

int main() {

char a[]="Add";

int * j;

j = &a;

printf("%c\n", * j+2);

return 0;

}

It prints character equivalent of 67. i.e. `C`.
It prints character the third character of the string `a`
It will print 3.
It will print a garbage value.
Explanation:

Here, base address of array `a` is assigned to the integer pointer `j`. ` * j` denotes value at the base address of `j` i.e. the first character of string `a` i.e. `A`.

Since, the ASCII integer value of `A` is 65, the format specifier "%c" in the printf() function prints the ASCII character equivalent of 67(65+2) i.e. `C`.

13855.Which is true about a method-local inner class?
It must be marked final.
It can be marked abstract.
It can be marked public.
It can be marked static.
Explanation:

Option B is correct because a method-local inner class can be abstract, although it means a subclass of the inner class must be created if the abstract class is to be used (so an abstract method-local inner class is probably not useful).

Option A is incorrect because a method-local inner class does not have to be declared final (although it is legal to do so).

Options C and D are incorrect because a method-local inner class cannot be made public (remember-you cannot mark any local variables as public), or static.

13856.What will be the output of the program?

public class Switch2 {

final static short x = 2;

public static int y = 0;

public static void main(String [] args) {

for (int z=0; z < 4; z++) {

switch (z) {

case x:

System.out.print("0 ");

default:

System.out.print("def ");

case x-1:

System.out.print("1 ");

break;

case x-2:

System.out.print("2 ");

}}}}
0 def 1
2 1 0 def 1
2 1 0 def def
2 1 0 def 1 def 1
Explanation:

When z == 0, case x-2 is matched.

When z == 1, case x-1 is matched and then the break occurs.

When z == 2, case x, then default, then x-1 are all matched.

When z == 3, default, then x-1 are matched.

The rules for default are that it will fall through from above like any other case (for instance when z == 2), and that it will match when no other cases match (for instance when z==3).

13857.What will be the output of the program?

class Base {

Base() {

System.out.print("Base");

}

}

public class Alpha extends Base {

public static void main(String[] args) {

new Alpha(); / * Line 12 * /

new Base(); / *Line 13 * /

}

}

Base
BaseBase
Compilation fails
The code runs with no output
Explanation:

Option B is correct. It would be correct if the code had compiled, and the subclass Alpha had been saved in its own file. In this case Java supplies an implicit call from the sub-class constructor to the no-args constructor of the super-class therefore line 12 causes Base to be output. Line 13 also causes Base to be output.

13858.Which collection class allows you to associate its elements with key values, and allows you to retrieve objects in FIFO (first-in, first-out) sequence?
java.util.ArrayList
java.util.LinkedHashMap
java.util.HashMap
java.util.TreeMap
Explanation:

LinkedHashMap is the collection class used for caching purposes. FIFO is another way to indicate caching behavior. To retrieve LinkedHashMap elements in cached order, use the values() method and iterate over the resultant collection.

13859.What will be the output of the program?

for(int i = 0; i < 3; i++) {

switch(i) {

case 0: break;

case 1: System.out.print("one ");

case 2: System.out.print("two ");

case 3: System.out.print("three ");

}

}

System.out.println("done");

one two three two three done
one two done
done
one two three two three
Explanation:

The variable i will have the values 0, 1 and 2.

When i is 0, nothing will be printed because of the break in case 0.

When i is 1, "one two three" will be output because case 1, case 2 and case 3 will be executed (they don`t have break statements).

When i is 2, "two three" will be output because case 2 and case 3 will be executed (again no break statements).

Finally, when the for loop finishes "done" will be output.

13860.What will be the output of the following program on GCC?

int main(){

static int c=5;

printf("c=%d",c--);

if(c)

main();

return 0;

}

prints `c=5` infinite times.
c=5c=4c=3c=2c=1c=0
c=5c=4c=3c=2c=1
c=4c=3c=2c=1
Explanation:

The storage class of `c` is `static` means it can`t be re-initialized. The printf() prints the value of `c`

i.e. 5 then post decrement operator decrements it to 4. The if condition is c i.e. 4. This evaluates to true and main() is called.

This time `c` is not re-initialized to 5 i.e. it is still 4 and the printf() prints the value 4.

In the same manner, value is printed till c=1 i.e. when `c` is decremented from 1 to 0, then if condition evaluates to false.

13861.What is the base class for all Exception ?
java.lang.Exception
java.lang.Throwable
java.lang.RuntimeException
java.lang.Error
13862.In SQL, which command is used to remove a stored function from the database?
REMOVE FUNCTION
DELETE FUNCTION
DROP FUNCTION
ERASE FUNCTION
42691.bus is a / an
electronic track system
part of register
special memory
part of a Cpu
42692.Form of code that uses more than one process and processor, possibly of different type, and that may on occasions have more than one process or processor active at the same time, is known as
multiprogramming
multi threading
broadcasting
time sharing
42693.Which of the following system program forgoes the production of object code to generate absolute machine code and load it into the physical main storage location from which it will be executed immediately upon completion of the assembly?
two pass assembler
load-and-go assembler
macroprocessor
compiler
42694.an instruction in a programming language that is replaced by a sequence of instructions prior to assembly or compiling is known as
procedure name
macro
label
literal
42695.Which policy replace a page if it is not in the favoured subset of a process,s pages?
FIFO
LRU
LFU
Working set
42696.There are certain packages that allow people to define data items, place these items in particular records, combine the records into designated files and then manipulate and retrieve the stored datWhat are they called?
Data storage system
Database management system (DBMS)
Batch processing system
Data communication package
42697.Subschema can be used to
create very different, personalized views of the same data
present information in different formats
hide sensitive information by omitting fields from the subschema’s description
All of the above
42698.In order to use a DBMS, it is important to understand
the physical schema
all sub-schemas that the system supports
one subschema
both (a) and (b)
42699.Large computer information system maintains many different computer files. Which amongst them is called a perpetual file?
Specialized file
Log file
Master file
Update file
42700.The Management Information system (MIS) structure with one main computer system is called a
hierarchical MIS structure
distributed MIS structure
centralized MIS structure
decentralized MIS structure
Share with Friends