SlideShare a Scribd company logo
CSC142 – Quiz 1 1
Multiple Choice Questions (10 points)
Answer all of the following questions. READ EACH QUESTION
CAREFULLY. Fill the correct bubble on your scantron sheet.
Each correct answer is worth 1 point. Each question has
EXACTLY one correct answer.
Consider the following program:
import myLibrary.*;
public class ShowSomeClass
{
// code for the class...
}
What is the name of the java file containing this program?
A. myLibrary.java
B. ShowSomeClass.java
C. ShowSomeClass
D. ShowSomeClass.class
1.
E. Any file name with the java suffix will do
Which of the following is TRUE?
A. In java, an instance field declared public generates a compilation error.
B. int is the name of a class available in the package java.lang
C. Instance variable names may only contain letters and digits.
D. A class has always a constructor (possibly automatically supplied by the java
compiler).
2.
E. The more comments in a program, the faster the program runs.
Consider the following code snippet
String river = new String(“Columbia”);
System.out.println(river.length());
What is printed?
A. 6
B. 7
C. 8
D. Columbia
3.
E. river
CSC142 – Quiz 1 2
A constructor
A. must have the same name as the class it is declared within.
B. is used to create objects.
C. may be declared private
D. A and B
4.
E. A, B and C
Which of the following may be part of a class definition?
A. instance variables
B. instance methods
C. constructors
D. all of the above
5.
E. none of the above
What is different between a Java applet and a Java application?
A. An application can in general be trusted whereas an applet can't.
B. An applet must be executed in a browser environment.
C. An applet is not able to access the files of the computer it runs on
D. (A), (B) and (C).
6.
E. None of the above
Consider
public class MyClass{
public MyClass(){/*code*/}
// more code...
}
To instantiate MyClass, you would write?
A. MyClass mc = new MyClass();
B. MyClass mc = MyClass();
C. MyClass mc = MyClass;
D. MyClass mc = new MyClass;
7.
E. It can't be done. The constructor of MyClass should be defined as
public void MyClass(){/*code*/}
What is byte code in the context of Java?
A. The type of code generated by a Java compiler
B. The type of code generated by a Java Virtual Machine
C. It is another name for a Java source file
D. It is the code written within the instance methods of a class.
8.
E. It is another name for comments written within a program.
CSC142 – Quiz 1 3
What is garbage collection in the context of Java?
A. The operating system periodically deletes all of the java files available on the
system.
B. Any package imported in a program and not used is automatically deleted.
C. When all references to an object are gone, the memory used by the object is
automatically reclaimed.
D. The JVM checks the output of any Java program and deletes anything that
doesn't make sense.
9.
E. Janitors working for Sun MicroSystems are required to throw away any
Microsoft documentation found in the employees' offices.
You read the following statement in a Java program that compiles and
executes.
submarine.dive(depth);
What can you say for sure?
A. depth must be an int
B. dive must be a method.
C. dive must be the name of an instance field.
D. submarine must be the name of a class
10.
E. submarine must be a method.

More Related Content

What's hot

Class method object
Class method objectClass method object
Class method object
Minal Maniar
 
Java lab lecture 1
Java  lab  lecture 1Java  lab  lecture 1
Java lab lecture 1
vishal choudhary
 
Making Applications Work Together In Eclipse
Making Applications Work Together In EclipseMaking Applications Work Together In Eclipse
Making Applications Work Together In EclipseKaniska Mandal
 
C# classes objects
C#  classes objectsC#  classes objects
C# classes objects
Dr.Neeraj Kumar Pandey
 
Test automation in Loris
Test automation in LorisTest automation in Loris
Test automation in Loris
Wasion Wang
 
Java - Inheritance Concepts
Java - Inheritance ConceptsJava - Inheritance Concepts
Java - Inheritance Concepts
Victer Paul
 
Packages and interfaces
Packages and interfacesPackages and interfaces
Packages and interfaces
bhuvaneshwariA5
 
Examples c#
Examples c#Examples c#
Examples c#
bhaskard8
 
INHERTANCE , NARROW AND WIDENING
INHERTANCE , NARROW AND WIDENING INHERTANCE , NARROW AND WIDENING
INHERTANCE , NARROW AND WIDENING
ManpreetSingh1387
 
Multiple inheritance possible in Java
Multiple inheritance possible in JavaMultiple inheritance possible in Java
Multiple inheritance possible in Java
Kurapati Vishwak
 

What's hot (10)

Class method object
Class method objectClass method object
Class method object
 
Java lab lecture 1
Java  lab  lecture 1Java  lab  lecture 1
Java lab lecture 1
 
Making Applications Work Together In Eclipse
Making Applications Work Together In EclipseMaking Applications Work Together In Eclipse
Making Applications Work Together In Eclipse
 
C# classes objects
C#  classes objectsC#  classes objects
C# classes objects
 
Test automation in Loris
Test automation in LorisTest automation in Loris
Test automation in Loris
 
Java - Inheritance Concepts
Java - Inheritance ConceptsJava - Inheritance Concepts
Java - Inheritance Concepts
 
Packages and interfaces
Packages and interfacesPackages and interfaces
Packages and interfaces
 
Examples c#
Examples c#Examples c#
Examples c#
 
INHERTANCE , NARROW AND WIDENING
INHERTANCE , NARROW AND WIDENING INHERTANCE , NARROW AND WIDENING
INHERTANCE , NARROW AND WIDENING
 
Multiple inheritance possible in Java
Multiple inheritance possible in JavaMultiple inheritance possible in Java
Multiple inheritance possible in Java
 

Viewers also liked

Recce Photos
Recce Photos Recce Photos
Recce Photos
downerj
 
Behandlingsskolernes dagskoler har fået deres egne hjemmesider
Behandlingsskolernes dagskoler har fået deres egne hjemmesiderBehandlingsskolernes dagskoler har fået deres egne hjemmesider
Behandlingsskolernes dagskoler har fået deres egne hjemmesider
Behandlingsskolerne
 
левице
левицелевице
левице
vierah
 
Location floor plan
Location floor planLocation floor plan
Location floor plan
downerj
 
Script
Script Script
Script
downerj
 
Beyoncé run the world lyrics
Beyoncé run the world lyrics Beyoncé run the world lyrics
Beyoncé run the world lyrics
downerj
 
Nika 1.B rj
Nika 1.B rjNika 1.B rj
Nika 1.B rj
vierah
 
Eда marek, radka
Eда   marek, radkaEда   marek, radka
Eда marek, radka
vierah
 
Digipak Analysis
Digipak Analysis Digipak Analysis
Digipak Analysis
downerj
 
г. левице
г.  левицег.  левице
г. левице
vierah
 
наша школа, г. левице
наша школа, г.  левиценаша школа, г.  левице
наша школа, г. левице
vierah
 
Odezda
OdezdaOdezda
Odezda
vierah
 
Question 6- What have you learnt about technologies from the process of const...
Question 6- What have you learnt about technologies from the process of const...Question 6- What have you learnt about technologies from the process of const...
Question 6- What have you learnt about technologies from the process of const...
downerj
 
Eda nika 1.b rj
Eda   nika 1.b rjEda   nika 1.b rj
Eda nika 1.b rj
vierah
 
Individu, keluarga, dan masyarakat
Individu, keluarga, dan masyarakatIndividu, keluarga, dan masyarakat
Individu, keluarga, dan masyarakat
fakhriidzna
 
manual siemens 840sl
manual siemens 840slmanual siemens 840sl
manual siemens 840sl
Abel Ferreira de Brito
 
Nom 017-ssa2-1994
Nom 017-ssa2-1994Nom 017-ssa2-1994
Nom 017-ssa2-1994
Israel Rivas
 
Weihnachten
WeihnachtenWeihnachten
Weihnachten
vierah
 

Viewers also liked (18)

Recce Photos
Recce Photos Recce Photos
Recce Photos
 
Behandlingsskolernes dagskoler har fået deres egne hjemmesider
Behandlingsskolernes dagskoler har fået deres egne hjemmesiderBehandlingsskolernes dagskoler har fået deres egne hjemmesider
Behandlingsskolernes dagskoler har fået deres egne hjemmesider
 
левице
левицелевице
левице
 
Location floor plan
Location floor planLocation floor plan
Location floor plan
 
Script
Script Script
Script
 
Beyoncé run the world lyrics
Beyoncé run the world lyrics Beyoncé run the world lyrics
Beyoncé run the world lyrics
 
Nika 1.B rj
Nika 1.B rjNika 1.B rj
Nika 1.B rj
 
Eда marek, radka
Eда   marek, radkaEда   marek, radka
Eда marek, radka
 
Digipak Analysis
Digipak Analysis Digipak Analysis
Digipak Analysis
 
г. левице
г.  левицег.  левице
г. левице
 
наша школа, г. левице
наша школа, г.  левиценаша школа, г.  левице
наша школа, г. левице
 
Odezda
OdezdaOdezda
Odezda
 
Question 6- What have you learnt about technologies from the process of const...
Question 6- What have you learnt about technologies from the process of const...Question 6- What have you learnt about technologies from the process of const...
Question 6- What have you learnt about technologies from the process of const...
 
Eda nika 1.b rj
Eda   nika 1.b rjEda   nika 1.b rj
Eda nika 1.b rj
 
Individu, keluarga, dan masyarakat
Individu, keluarga, dan masyarakatIndividu, keluarga, dan masyarakat
Individu, keluarga, dan masyarakat
 
manual siemens 840sl
manual siemens 840slmanual siemens 840sl
manual siemens 840sl
 
Nom 017-ssa2-1994
Nom 017-ssa2-1994Nom 017-ssa2-1994
Nom 017-ssa2-1994
 
Weihnachten
WeihnachtenWeihnachten
Weihnachten
 

Similar to Quiz1solt (2)

Advanced java jee material by KV Rao sir
Advanced java jee material by KV Rao sirAdvanced java jee material by KV Rao sir
Advanced java jee material by KV Rao sir
AVINASH KUMAR
 
Adv kvr -satya
Adv  kvr -satyaAdv  kvr -satya
Adv kvr -satya
Jyothsna Sree
 
Advance java kvr -satya
Advance java  kvr -satyaAdvance java  kvr -satya
Advance java kvr -satya
Satya Johnny
 
C# .NET: Language Features and Creating .NET Projects, Namespaces Classes and...
C# .NET: Language Features and Creating .NET Projects, Namespaces Classes and...C# .NET: Language Features and Creating .NET Projects, Namespaces Classes and...
C# .NET: Language Features and Creating .NET Projects, Namespaces Classes and...
yazad dumasia
 
Java Programming.pdf
Java Programming.pdfJava Programming.pdf
Java Programming.pdf
RavinderKSingla
 
Introduction to object oriented programming concepts
Introduction to object oriented programming conceptsIntroduction to object oriented programming concepts
Introduction to object oriented programming concepts
Ganesh Karthik
 
GSP 125 Entire Course NEW
GSP 125 Entire Course NEWGSP 125 Entire Course NEW
GSP 125 Entire Course NEW
shyamuopten
 
Object-oriented programming (OOP) with Complete understanding modules
Object-oriented programming (OOP) with Complete understanding modulesObject-oriented programming (OOP) with Complete understanding modules
Object-oriented programming (OOP) with Complete understanding modules
Durgesh Singh
 
Ganesh groups
Ganesh groupsGanesh groups
Ganesh groups
Ganesh Amirineni
 
JAVA Object Oriented Programming (OOP)
JAVA Object Oriented Programming (OOP)JAVA Object Oriented Programming (OOP)
JAVA Object Oriented Programming (OOP)
Prof. Erwin Globio
 
Oop suplemnertary september 2019
Oop suplemnertary september  2019Oop suplemnertary september  2019
Oop suplemnertary september 2019
ktuonlinenotes
 
Inheritance and interface
Inheritance and interfaceInheritance and interface
Inheritance and interface
Shubham Sharma
 
Java concurrency questions and answers
Java concurrency questions and answers Java concurrency questions and answers
Java concurrency questions and answers
CodeOps Technologies LLP
 
Reflection in java
Reflection in javaReflection in java
Reflection in javaupen.rockin
 
Visula C# Programming Lecture 8
Visula C# Programming Lecture 8Visula C# Programming Lecture 8
Visula C# Programming Lecture 8
Abou Bakr Ashraf
 
C# programming constructors
C# programming  constructorsC# programming  constructors
C# programming constructors성진 원
 
classes object fgfhdfgfdgfgfgfgfdoop.pptx
classes object  fgfhdfgfdgfgfgfgfdoop.pptxclasses object  fgfhdfgfdgfgfgfgfdoop.pptx
classes object fgfhdfgfdgfgfgfgfdoop.pptx
arjun431527
 
Core Java- An advanced review of features
Core Java- An advanced review of featuresCore Java- An advanced review of features
Core Java- An advanced review of featuresvidyamittal
 

Similar to Quiz1solt (2) (20)

Advanced java jee material by KV Rao sir
Advanced java jee material by KV Rao sirAdvanced java jee material by KV Rao sir
Advanced java jee material by KV Rao sir
 
Ppl home assignment_unit3
Ppl home assignment_unit3Ppl home assignment_unit3
Ppl home assignment_unit3
 
Adv kvr -satya
Adv  kvr -satyaAdv  kvr -satya
Adv kvr -satya
 
Advance java kvr -satya
Advance java  kvr -satyaAdvance java  kvr -satya
Advance java kvr -satya
 
C# .NET: Language Features and Creating .NET Projects, Namespaces Classes and...
C# .NET: Language Features and Creating .NET Projects, Namespaces Classes and...C# .NET: Language Features and Creating .NET Projects, Namespaces Classes and...
C# .NET: Language Features and Creating .NET Projects, Namespaces Classes and...
 
Java Programming.pdf
Java Programming.pdfJava Programming.pdf
Java Programming.pdf
 
Introduction to object oriented programming concepts
Introduction to object oriented programming conceptsIntroduction to object oriented programming concepts
Introduction to object oriented programming concepts
 
GSP 125 Entire Course NEW
GSP 125 Entire Course NEWGSP 125 Entire Course NEW
GSP 125 Entire Course NEW
 
Object-oriented programming (OOP) with Complete understanding modules
Object-oriented programming (OOP) with Complete understanding modulesObject-oriented programming (OOP) with Complete understanding modules
Object-oriented programming (OOP) with Complete understanding modules
 
Ganesh groups
Ganesh groupsGanesh groups
Ganesh groups
 
2310 b 03
2310 b 032310 b 03
2310 b 03
 
JAVA Object Oriented Programming (OOP)
JAVA Object Oriented Programming (OOP)JAVA Object Oriented Programming (OOP)
JAVA Object Oriented Programming (OOP)
 
Oop suplemnertary september 2019
Oop suplemnertary september  2019Oop suplemnertary september  2019
Oop suplemnertary september 2019
 
Inheritance and interface
Inheritance and interfaceInheritance and interface
Inheritance and interface
 
Java concurrency questions and answers
Java concurrency questions and answers Java concurrency questions and answers
Java concurrency questions and answers
 
Reflection in java
Reflection in javaReflection in java
Reflection in java
 
Visula C# Programming Lecture 8
Visula C# Programming Lecture 8Visula C# Programming Lecture 8
Visula C# Programming Lecture 8
 
C# programming constructors
C# programming  constructorsC# programming  constructors
C# programming constructors
 
classes object fgfhdfgfdgfgfgfgfdoop.pptx
classes object  fgfhdfgfdgfgfgfgfdoop.pptxclasses object  fgfhdfgfdgfgfgfgfdoop.pptx
classes object fgfhdfgfdgfgfgfgfdoop.pptx
 
Core Java- An advanced review of features
Core Java- An advanced review of featuresCore Java- An advanced review of features
Core Java- An advanced review of features
 

Quiz1solt (2)

  • 1. CSC142 – Quiz 1 1 Multiple Choice Questions (10 points) Answer all of the following questions. READ EACH QUESTION CAREFULLY. Fill the correct bubble on your scantron sheet. Each correct answer is worth 1 point. Each question has EXACTLY one correct answer. Consider the following program: import myLibrary.*; public class ShowSomeClass { // code for the class... } What is the name of the java file containing this program? A. myLibrary.java B. ShowSomeClass.java C. ShowSomeClass D. ShowSomeClass.class 1. E. Any file name with the java suffix will do Which of the following is TRUE? A. In java, an instance field declared public generates a compilation error. B. int is the name of a class available in the package java.lang C. Instance variable names may only contain letters and digits. D. A class has always a constructor (possibly automatically supplied by the java compiler). 2. E. The more comments in a program, the faster the program runs. Consider the following code snippet String river = new String(“Columbia”); System.out.println(river.length()); What is printed? A. 6 B. 7 C. 8 D. Columbia 3. E. river
  • 2. CSC142 – Quiz 1 2 A constructor A. must have the same name as the class it is declared within. B. is used to create objects. C. may be declared private D. A and B 4. E. A, B and C Which of the following may be part of a class definition? A. instance variables B. instance methods C. constructors D. all of the above 5. E. none of the above What is different between a Java applet and a Java application? A. An application can in general be trusted whereas an applet can't. B. An applet must be executed in a browser environment. C. An applet is not able to access the files of the computer it runs on D. (A), (B) and (C). 6. E. None of the above Consider public class MyClass{ public MyClass(){/*code*/} // more code... } To instantiate MyClass, you would write? A. MyClass mc = new MyClass(); B. MyClass mc = MyClass(); C. MyClass mc = MyClass; D. MyClass mc = new MyClass; 7. E. It can't be done. The constructor of MyClass should be defined as public void MyClass(){/*code*/} What is byte code in the context of Java? A. The type of code generated by a Java compiler B. The type of code generated by a Java Virtual Machine C. It is another name for a Java source file D. It is the code written within the instance methods of a class. 8. E. It is another name for comments written within a program.
  • 3. CSC142 – Quiz 1 3 What is garbage collection in the context of Java? A. The operating system periodically deletes all of the java files available on the system. B. Any package imported in a program and not used is automatically deleted. C. When all references to an object are gone, the memory used by the object is automatically reclaimed. D. The JVM checks the output of any Java program and deletes anything that doesn't make sense. 9. E. Janitors working for Sun MicroSystems are required to throw away any Microsoft documentation found in the employees' offices. You read the following statement in a Java program that compiles and executes. submarine.dive(depth); What can you say for sure? A. depth must be an int B. dive must be a method. C. dive must be the name of an instance field. D. submarine must be the name of a class 10. E. submarine must be a method.