Quiz
NPTEL Java
Crie uma conta grátis para terminar este quiz
Salve seu progresso e veja sua nota final.
Já tem uma conta? Inicie sessão
Perguntas do quiz (38)
11.In Java programming an object can take many forms. This feature is called ______.
- AAbstraction
- BPolymorphism
- CEncapsulation
- DInheritance
2What is the primary focus of Java programming?
- ALow-level optimizations
- BHardware-specific operations
- CPlatform independence
- DAssembly language programming
3Which of the following programming principles is a key aspect of Java
- ACode obfuscation
- BPlatform dependence
- CObject-oriented programming
- DGlobal variables
4What is the last step in the Java programming process?
- AJava Program Execution
- BJava Program Editing
- CJava Program Compilation
- DC/C++ versus Java
5Which of the following is NOT a Java programming tool?
- AEclipse
- BNetBeans
- CIntelliJ IDEA
- DGCC
6What does the term "Write Once, Run Anywhere" (WORA) imply in Java?
- ACode reusability
- BPlatform independence
- CCross-compilation
- DDynamic typing
7In Java, what is used to store multiple values of the same type?
- AStructures
- BPointers
- CArrays
- DLists
8Which of the following is a valid identifier in Java?
- A123identifier
- B_identifier
- C#identifier
- Didentifier-123
9What is the purpose of Java Language Subset?
- ATo limit the capabilities of Java
- BTo make Java code compatible with other languages
- CTo define a smaller set of Java features for specific purposes
- DTo enhance the performance of Java programs
10What is the primary purpose of the Java Virtual Machine (JVM) in the Java programming language?
- ACode optimization
- BPlatform independence
- CMemory management
- DHardware-specific operations
11What is emphasized during the Java Program Editing phase?
- AWriting platform-specific code
- BDebugging the program
- CCompiling the program
- DWriting and modifying the source code
12Which of the following is a valid declaration of an object of class, say NPTEL?
- ANPTEL obj = new NPTEL();
- BNPTEL obj = new NPTEL;
- CObj = new NPTEL();
- Dnew NPTEL obj;
13A default constructor_______________________
- Ahas no arguments
- Bhas no return type
- Chas one argument but no return type
- Dhas two arguments
14A top-level class may have which one of the following access modifiers?
- Apackage
- Bprivate
- Cprotected
- Dpublic
15Integer in Java is a\an _______.
- AAdapter class
- BInner class
- CNot a class
- DWrapper class
16Which one is not supported by OOP?
- AAbstraction
- BPolymorphism
- CEncapsulation
- DGlobal variables
17Which of the following modifiers can be used to disallow a method from being overridden?
- Afinal
- Btransient
- Cvolatile
- Dstatic
18identify the error

- A1
- B2
- C3
- D4 and 5
19Which of the following is TRUE about print() and println() methods?
- Aprint() prints in a single line only and multiple lines cannot be printed in any way.
- Bprintln() prints in a single line only and multiple lines cannot be printed.
- Cprint() prints and then appends a line break.
- Dprintln() prints and then appends a line break.
20Which of the following statement is true regarding the order of execution of constructors in an inheritance hierarchy?
- ABase class constructor will be called followed by the derived class constructor.
- BOnly Base class constructor will be called.
- COnly derived class constructor will be called.
- DDerived class constructor will be called followed by the base class constructor.
21The super() method is used to:
- ACall constructor of friend class
- BIs a declared method
- CCall constructor of the parent class
- DCall constructor
22Output of this program

- A2
- B0
- CCompilation Error
- D1
23In Java, is it possible to override a static method?
- ANo, static methods cannot be overridden because they belong to the class, not the object.
- BIt depends on whether the static method is declared as final or not.
- CIt depends on the access modifier of the static method.
- DYes, we can override a static method just like we do with instance methods.
24Output of thi program

- A"The car moves"
- BNone of the above
- CThe does not cocode mpile
- D"The vehicle moves"
25Output of this program

- ASweet=$10 Sugar=$10
- BSweet=$20 Sugar=$20
- CCompiler error
- DSweet=$10 Sugar=$20
26What is the purpose of method hiding in Java inheritance?
- ATo prevent a subclass from inheriting methods
- BTo define methods with the same name in both the superclass and subclass
- CTo expose private methods of the superclass
- DTo override superclass methods with new implementations
27Output of this program

- A"child from child"
- B"child from parent"
- C"parent from parent"
- D"parent from child"
28Can a class be marked as both “final” and “abstract” in Java?
- AYes, but only if it has no methods.
- BYes, but only if it is marked as “protected.”
- CNo, a class cannot be both “final” and “abstract.”
- DYes, a class can be marked as both “final” and “abstract.”
29In Java, is it possible to override a static method?
- AYes, we can override a static method just like we do with instance methods.
- BIt depends on whether the static method is declared as final or not.
- CIt depends on the access modifier of the static method.
- DNo, static methods cannot be overridden because they belong to the class, not the object.
30Which is the keyword used to specify the default access modifier in java?
- Adefault
- Bpackage
- CDEFAULT
- D“There is no keyword”
31What is the output of the Java program with access modifiers?

- AFOUR
- BCompiler Error
- Cnull
- DRuntime Error
32What is the output of the below Java Code Snippet with access modifiers?

- AWeeks = 0
- BCompiler error
- CNo Error, blank output
- DWeeks = 12
33Which of the following is the correct representation of access modifiers in order of increasing visibility?
- Aprivate < default < protected < public
- Bprotected < default < private < public
- Cpublic < protected < default < private
- Dprivate < protected < default < public
34Which of the following package stores all the standard java classes?
- Ajava.util
- Bjava.lang
- Cjava.java
- Djava.packages
35Which of the following is/are true about packages in Java?
1. Every class is part of some package.
2. All classes in a file are part of the same package.
3. If no package is specified, the classes in the file go into a special unnamed package.
4. If no package is specified, a new package is created with folder name of class and the class is put in this package.- AOnly 1, 2 and 3
- BOnly 1 and 3
- COnly 4
- DOnly 1, 2 and 4
36What is the output of following Java program?

- ACompiler Error
- BNone of the above
- CWelcome!
- DRuntime Error
37Which of these access specifiers can be used for an interface?
- APublic
- BProtected
- Cprivate
- DAll of the mentioned
38Which of the following is the correct way of implementing an interface salary by class manager?
- Aclass Java extends NPTEL {}
- Bclass Java implements NPTEL {}
- Cclass Java imports NPTEL {}
- Dnone of the mentioned
Informações
- Descrição
- Computer Science Quiz sobre NPTEL Java, criado por Siraj I em 15-02-2024.
- Autor
- Siraj I
- Idioma
- English
- Visualizações
- 16
- Etiquetas
- Avaliação
- Ainda sem avaliações Avalie este quiz