Quest Eduventuures Internship Test

Reviewed by Editorial Team
The ProProfs editorial team is comprised of experienced subject matter experts. They've collectively created over 10,000 quizzes and lessons, serving over 100 million users. Our team includes in-house content moderators and subject matter experts, as well as a global network of rigorously trained contributors. All adhere to our comprehensive editorial guidelines, ensuring the delivery of high-quality content.
Learn about Our Editorial Process
| By Deepeshkankaria
D
Deepeshkankaria
Community Contributor
Quizzes Created: 1 | Total Attempts: 140
| Attempts: 140 | Questions: 58
Please wait...
Question 1 / 58
0 %
0/100
Score 0/100
1. A short sections of code written to complete a task. 

Explanation

A function is a short section of code that is written to perform a specific task. It is a reusable block of code that can be called multiple times throughout a program to execute the same set of instructions. Functions help to organize and modularize code, making it easier to read, understand, and maintain. They are typically defined with a name, a set of input parameters (optional), and a return value (optional). Thus, a function fits the description of a short section of code written to complete a task.

Submit
Please wait...
About This Quiz
Quest Eduventuures Internship Test - Quiz


This test is designed to check the analytical, logical and computer programming skills of an individual.

2. What is FIFO?

Explanation

FIFO stands for "First In First Out." It is a method of organizing and manipulating data where the first item that is inserted or added into a data structure is the first one to be removed or processed. This concept is commonly used in various fields, such as computing, inventory management, and queueing systems. It ensures that items are processed or handled in the order they arrive, maintaining the chronological order of the data.

Submit
3. One loop inside the body of another loop is called 

Explanation

When one loop is placed inside the body of another loop, it is referred to as a nested loop. The outer loop controls the number of times the inner loop will execute. This allows for more complex and intricate looping structures, where the inner loop can perform a set of actions multiple times within each iteration of the outer loop. The term "nested" is used because the loops are visually represented as being inside one another, similar to how nesting dolls fit inside each other.

Submit
4. Which of the following case does not exist in complexity theory

Explanation

The null case does not exist in complexity theory because it refers to a scenario where there is no input or no operations to be performed. In complexity theory, the focus is on analyzing the performance of algorithms in different scenarios, such as best case, worst case, and average case, where there is input and operations to be considered. The null case is not relevant in this context as it does not involve any input or operations to analyze.

Submit
5. A do while and a while loop are the same

Explanation

A do-while loop and a while loop are not the same. The main difference between them is that a while loop checks the condition before executing the loop, while a do-while loop checks the condition after executing the loop. This means that a do-while loop will always execute at least once, regardless of the condition being true or false. In contrast, a while loop may not execute at all if the condition is initially false. Therefore, the correct answer is False.

Submit
6. What dose this equation mean ? a != t

Explanation

The equation "a != t" means that variable a is not equal to variable t. It is a comparison statement indicating that the values assigned to a and t are different.

Submit
7. Entering Comments is a useless task, it will  not help in anyway.

Explanation

The given statement suggests that entering comments is a useless task and will not help in any way. The correct answer is "False" because entering comments can be helpful in various ways. Comments can provide additional information, explanations, or clarifications, making the code more understandable for other programmers. They can also serve as reminders or notes for the developer themselves, helping them remember the purpose or functionality of certain code sections. Therefore, entering comments can be a valuable practice in programming.

Submit
8. The operation of processing each element in the list is known as

Explanation

Traversal refers to the process of accessing each element in a list or data structure one by one. It involves visiting and examining each element without changing their order or structure. In this context, the operation of processing each element in the list is referred to as traversal. Sorting involves rearranging the elements in a specific order, merging combines two or more lists into a single list, and inserting involves adding an element at a specific position in the list.

Submit
9. Two main measures for the efficiency of an algorithm are

Explanation

The efficiency of an algorithm is typically measured by its time complexity and space complexity. Time complexity refers to the amount of time it takes for the algorithm to run, while space complexity refers to the amount of memory or space required by the algorithm to solve a problem. Therefore, the correct answer is "Time and space" as these two measures are commonly used to evaluate the efficiency of an algorithm.

Submit
10. The Average case occur in linear search algorithm

Explanation

The average case in linear search occurs when the item being searched for is somewhere in the middle of the array. In this case, the algorithm will need to iterate through approximately half of the array before finding the item. This is because linear search checks each element of the array one by one until it either finds the item or reaches the end of the array. Therefore, on average, the algorithm will need to iterate through half of the array to find the desired item.

Submit
11. Finding the location of the element with a given value is:

Explanation

The correct answer is "Search" because finding the location of an element with a given value involves searching through a data structure or collection to locate the desired element. Traversal refers to the process of accessing each element in a data structure, while sorting involves arranging elements in a specific order. Therefore, "Search" is the most appropriate term for finding the location of an element with a given value.

Submit
12. Which data structure uses LIFO?

Explanation

Stacks use the LIFO (Last-In-First-Out) principle, where the last element added to the stack is the first one to be removed. This means that when an element is inserted into a stack, it is placed on top of the previously inserted elements. When an element is removed from the stack, the topmost element is removed first. This behavior is similar to a stack of plates, where the last plate placed on top is the first one to be removed. Therefore, the correct answer is Stacks.

Submit
13. A memory location that holds a single letter or number.  

Explanation

A char is a data type in programming that represents a single letter or number. It is used to store characters such as letters, digits, and symbols. In memory, a char variable occupies a single memory location, making it suitable for storing a single character. The other data types mentioned in the options, such as double and int, are used to store numbers with different precision and range. The option "word" is not a valid data type in most programming languages.

Submit
14. Which of the following data structure is linear data structure?

Explanation

Arrays are a linear data structure because they store elements in a sequential manner. Each element in an array can be accessed by its index, which represents its position in the array. This allows for efficient traversal and retrieval of elements. Arrays have a fixed size and elements are stored contiguously in memory, making them suitable for tasks such as sorting and searching. Trees and graphs, on the other hand, are non-linear data structures as they allow for more complex relationships between elements.

Submit
15. I have a table contains a large number of rows (the relevant table structure is abbreviated here) for this CREATE TABLE FirstTable (ID INT, Col VARCHAR(100)) GO CREATE INDEX IX_Col ON FirstTable (Col);   I have this stored procedure CREATE PROC Test_1    @Get NVARCHAR(20) AS  SELECT ID,Col   FROM FirstTable   WHERE Col = @Get; The execution of Test_1 results in a table scan. I can NOT alter the table in any way. I have permission to alter the procedure. The question is: Can I alter the procedure to do an index seek?

Explanation

The stored procedure Test_1 can be altered to do an index seek by adding the keyword "OPTION (RECOMPILE)" at the end of the SELECT statement. This will allow the query optimizer to generate a new execution plan each time the stored procedure is executed, taking into account the current parameter value. Since the index on the Col column exists, the query optimizer will be able to use it for an index seek operation instead of a table scan.

Submit
16. Each array declaration need not give, implicitly or explicitly, the information about

Explanation

The first data from the set to be stored is not required to be specified in the array declaration. The array declaration only needs to include the name of the array and the data type of the array. The first data from the set to be stored can be assigned later when the array is initialized or when values are assigned to specific indices of the array.

Submit
17. Logically analyze the information given below and answer this question:   Who is the CEO? At a small company, parking spaces are reserved for the top executives: CEO, president, vice president, secretary, and treasurer with the spaces lined up in that order. The parking lot guard can tell at a glance if the cars are parked correctly by looking at the color of the cars. The cars are yellow, green, purple, red, and blue, and the executives names are Alice, Bert, Cheryl, David, and Enid.   * The car in the first space is red. * A blue car is parked between the red car and the green car. * The car in the last space is purple. * The secretary drives a yellow car. * Alice's car is parked next to David's. * Enid drives a green car. * Bert's car is parked between Cheryl's and Enid's. * David's car is parked in the last space.

Explanation

Based on the given information, we can deduce the following:

1. The car in the first space is red.
2. A blue car is parked between the red car and the green car.
3. The car in the last space is purple.
4. The secretary drives a yellow car.
5. Alice's car is parked next to David's.
6. Enid drives a green car.
7. Bert's car is parked between Cheryl's and Enid's.
8. David's car is parked in the last space.

From statement 7, we know that Bert's car is parked between Cheryl's and Enid's. Since David's car is parked in the last space, and Alice's car is parked next to David's (statement 5), Cheryl must be the CEO.

Submit
18. Logically analyze the information given below and answer this question:   How much rain did Mile City get? Five cities all got more rain than usual this year. The five cities are: Last Stand, Mile City, New Town, Olliopolis, and Polberg. The cities are located in five different areas of the country: the mountains, the forest, the coast, the desert, and in a valley. The rainfall amounts were: 12 inches, 27 inches, 32 inches, 44 inches, and 65 inches. * The city in the desert got the least rain; the city in the forest got the most rain. * New Town is in the mountains. * Last Stand got more rain than Olliopolis. * Mile City got more rain than Polberg, but less rain than New Town. * Olliopolis got 44 inches of rain. * The city in the mountains got 32 inches of rain; the city on the coast got 27 inches of rain.

Explanation

Based on the given information, we can deduce that Mile City got more rain than Polberg, but less rain than New Town. We also know that the city on the coast got 27 inches of rain. Therefore, the answer is 27 inches, as it is the only rainfall amount that falls within the range of possibilities for Mile City.

Submit
19. Arrays are best data structures

Explanation

Arrays are best data structures for relatively permanent collections of data because arrays have a fixed size and are suitable for storing a fixed number of elements. They provide efficient random access to elements and have a simple and straightforward implementation. However, arrays are not suitable for situations where the size of the structure and the data in the structure are constantly changing, as arrays cannot dynamically resize themselves. Therefore, the correct answer is that arrays are best for relatively permanent collections of data.

Submit
20. The complexity of linear search algorithm is

Explanation

The complexity of the linear search algorithm is O(n) because it has to iterate through each element in the list until it finds the desired element or reaches the end of the list. This means that the time it takes to complete the algorithm grows linearly with the size of the input.

Submit
21. A Syntax Error is ? 

Explanation

A Syntax Error is an error caused by language rules being broken. Syntax refers to the rules and structure of a programming language. When these rules are violated, such as using incorrect syntax or missing semicolons, the program will not be able to execute properly and will throw a syntax error. This type of error can be easily identified by the compiler or interpreter, as it is a violation of the language's syntax rules.

Submit
22. What command do you use to output data to the screen?

Explanation

The correct answer is "cout". In C++, "cout" is a standard output stream object that is used to display output on the screen. It is commonly used with the insertion operator "

Submit
23. The Worst case occur in linear search algorithm when

Explanation

In linear search, the algorithm starts searching from the beginning of the array and continues until it finds the desired item or reaches the end of the array. In the worst case scenario, the item being searched for is either the last element in the array or not present at all. If the item is the last element, the algorithm will have to iterate through the entire array before finding it. Similarly, if the item is not present in the array, the algorithm will have to search through the entire array without finding it. In both cases, the worst case time complexity is O(n), where n is the size of the array.

Submit
24. Int hold decemals numbers

Explanation

This statement is incorrect because the word "decemals" is misspelled. The correct spelling is "decimals." Therefore, the correct answer is False.

Submit
25. The complexity of Bubble sort algorithm is

Explanation

Bubble sort is a simple sorting algorithm that repeatedly steps through the list, compares adjacent elements and swaps them if they are in the wrong order. The algorithm has a time complexity of O(n2), which means that the number of operations required to sort the list is proportional to the square of the number of elements in the list. This is because in the worst case scenario, where the list is in reverse order, each element needs to be compared with every other element, resulting in n comparisons for each of the n elements. Therefore, the time complexity is O(n2).

Submit
26. What will be the output of the program?
public class X 
{ 
    public static void main(String [] args) 
    {
        try 
        {
            badMethod();  
            System.out.print("A"); 
        }  
        catch (Exception ex) 
        {
            System.out.print("B"); 
        }  
        finally 
        {
            System.out.print("C"); 
        }  
        System.out.print("D"); 
    }  
    public static void badMethod() {} 
} 

Explanation

The program will output "ACD". The main method calls the badMethod() method, which is empty and does nothing. Since there is no exception thrown in the try block, the catch block is not executed. The finally block is always executed, so "C" is printed. After the finally block, "D" is printed. Therefore, the output is "ACD".

Submit
27. Which of the following data structure is not linear data structure?

Explanation

The correct answer is "None of above". This means that both arrays and linked lists are linear data structures. Arrays store elements in contiguous memory locations, allowing for efficient random access. Linked lists, on the other hand, store elements in separate nodes that are connected through pointers, allowing for efficient insertion and deletion operations. Therefore, both arrays and linked lists are examples of linear data structures.

Submit
28. 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);     } }

Explanation

The output of the program will be "tiny". This is because the ternary operator is used to assign the value of the variable "sup". The condition (x

Submit
29. Linked lists are best suited

Explanation

Linked lists are best suited for situations where the size of the structure and the data in the structure are constantly changing. This is because linked lists allow for efficient insertion and deletion of elements at any position in the list, without the need to shift or resize the entire structure. Unlike arrays, which have a fixed size, linked lists can dynamically adjust their size to accommodate changes in the data. This makes linked lists a flexible and efficient choice for managing collections of data that are constantly being modified.

Submit
30. The complexity of merge sort algorithm is

Explanation

The complexity of merge sort algorithm is O(n log n) because it divides the input array into two halves, recursively sorts them, and then merges the two sorted halves. The time complexity of merging two sorted arrays of size n/2 each is O(n), and the time complexity of dividing the array into halves is O(log n). Hence, the overall time complexity is O(n log n).

Submit
31. The space factor when determining the efficiency of algorithm is measured by

Explanation

The space factor when determining the efficiency of an algorithm is measured by counting the maximum memory needed by the algorithm. This means that the efficiency of the algorithm is evaluated based on the maximum amount of memory it requires to execute. By considering the maximum memory usage, we can assess how well the algorithm performs in terms of space utilization. This information is crucial for optimizing the algorithm and ensuring that it can run efficiently within the available memory resources.

Submit
32. 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?

Explanation

A LinkedHashMap in Java allows you to associate its elements with key values, meaning you can store objects with specific keys. It also allows you to retrieve objects in FIFO sequence, meaning the elements are returned in the order they were added to the map. This makes it a suitable choice for scenarios where both key-value associations and maintaining insertion order are important.

Submit
33. The complexity of the average case of an algorithm is

Explanation

The complexity of the average case of an algorithm is much more complicated to analyze than that of the worst case because it requires considering a range of possible inputs and their probabilities. The worst case complexity only considers the maximum possible input size, while the average case complexity takes into account the likelihood of different input sizes and distributions. This makes the analysis of average case complexity more complex and time-consuming compared to the worst case.

Submit
34. The elements of an array are stored successively in memory cells because

Explanation

The elements of an array are stored successively in memory cells because by this way the computer can keep track only the address of the first element and the addresses of other elements can be calculated. This allows for efficient memory management and easy access to array elements by using indexing based on the address of the first element. Storing elements in a serial manner also aligns with the architecture of computer memory, making it a suitable approach for array storage.

Submit
35. Which cause a compiler error? (choose all that apply)

Explanation

The correct answers are "float[ ] f = new float(3);" and "float f2[ ] = new float[ ];".

The first line of code tries to initialize an array of floats with the size of 3 using the incorrect syntax. The correct syntax for initializing an array with a specific size is "new float[3]".

The second line of code tries to declare an array of floats without specifying the size. In Java, when declaring an array, the size must be specified. Therefore, the correct syntax for declaring an array without specifying the size would be "float[] f2;".

Submit
36.
try 
{ 
    int x = 0; 
    int y = 5 / x; 
} 
catch (Exception e) 
{
    System.out.println("Exception"); 
} 
catch (ArithmeticException ae) 
{
    System.out.println(" Arithmetic Exception"); 
} 
System.out.println("finished");
  State True or False: The output of the above code is the below Exception finished

Explanation

The output of the above code is "Arithmetic Exception" followed by "finished". This is because the code attempts to divide 5 by 0, which results in an ArithmeticException being thrown. Since the catch block for ArithmeticException comes before the catch block for Exception, it is the one that catches the exception and prints "Arithmetic Exception". After the catch blocks, the code continues to execute and prints "finished". Therefore, the correct answer is False.

Submit
37. The time factor when determining the efficiency of algorithm is measured by

Explanation

The efficiency of an algorithm is determined by counting the number of key operations it performs. Key operations refer to the fundamental steps or operations that the algorithm needs to execute in order to solve a problem. By counting these key operations, we can get an idea of the time complexity of the algorithm, which helps us understand how the algorithm will perform as the input size increases. Counting microseconds, the number of statements, or the kilobytes of the algorithm are not accurate measures of the time factor in determining efficiency.

Submit
38. Class X implements Runnable {     public static void main(String args[])     {         /* Missing code? */     }     public void run() {} } Which of the following line of code is suitable to start a thread ?

Explanation

The correct answer is "X run = new X(); Thread t = new Thread(run); t.start();". This line of code creates an instance of the class X and then creates a new thread using that instance. The thread is then started using the start() method.

Submit
39. 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 );     } }

Explanation

The program first performs a bitwise AND operation between 11 and 9, resulting in the value 9. Then, it performs a bitwise XOR operation between the result (9) and 3, resulting in the value 10. Finally, it performs a bitwise OR operation between the result (10) and 12, resulting in the value 14. Therefore, the output of the program will be 14.

Submit
40. Four usual dice are thrown on the ground. The total of numbers on the top faces of these four dice is 13 as the top faces showed 4, 3, 1 and 5 respectively. What is the total of the faces touching the ground?

Explanation

The total of the numbers on the top faces of the four dice is 13. Since each die has six faces and the sum of the numbers on opposite faces is always 7, we can determine that the total of the faces touching the ground is 15.

Submit
41. Which three guarantee that a thread will leave the running state?
  1. yield()
  2. wait()
  3. notify()
  4. notifyAll()
  5. sleep(1000)
  6. aLiveThread.join()
  7. Thread.killThread()

Explanation

not-available-via-ai

Submit
42. Public class Runner {                 public static void main(String args[])                 {                     System.out.println("This is a correct program");                     continue;                 } } State True or False: The above program prints a output

Explanation

The above program will not compile because the continue statement is used outside of a loop. The continue statement is used to skip the current iteration of a loop and move to the next iteration. Since there is no loop in the program, the continue statement is invalid and will result in a compilation error. Therefore, the program will not print any output.

Submit
43. Which of the following would compile without error?

Explanation

The code int a = Math.abs(-5); would compile without error because Math.abs() is a method in the Math class that returns the absolute value of a number. In this case, it returns the absolute value of -5, which is 5. Since the variable a is of type int, it can store the result without any issues.

Submit
44. In the following question, two statements numbered I and II are given. There may be cause and effect relationship between the two statements. These two statements may be the effect of the same cause or independent causes. These statements may be independent causes without having any relationship. Read both the statements in each question and mark your answer as:   (A) If statement I is the cause and statement II is its effect; (B) If statement II is the cause and statement I is its effect; (C) If both the statements I and II are independent causes; (D) If both the statements I and II are effects of independent causes; and (E) If both the statements I and II are effects of some common cause. Statements: I.  The Reserve Bank of India has recently put restrictions on few small banks in the country. II.  The small banks in the private and co-operative sector in India are not in a position to withstand the competitions of the bigger in the public sector.

Explanation

Statement II is the cause and statement I is its effect. The reason for the Reserve Bank of India putting restrictions on few small banks is that these banks are not able to compete with the bigger banks in the public sector. Therefore, the inability of small banks to withstand the competition is the cause, and the restriction imposed by the Reserve Bank of India is the effect.

Submit
45. The complexity of Binary search algorithm is

Explanation

not-available-via-ai

Submit
46. Which three are valid declarations of a char?
  1. char c1 = 064770;
  2. char c2 = 'face';
  3. char c3 = 0xbeef;
  4. char c4 = \u0022;
  5. char c5 = '\iface';
  6. char c6 = '\uface';

Explanation

not-available-via-ai

Submit
47. Sherlock, A detective who was mere days from cracking an international smuggling ring has suddenly gone missing. While inspecting his last-known location, you find a note: 710 57735 34 5508 51 7718 Currently there are 3 suspects: Bill, John, and Todd. Can you break the detective's code and find the criminal's name?

Explanation

The note contains a series of numbers. By looking closely, we can see that each number corresponds to the number of letters in each word of the suspects' names. The numbers 710 correspond to "Bill", which matches one of the suspects. Therefore, the criminal's name is Bill.

Submit
48. Which four options describe the correct default values for array elements of the types indicated?
  1. int -> 0
  2. String -> "null"
  3. Dog -> null
  4. char -> '\u0000'
  5. float -> 0.0f
  6. boolean -> true

Explanation

The correct default values for array elements of the given types are as follows:

1. For int, the default value is 0.
3. For String, the default value is "null".
4. For Dog (a reference type), the default value is null.
5. For char, the default value is '\u0000' (null character).
Therefore, the correct options that describe the default values for array elements of the indicated types are 1, 3, 4, and 5.

Submit
49. Public void test(int x) {     int odd = 1;     if(odd) /* Line 4 */     {         System.out.println("odd");     }     else     {         System.out.println("even");     } } Which statement is true?

Explanation

The compilation fails because the if statement on line 4 requires a boolean expression inside the parentheses. However, the variable "odd" is an integer, not a boolean. To fix this, the if statement should be written as "if(odd != 0)" to check if the value of "odd" is not equal to zero.

Submit
50. 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?

Explanation

After line 8 runs, there is only 1 object eligible for garbage collection. This is because the object created in line 6 (referenced by x2) is reassigned to x4 in line 8. Therefore, the object that was originally referenced by x2 is no longer accessible and can be garbage collected. The other objects (referenced by x and x4) are still in use and cannot be garbage collected.

Submit
51. In a contest, four fruits (an apple, a banana, an orange, and a pear) have been placed in four closed boxes (one fruit per box). People may guess which fruit is in which box. 123 people participate in the contest. When the boxes are opened, it turns out that 43 people have guessed none of the fruits correctly, 39 people have guessed one fruit correctly, and 31 people have guessed two fruits correctly. How many people have guessed three fruits correctly, and how many people have guessed four fruits correctly?

Explanation

Since there are 123 participants in total, and we know that 43 people have guessed none of the fruits correctly and 39 people have guessed one fruit correctly, we can subtract these numbers from the total to find out how many people have guessed at least two fruits correctly. 123 - 43 - 39 = 41. Since 31 people have guessed two fruits correctly, we can subtract this number from the previous result to find out how many people have guessed three or four fruits correctly. 41 - 31 = 10. Therefore, 10 people have guessed three fruits correctly and the remaining 10 people have guessed all four fruits correctly.

Submit
52. The indirect change of the values of a variable in one module by another module is called

Explanation

Side effect refers to the indirect change of the values of a variable in one module by another module. It occurs when a module modifies the state of a variable that is accessible by another module, resulting in an unintended change in behavior. This can lead to unexpected consequences and can make the code harder to understand and maintain. Therefore, the term "side effect" accurately describes this situation.

Submit
53. Create table address_staging   (clientid int primary key,addressdetails varchar(250));   insert into address_staging  select 100,'hyderbad,india'  union all  select 101,'banglore,india'  union all  select 102,'banglore,india' ; create table address_oltp  (client_id int primary key,address_details varchar(250));   insert into address_oltp  select 104,'newyork,usa'  union all  select 105,'chicago,usa'  union all  select 106,'washington,usa' ; select *  from address_oltp  where client_id in (select client_id from address_staging) How many rows are returned from the last SELECT?

Explanation

The last SELECT statement will return 3 rows from the table address_oltp. This is because the WHERE clause specifies that only rows with client_id values that exist in the result of the subquery (which returns the client_id values from address_staging) should be returned. Since there are 3 client_id values in address_staging that also exist in address_oltp, the query will return those 3 rows.

Submit
54. Which of the following are Java reserved words?

Explanation

The correct answer is "null" and "default". In Java, "null" is a reserved word that represents the absence of a value, while "default" is a reserved word used in switch statements to specify the default case. "constant" and "implement" are not reserved words in Java.

Submit
55.
What is the output for the below code ?

	
public class A {
       public A() {
        System.out.println("A");
}
}

	
public class B extends A implements Serializable {
       public B() {
        System.out.println("B");
    }

	
}

	
public class Test {
       
       public static void main(String... args) throws Exception {
              B b = new B();
       
        ObjectOutputStream save = new ObjectOutputStream(new FileOutputStream("datafile"));
        save.writeObject(b); 
        save.flush(); 
        

	
        ObjectInputStream restore = new ObjectInputStream(new FileInputStream("datafile"));
        B z = (B) restore.readObject();

	
        

	
       }
       
}

Explanation

The output of the code will be "A B A".

This is because when the object b of class B is created, the constructor of class A is called first, which prints "A". Then the constructor of class B is called, which prints "B".

When the object b is serialized and then deserialized, the constructor of class A is called again, which prints "A".

Submit
56. State the below statement is not false about static nested class:  It's variables and methods must be static

Explanation

The statement is not false about static nested class. The variables and methods of a static nested class can be either static or non-static.

Submit
57. Public class Outer {     public void someOuterMethod()     {         //Line 5     }     public class Inner { }         public static void main(String[] argv)     {         Outer ot = new Outer();         //Line 10     } }
Which of the following code fragments inserted, will allow to compile?

Explanation

The code fragment "new Inner(); //At line 5" will allow the code to compile because it creates a new instance of the Inner class within the someOuterMethod() method of the Outer class. Since the Inner class is a member of the Outer class, it can be accessed and instantiated within the method.

Submit
58. /* Missing Statement ? */ public class foo {     public static void main(String[]args)throws Exception     {         java.io.PrintWriter out = new java.io.PrintWriter();         new java.io.OutputStreamWriter(System.out,true);         out.println("Hello");     } } What line of code should replace the missing statement to make this program compile?

Explanation

The missing statement is not required because the program already includes the necessary import statements for the PrintWriter class. The PrintWriter object "out" is already declared and initialized correctly, so no additional statement is needed.

Submit
View My Results

Quiz Review Timeline (Updated): May 29, 2024 +

Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.

  • Current Version
  • May 29, 2024
    Quiz Edited by
    ProProfs Editorial Team
  • May 23, 2014
    Quiz Created by
    Deepeshkankaria
Cancel
  • All
    All (58)
  • Unanswered
    Unanswered ()
  • Answered
    Answered ()
A short sections of code written to complete a task. 
What is FIFO?
One loop inside the body of another loop is called 
Which of the following case does not exist in complexity theory
A do while and a while loop are the same
What dose this equation mean ? a != t
Entering Comments is a useless task, it will  not help in anyway.
The operation of processing each element in the list is known as
Two main measures for the efficiency of an algorithm are
The Average case occur in linear search algorithm
Finding the location of the element with a given value is:
Which data structure uses LIFO?
A memory location that holds a single letter or number.  
Which of the following data structure is linear data structure?
I have a table contains a large number of rows (the relevant...
Each array declaration need not give, implicitly or explicitly, the...
Logically analyze the information given below and answer this...
Logically analyze the information given below and answer this...
Arrays are best data structures
The complexity of linear search algorithm is
A Syntax Error is ? 
What command do you use to output data to the screen?
The Worst case occur in linear search algorithm when
Int hold decemals numbers
The complexity of Bubble sort algorithm is
What will be the output of the program?...
Which of the following data structure is not linear data structure?
What will be the output of the program?...
Linked lists are best suited
The complexity of merge sort algorithm is
The space factor when determining the efficiency of algorithm is...
Which collection class allows you to associate its elements with key...
The complexity of the average case of an algorithm is
The elements of an array are stored successively in memory cells...
Which cause a compiler error? (choose all that apply)
Try ...
The time factor when determining the efficiency of algorithm is...
Class X implements Runnable...
What will be the output of the program?...
Four usual dice are thrown on the ground. The total of numbers on the...
Which three guarantee that a thread will leave the running state?...
Public class Runner...
Which of the following would compile without error?
In the following question, two statements numbered I and II are given....
The complexity of Binary search algorithm is
Which three are valid declarations of a char?...
Sherlock, A detective who was mere days from cracking an international...
Which four options describe the correct default values for array...
Public void test(int x)...
Public class X...
In a contest, four fruits (an apple, a banana, an orange, and a pear)...
The indirect change of the values of a variable in one module by...
Create table address_staging ...
Which of the following are Java reserved words?
What is the output for the below code ?...
State the below statement is not false about static nested class:...
Public class Outer...
/* Missing Statement ? */...
Alert!

Advertisement