0

programming languages Online Quiz - 39

Description: programming languages Online Quiz - 39
Number of Questions: 20
Created by:
Tags: programming languages
Attempted 0/20 Correct 0 Score 0

chmod command?

  1. To change the group of a file or directory

  2. To change permissions on a file

  3. To display information about mounted filesystems

  4. Tells the status of local networked machines


Correct Option: B

tar command?

  1. compresses a file and returns the original file with .z extension

  2. to backup the file systems

  3. creates an archive of files into a single file

  4. will initiate an interactive conversation with user


Correct Option: C

env command reports information on active processes?

  1. True

  2. False


Correct Option: B

The statement that is used to replace multiple if statements is called?

  1. The switch & case statement

  2. ?: (ternary operator)

  3. The #endif statement

  4. The nestedif statement


Correct Option: A

Which statement is true about interface and abstract classes?

  1. A class may inherit several interfaces, A class may inherit only one abstract class

  2. An abstract class may only contain incomplete methods (abstract methods)

  3. An interface may contain complete or incomplete methods

  4. A class implementing an abstract class has to implement all the methods of the abstract class, but the same is not required in the case of an interface


Correct Option: A

AI Explanation

To answer this question, let's go through each option to understand why it is correct or incorrect:

Option A) A class may inherit several interfaces, A class may inherit only one abstract class - This option is correct. In Java, a class can implement multiple interfaces, but it can only inherit (extend) one abstract class. This is because Java does not support multiple inheritance of classes.

Option B) An abstract class may only contain incomplete methods (abstract methods) - This option is incorrect. An abstract class can contain both abstract methods and concrete methods (i.e., methods with an implementation). Abstract methods are those that do not have a body and are meant to be overridden by the subclasses.

Option C) An interface may contain complete or incomplete methods - This option is correct. An interface can contain both complete (default) methods and incomplete (abstract) methods. Complete methods have a body and are inherited as they are, while incomplete methods do not have a body and must be implemented by the classes that implement the interface.

Option D) A class implementing an abstract class has to implement all the methods of the abstract class, but the same is not required in the case of an interface - This option is incorrect. In both cases, when a class implements an abstract class or an interface, it must provide an implementation for all the methods declared in the abstract class or interface. Otherwise, the class must be declared as abstract.

The correct answer is A) A class may inherit several interfaces, A class may inherit only one abstract class. This option is correct because it accurately describes the difference between inheriting interfaces and abstract classes in Java.

If a method is marked as protected internal who can access it?

  1. Access is limited to the current assembly

  2. Access is limited to the containing class or types derived from the containing class.

  3. Access is limited to the current assembly or types derived from the containing class.

  4. Access is limited to the containing type


Correct Option: C

The default type of enum is integer and has a default value 1.

  1. True

  2. False

  3. Sometimes

  4. None


Correct Option: B
  1. string s = #"Test string";

  2. string s = ."Test string";

  3. string s = @"Test string";

  4. string s = &"Test string";


Correct Option: C

How can you sort the elements of the array in descending order?

  1. By calling ReverseSort()

  2. By calling SortReverse()

  3. By calling Descend()

  4. By calling Sort() and then Reverse() methods


Correct Option: D

What is the name given to the type of assembly that contains localized resources?

  1. Spoke

  2. Satellite

  3. Sputnik

  4. Hub


Correct Option: B

What are the OOPS Concepts

  1. Abstraction

  2. Encapsulation

  3. Structures

  4. POP


Correct Option: A,B
  1. POP

  2. OOPS

  3. Strucutres

  4. Pointers


Correct Option: B,D

Will C++ supports Structures

  1. True

  2. False


Correct Option: A
  1. class Base{} 2. public class MyCast extends Base{ 3. static boolean b1=false; 4. static int i = -1; 5. static double d = 10.1; 6. public static void main(String argv[]){ 7. MyCast m = new MyCast(); 8. Base b = new Base(); 9. //………..Here 10. }}
  1. b=m;

  2. m=b;

  3. d =i;

  4. b1 =i;


Correct Option: A
- Hide questions