Quest Eduventuures Internship Test

Approved & Edited by ProProfs Editorial Team
The editorial team at ProProfs Quizzes consists of a select group of subject experts, trivia writers, and quiz masters who have authored over 10,000 quizzes taken by more than 100 million users. This team includes our in-house seasoned quiz moderators and subject matter experts. Our editorial experts, spread across the world, are rigorously trained using our comprehensive guidelines to ensure that you receive the highest quality quizzes.
Learn about Our Editorial Process
| By Deepeshkankaria
D
Deepeshkankaria
Community Contributor
Quizzes Created: 1 | Total Attempts: 139
Questions: 60 | Attempts: 139

SettingsSettingsSettings
Quest Eduventuures Internship Test - Quiz


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


Questions and Answers
  • 1. 

    Why is progamming important today?

  • 2. 

    Why do you want to do internship? 

  • 3. 

    A memory location that holds a single letter or number.  

    • A.

      Double

    • B.

      Int

    • C.

      Char

    • D.

      Word

    Correct Answer
    C. Char
    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.

    Rate this question:

  • 4. 

    A do while and a while loop are the same

    • A.

      True

    • B.

      False

    Correct Answer
    B. False
    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.

    Rate this question:

  • 5. 

    A short sections of code written to complete a task. 

    • A.

      Buffer

    • B.

      Array

    • C.

      Function

    Correct Answer
    C. Function
    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.

    Rate this question:

  • 6. 

    Int hold decemals numbers

    • A.

      True

    • B.

      False

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

    Rate this question:

  • 7. 

    What is FIFO?

    • A.

      First in Few Out

    • B.

      Few In Few out

    • C.

      First In First Out

    • D.

      Few In First Out

    Correct Answer
    C. First In First Out
    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.

    Rate this question:

  • 8. 

    What dose this equation mean ? a != t

    • A.

      A is assinged t

    • B.

      A and t are equal

    • C.

      A is not equal to t

    • D.

      T is add to a

    Correct Answer
    C. A is not equal to 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.

    Rate this question:

  • 9. 

    One loop inside the body of another loop is called 

    • A.

      Loop in loop

    • B.

      Nested

    • C.

      Double loops

    Correct Answer
    B. Nested
    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.

    Rate this question:

  • 10. 

    Which data structure uses LIFO?

    • A.

      Array

    • B.

      Int

    • C.

      Stacks

    • D.

      Queues

    Correct Answer
    C. Stacks
    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.

    Rate this question:

  • 11. 

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

    • A.

      True

    • B.

      False

    Correct Answer
    B. False
    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.

    Rate this question:

  • 12. 

    A Syntax Error is ? 

    • A.

      An error you will never find

    • B.

      An error you find at the end when the program gives out a wrong value due to logic error

    • C.

      An error caused by language rules being broken.

    • D.

      An error due to user error

    Correct Answer
    C. An error caused by language rules being broken.
    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.

    Rate this question:

  • 13. 

    What command do you use to output data to the screen?

    • A.

      Cin

    • B.

      Cout>>

    • C.

      Cout

    • D.

      Output>>

    Correct Answer
    C. Cout
    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 "

    Rate this question:

  • 14. 

    Two main measures for the efficiency of an algorithm are

    • A.

      Processor and memory

    • B.

      Complexity and capacity

    • C.

      Time and space

    • D.

      Data and space

    Correct Answer
    C. Time and space
    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.

    Rate this question:

  • 15. 

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

    • A.

      Counting microseconds

    • B.

      Counting the number of key operations

    • C.

      Counting the number of statements

    • D.

      Counting the kilobytes of algorithm

    Correct Answer
    B. Counting the number of key operations
    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.

    Rate this question:

  • 16. 

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

    • A.

      Counting the maximum memory needed by the algorithm

    • B.

      Counting the minimum memory needed by the algorithm

    • C.

      Counting the average memory needed by the algorithm

    • D.

      Counting the maximum disk space needed by the algorithm

    Correct Answer
    A. Counting the maximum memory needed by the algorithm
    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.

    Rate this question:

  • 17. 

    Which of the following case does not exist in complexity theory

    • A.

      Best case

    • B.

      Worst case

    • C.

      Average case

    • D.

      Null case

    Correct Answer
    D. Null case
    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.

    Rate this question:

  • 18. 

    The Worst case occur in linear search algorithm when

    • A.

      Item is somewhere in the middle of the array

    • B.

      Item is not in the array at all

    • C.

      Item is the last element in the array

    • D.

      Item is the last element in the array or is not there at all

    Correct Answer
    D. Item is the last element in the array or is not there at all
    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.

    Rate this question:

  • 19. 

    The Average case occur in linear search algorithm

    • A.

      When Item is somewhere in the middle of the array

    • B.

      When Item is not in the array at all

    • C.

      When Item is the last element in the array

    • D.

      When Item is the last element in the array or is not there at all

    Correct Answer
    A. When Item is somewhere in the middle of the array
    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.

    Rate this question:

  • 20. 

    The complexity of the average case of an algorithm is

    • A.

      Much more complicated to analyze than that of worst case

    • B.

      Much more simpler to analyze than that of worst case

    • C.

      Sometimes more complicated and some other times simpler than that of worst case

    • D.

      None or above

    Correct Answer
    A. Much more complicated to analyze than that of worst case
    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.

    Rate this question:

  • 21. 

    The complexity of linear search algorithm is

    • A.

      O(n)

    • B.

      O(log n)

    • C.

      O(n2)

    • D.

      O(n log n)

    Correct Answer
    A. O(n)
    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.

    Rate this question:

  • 22. 

    The complexity of Binary search algorithm is

    • A.

      O(n)

    • B.

      O(log )

    • C.

      O(n2)

    • D.

      O(n log n)

    Correct Answer
    B. O(log )
  • 23. 

    The complexity of Bubble sort algorithm is

    • A.

      O(n)

    • B.

      O(log n)

    • C.

      O(n2)

    • D.

      O(n log n)

    Correct Answer
    C. O(n2)
    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).

    Rate this question:

  • 24. 

    The complexity of merge sort algorithm is

    • A.

      O(n)

    • B.

      O(log n)

    • C.

      O(n2)

    • D.

      O(n log n)

    Correct Answer
    D. O(n log n)
    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).

    Rate this question:

  • 25. 

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

    • A.

      Internal change

    • B.

      Inter-module change

    • C.

      Side effect

    • D.

      Side-module update

    Correct Answer
    C. Side effect
    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.

    Rate this question:

  • 26. 

    Which of the following data structure is not linear data structure?

    • A.

      Arrays

    • B.

      Linked lists

    • C.

      Both of above

    • D.

      None of above

    Correct Answer
    D. None of above
    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.

    Rate this question:

  • 27. 

    Which of the following data structure is linear data structure?

    • A.

      Trees

    • B.

      Graphs

    • C.

      Arrays

    • D.

      None of above

    Correct Answer
    C. Arrays
    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.

    Rate this question:

  • 28. 

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

    • A.

      Sorting

    • B.

      Merging

    • C.

      Inserting

    • D.

      Traversal

    Correct Answer
    D. Traversal
    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.

    Rate this question:

  • 29. 

    Finding the location of the element with a given value is:

    • A.

      Traversal

    • B.

      Search

    • C.

      Sort

    • D.

      None of above

    Correct Answer
    B. Search
    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.

    Rate this question:

  • 30. 

    Arrays are best data structures

    • A.

      For relatively permanent collections of data

    • B.

      For the size of the structure and the data in the structure are constantly changing

    • C.

      For both of above situation

    • D.

      For none of above situation

    Correct Answer
    A. For relatively permanent collections of data
    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.

    Rate this question:

  • 31. 

    Linked lists are best suited

    • A.

      For relatively permanent collections of data

    • B.

      for the size of the structure and the data in the structure are constantly changing

    • C.

      For both of above situation

    • D.

      For none of above situation

    Correct Answer
    B. for the size of the structure and the data in the structure are constantly changing
    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.

    Rate this question:

  • 32. 

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

    • A.

      The name of array

    • B.

      the data type of array

    • C.

      The first data from the set to be stored

    • D.

      The index set of the array

    Correct Answer
    C. The first data from the set to be stored
    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.

    Rate this question:

  • 33. 

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

    • A.

      By this way computer can keep track only the address of the first element and the addresses of other elements can be calculated

    • B.

      the architecture of computer memory does not allow arrays to store other than serially

    • C.

      Both of above

    • D.

      None of above

    Correct Answer
    A. By this way computer can keep track only the address of the first element and the addresses of other elements can be calculated
    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.

    Rate this question:

  • 34. 

    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

    • A.

      1,2,3,4

    • B.

      1,3,4,5

    • C.

      2,4,5,6

    • D.

      3,4,5,6

    Correct Answer
    B. 1,3,4,5
    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.

    Rate this question:

  • 35. 

    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';

    • A.

      1,2,4

    • B.

      1,3,6

    • C.

      3,5

    • D.

      5 only

    Correct Answer
    B. 1,3,6
  • 36. 

    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?

    • A.

      New Inner(); //At line 5

    • B.

      New Inner(); //At line 10

    • C.

      New ot.Inner(); //At line 10

    • D.

      New Outer.Inner(); //At line 10

    Correct Answer
    A. New Inner(); //At line 5
    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.

    Rate this question:

  • 37. 

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

    • A.

      Float[ ] f = new float(3);

    • B.

      Float f2[ ] = new float[ ];

    • C.

      Float[ ]f1 = new float[3];

    • D.

      Float f3[ ] = new float[3];

    Correct Answer(s)
    A. Float[ ] f = new float(3);
    B. Float f2[ ] = new float[ ];
    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;".

    Rate this question:

  • 38. 

    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

    • A.

      True

    • B.

      False

    Correct Answer
    B. False
    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.

    Rate this question:

  • 39. 

    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

    Correct Answer
    B. Tiny
    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 < 15) evaluates to false, so the next condition (x < 22) is checked. Since x is equal to 20, this condition is true and the value "tiny" is assigned to "sup". Therefore, "tiny" is printed as the output.

    Rate this question:

  • 40. 

    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

    Correct Answer
    D. 14
    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.

    Rate this question:

  • 41. 

    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() {} }

    • A.

      AC

    • B.

      BC

    • C.

      ACD

    • D.

      ABCD

    Correct Answer
    C. ACD
    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".

    Rate this question:

  • 42. 

    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?

    • A.

      Compilation fails

    • B.

      "odd" will always be output.

    • C.

      "even" will always be output.

    • D.

      "odd" will be output for odd values of x, and "even" for even values.

    Correct Answer
    A. Compilation fails
    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.

    Rate this question:

  • 43. 

    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

    • A.

      True

    • B.

      False

    Correct Answer
    B. False
    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.

    Rate this question:

  • 44. 

    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?

    • A.

      Java.util.ArrayList

    • B.

      Java.util.LinkedHashMap

    • C.

      Java.util.HashMap

    • D.

      Java.util.TreeMap

    Correct Answer
    B. Java.util.LinkedHashMap
    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.

    Rate this question:

  • 45. 

    /* 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?

    • A.

      No statement required.

    • B.

      Import java.io.*;

    • C.

      Import java.io.PrintWriter;

    • D.

      #include java.io.*;

    Correct Answer
    A. No statement required.
    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.

    Rate this question:

  • 46. 

    Which of the following are Java reserved words?

    • A.

      Constant

    • B.

      Null

    • C.

      Default

    • D.

      Implement

    Correct Answer(s)
    B. Null
    C. Default
    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.

    Rate this question:

  • 47. 

    State the below statement is not false about static nested class:  It’s variables and methods must be static

    • A.

      True

    • B.

      False

    Correct Answer
    B. False
    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.

    Rate this question:

  • 48. 

    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 ?

    • A.

      Thread t = new Thread(X);

    • B.

      Thread t = new Thread(X); t.start();

    • C.

      X run = new X(); Thread t = new Thread(run); t.start();

    • D.

      Thread t = new Thread(); x.run();

    Correct Answer
    C. X run = new X(); Thread t = new Thread(run); t.start();
    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.

    Rate this question:

  • 49. 

    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()

    • A.

      1,2 and 4

    • B.

      2,5 and 6

    • C.

      3,4 and 7

    • D.

      4,5 and 7

    Correct Answer
    B. 2,5 and 6
  • 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?

    • A.

      0

    • B.

      1

    • C.

      2

    • D.

      3

    Correct Answer
    B. 1
    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.

    Rate this question:

Quiz Review Timeline +

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
Back to Top Back to top
Advertisement
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.