SlideShare a Scribd company logo
Conceitos Fundamentais de Orientação a Objetos. Grupo de Estudo de Java Joselito Seção 1
Tópicos ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
QUESTION  01 Which four are primitive integer types in Java? (Choose four.)‏ A. int B. byte C. long D. char E. float F. String G. Integer
QUESTION  02 Which two compile without error? (Choose two.)‏ A. boolean b =  0; B. float f = 3.14; C. double d = 1000; D. char c = '0078';
QUESTION  03 Which three are legal ways to declare and initialize an instance variable? (Choose three.)‏ A. static int x = 42; B. public int x = 'c';  C. public int x =  null; D. public Integer f = null; E. static integer f = new integer (42);  F. public integer f = new integer(42);
QUESTION  04 Which two are valid? (Choose two.)‏ A. enum Suit { CLUBS, DIAMONDS, HEARTS, SPADES }  class EnumTest { public static void main(String args[]) { System.out.println(Suit.CLUBS); } } B. class EnumTest { public static void main(String args[]) { enum Num { ONE, TWO, THREE, FOUR } System.out.println(Num.ONE); } } C. class EnumTest { enum Colors { Red = 1, Green = 2, Blue = 4, Yellow = 8 } public static void main(String args[]) { System.out.println(Colors.Red); } } D. class EnumTest { enum Days { Sat, Sun, Mon, Tue, Wed, Thu, Fri } public static void main(String args[]) { System.out.println(days.Sat); }
QUESTION  05 Given: 1. class Variables { 2. int i; 3. String s; 4. Object o; 5. String g = null; 6. Integer y; 7. char c; 8. } Which four are object references? (Choose four.)‏ A. i B. s C. o D. g E. y F. c
QUESTION  06 Which three are true? (Choose three.)‏ A. An abstract class CANNOT be instantiated. B. An interface can extend multiple interfaces. C. All methods in an abstract class must be abstract. D. If abstract class B directly extends abstract class A, class B must implement all abstract methods declared in A. E. If concrete class C extends concrete class B, and B implements interface A, then all methods from interface A can be invoked on an instance of C.
QUESTION  07 Which two are true? (Choose two.)‏ A. An abstract class can implement an interface.  B. An abstract class can be extended by an interface. C. An interface can be extended by an abstract class. D. An interface CANNOT be extended by another interface. E. An abstract class can be extended by a concrete class. F. An abstract class CANNOT be extended by an abstract class.
QUESTION  08 Given: 1. abstract class A {} 2. class B {} 3. interface C {} 4. interface D {} 5. // insert code here Which, inserted at line 5, results in a compilation failure? A. class E extends A {} B. class E extends A, B {} C. class E implements C {} D. class E implements C, D {} E. interface E extends C, D {} F. class E extends B implements D {}
QUESTION  09 Which two are true about the relationship "A keyboard has 101 keys."? (Choose two.)‏ A. This is a one-to-one relationship. B. This is a composition relationship. C. This is a one-to-many relationship. D. This is a many-to-many relationship. E. This is a not a composition relationship.
QUESTION  10 Exhibit: Which correctly implements the relationship shown in the diagram?  A. class Cat { Dog d; } class Dog {  Cat c; } B. class Cat { } class Dog {  cat c; } C. class Cat { Dog d; } class Dog { } D. class Cat { } class Dog { }
QUESTION  11 You are asked to create a Dog class that exposes the Dog class String name and int breed to other code as read-only attributes, provides encapsulation, and adheres to the standard JavaBeans naming conventions. Which approach implements these requirements?  A. Provide public getName()/setName() and public getBreed()/setBreed() methods in the Dog class, and mark the name and breed instance variables private. B. Provide private name() and private breed() methods in the Dog class, and mark the name and breed instance variables public. C. Provide public getName() and public getBreed() methods in the Dog class, and mark the name and breed instance variables private. D. Provide public name() and public breed() methods in the Dog class, and mark the name and breed instance variables private. E. Provide private getName() and private  getBreed () methods in the Dog class, and mark the name and breed instance variables private.
QUESTION  12 Given: 1. class Exam { 2. private int num = 0; 3. public int getNum() { 4. return num;  5. } 6. } 7. public class Sample { 8. public static void main(String[] args) { 9. Exam e = new exam (); 10. e.num = 100; 11. int num = e.getNum(); 12. System.out.print1n("The number is: " + num); 13. } 14. } What is the result? A. Compilation fails. B. The number is: 0 C. The number is: 100 D. An exception is thrown at runtime.
QUESTION  13 Given: 1. public class Boat{ 2. // insert code here 3. public void setGas(int v){ 4. gas = v; 5. } 6. } Which, inserted at line 2, is valid and demonstrates encapsulation?  A. struct int gas; B. public int gas; C. private int gas; D. protected int gas;
QUESTION  14 Given: 1. // insert code here 2. void play(); 3. void stop(); 4. } 5. // insert code here 6. public void play() { } 7. public void stop() { } 8. } Which, inserted at lines 1 and 5, allows the code to compile? A. 1. interface Player { 5. class DVDPlayer implements Player { B. 1. implements Player { 5. class DVDPlayer interface Player { C. 1. class Player { 5. interface DVDPlayer implements Player { D. 1. interface Player {  5. class DVDPlayer extends Player { E. 1. abstract class Player { 5. class DVDPlayer extends Player {
QUESTION  15 Given: 3. interface Pet { 4. void eat(); 5. } 6. class Dog implements Pet { public void eat() { } } 7. class Beagle extends Dog { public void eat() { } } Which demonstrates the "program to an interface" principle?  A. class PetFood { public void go(Pet p) { p.eat(); } } B. class PetFood { public void go(Dog d) { d.eat(); } } C. class PetFood { public void go(Beagle b) { b.eat(); } } D. class PetFood extends Pet { public void go(PetFood d) { d.eat(); } } E. interface PetFood implements Pet { public void go(Pet d) { d.eat(); } }
Respostas 01.ABCD 02.CD 03.ABD 04.AB 05.BCDE 06.ABE 07.AE 08.B 09.BC 10.A 11.A 12.C 13.C 14.A 15.A
QUESTION  01 Which four are primitive integer types in Java? (Choose four.)‏ A. int B. byte C. long D. char E. float F. String G. Integer
QUESTION  02 Which two compile without error? (Choose two.)‏ A. boolean b =  0; B. float f = 3.14; C. double d = 1000; D. char c = '0078';
QUESTION  03 Which three are legal ways to declare and initialize an instance variable? (Choose three.)‏ A. static int x = 42; B. public int x = 'c';  C. public int x =  null; D. public Integer f = null; E. static integer f = new integer (42);  F. public integer f = new integer(42);
QUESTION  04 Which two are valid? (Choose two.)‏ A. enum Suit { CLUBS, DIAMONDS, HEARTS, SPADES }  class EnumTest { public static void main(String args[]) { System.out.println(Suit.CLUBS); } } B. class EnumTest { public static void main(String args[]) { enum Num { ONE, TWO, THREE, FOUR } System.out.println(Num.ONE); } } C. class EnumTest { enum Colors { Red = 1, Green = 2, Blue = 4, Yellow = 8 } public static void main(String args[]) { System.out.println(Colors.Red); } } D. class EnumTest { enum Days { Sat, Sun, Mon, Tue, Wed, Thu, Fri } public static void main(String args[]) { System.out.println(days.Sat); }
QUESTION  05 Given: 1. class Variables { 2. int i; 3. String s; 4. Object o; 5. String g = null; 6. Integer y; 7. char c; 8. } Which four are object references? (Choose four.)‏ A. i B. s C. o D. g E. y F. c
QUESTION  06 Which three are true? (Choose three.)‏ A. An abstract class CANNOT be instantiated. B. An interface can extend multiple interfaces. C. All methods in an abstract class must be abstract. D. If abstract class B directly extends abstract class A, class B must implement all abstract methods declared in A. E. If concrete class C extends concrete class B, and B implements interface A, then all methods from interface A can be invoked on an instance of C.
QUESTION  07 Which two are true? (Choose two.)‏ A. An abstract class can implement an interface.  B. An abstract class can be extended by an interface. C. An interface can be extended by an abstract class. D. An interface CANNOT be extended by another interface. E. An abstract class can be extended by a concrete class. F. An abstract class CANNOT be extended by an abstract class.
QUESTION  08 Given: 1. abstract class A {} 2. class B {} 3. interface C {} 4. interface D {} 5. // insert code here Which, inserted at line 5, results in a compilation failure? A. class E extends A {} B. class E extends A, B {} C. class E implements C {} D. class E implements C, D {} E. interface E extends C, D {} F. class E extends B implements D {}
QUESTION  09 Which two are true about the relationship "A keyboard has 101 keys."? (Choose two.)‏ A. This is a one-to-one relationship. B. This is a composition relationship. C. This is a one-to-many relationship. D. This is a many-to-many relationship. E. This is a not a composition relationship.
QUESTION  10 Exhibit: Which correctly implements the relationship shown in the diagram?  A. class Cat { Dog d; } class Dog {  Cat c; } B. class Cat { } class Dog {  cat c; } C. class Cat { Dog d; } class Dog { } D. class Cat { } class Dog { }
QUESTION  11 You are asked to create a Dog class that exposes the Dog class String name and int breed to other code as read-only attributes, provides encapsulation, and adheres to the standard JavaBeans naming conventions. Which approach implements these requirements?  A. Provide public getName()/setName() and public getBreed()/setBreed() methods in the Dog class, and mark the name and breed instance variables private. B. Provide private name() and private breed() methods in the Dog class, and mark the name and breed instance variables public. C. Provide public getName() and public getBreed() methods in the Dog class, and mark the name and breed instance variables private. D. Provide public name() and public breed() methods in the Dog class, and mark the name and breed instance variables private. E. Provide private getName() and private  getBreed () methods in the Dog class, and mark the name and breed instance variables private.
QUESTION  12 Given: 1. class Exam { 2. private int num = 0; 3. public int getNum() { 4. return num;  5. } 6. } 7. public class Sample { 8. public static void main(String[] args) { 9. Exam e = new exam (); 10. e.num = 100; 11. int num = e.getNum(); 12. System.out.print1n("The number is: " + num); 13. } 14. } What is the result? A. Compilation fails. B. The number is: 0 C. The number is: 100 D. An exception is thrown at runtime.
QUESTION  13 Given: 1. public class Boat{ 2. // insert code here 3. public void setGas(int v){ 4. gas = v; 5. } 6. } Which, inserted at line 2, is valid and demonstrates encapsulation?  A. struct int gas; B. public int gas; C. private int gas; D. protected int gas;
QUESTION  14 Given: 1. // insert code here 2. void play(); 3. void stop(); 4. } 5. // insert code here 6. public void play() { } 7. public void stop() { } 8. } Which, inserted at lines 1 and 5, allows the code to compile? A. 1. interface Player { 5. class DVDPlayer implements Player { B. 1. implements Player { 5. class DVDPlayer interface Player { C. 1. class Player { 5. interface DVDPlayer implements Player { D. 1. interface Player {  5. class DVDPlayer extends Player { E. 1. abstract class Player { 5. class DVDPlayer extends Player {
QUESTION  15 Given: 3. interface Pet { 4. void eat(); 5. } 6. class Dog implements Pet { public void eat() { } } 7. class Beagle extends Dog { public void eat() { } } Which demonstrates the "program to an interface" principle?  A. class PetFood { public void go(Pet p) { p.eat(); } } B. class PetFood { public void go(Dog d) { d.eat(); } } C. class PetFood { public void go(Beagle b) { b.eat(); } } D. class PetFood extends Pet { public void go(PetFood d) { d.eat(); } } E. interface PetFood implements Pet { public void go(Pet d) { d.eat(); } }

More Related Content

What's hot

20.1 Java working with abstraction
20.1 Java working with abstraction20.1 Java working with abstraction
20.1 Java working with abstraction
Intro C# Book
 
14. Defining Classes
14. Defining Classes14. Defining Classes
14. Defining Classes
Intro C# Book
 
T1
T1T1
T1
lksoo
 
Java level 1 Quizzes
Java level 1 QuizzesJava level 1 Quizzes
Java level 1 QuizzesSteven Luo
 
14. Java defining classes
14. Java defining classes14. Java defining classes
14. Java defining classes
Intro C# Book
 
Lecture 7 arrays
Lecture   7 arraysLecture   7 arrays
Lecture 7 arrays
manish kumar
 
1z0 804 exam-java se 7 programmer ii
1z0 804 exam-java se 7 programmer ii1z0 804 exam-java se 7 programmer ii
1z0 804 exam-java se 7 programmer ii
Isabella789
 
Chapter 4:Object-Oriented Basic Concepts
Chapter 4:Object-Oriented Basic ConceptsChapter 4:Object-Oriented Basic Concepts
Chapter 4:Object-Oriented Basic Concepts
It Academy
 
11. Java Objects and classes
11. Java  Objects and classes11. Java  Objects and classes
11. Java Objects and classes
Intro C# Book
 
Chapter 7:Understanding Class Inheritance
Chapter 7:Understanding Class InheritanceChapter 7:Understanding Class Inheritance
Chapter 7:Understanding Class Inheritance
It Academy
 
L04 Software Design 2
L04 Software Design 2L04 Software Design 2
L04 Software Design 2
Ólafur Andri Ragnarsson
 
java tutorial 2
 java tutorial 2 java tutorial 2
java tutorial 2
Tushar Desarda
 
Lecture 5 Inheritance
Lecture 5 InheritanceLecture 5 Inheritance
Lecture 5 Inheritancebunnykhan
 
Implementation of interface9 cm604.30
Implementation of interface9 cm604.30Implementation of interface9 cm604.30
Implementation of interface9 cm604.30myrajendra
 
Abstract classes and interfaces
Abstract classes and interfacesAbstract classes and interfaces
Abstract classes and interfaces
Sérgio Souza Costa
 
Object oriented concepts
Object oriented conceptsObject oriented concepts
Object oriented concepts
Gousalya Ramachandran
 
Code smells and remedies
Code smells and remediesCode smells and remedies
Code smells and remedies
Md.Mojibul Hoque
 

What's hot (19)

20.1 Java working with abstraction
20.1 Java working with abstraction20.1 Java working with abstraction
20.1 Java working with abstraction
 
Qno 2 (a)
Qno 2 (a)Qno 2 (a)
Qno 2 (a)
 
14. Defining Classes
14. Defining Classes14. Defining Classes
14. Defining Classes
 
T1
T1T1
T1
 
Java level 1 Quizzes
Java level 1 QuizzesJava level 1 Quizzes
Java level 1 Quizzes
 
14. Java defining classes
14. Java defining classes14. Java defining classes
14. Java defining classes
 
Lecture 7 arrays
Lecture   7 arraysLecture   7 arrays
Lecture 7 arrays
 
1z0 804 exam-java se 7 programmer ii
1z0 804 exam-java se 7 programmer ii1z0 804 exam-java se 7 programmer ii
1z0 804 exam-java se 7 programmer ii
 
Chapter 4:Object-Oriented Basic Concepts
Chapter 4:Object-Oriented Basic ConceptsChapter 4:Object-Oriented Basic Concepts
Chapter 4:Object-Oriented Basic Concepts
 
11. Java Objects and classes
11. Java  Objects and classes11. Java  Objects and classes
11. Java Objects and classes
 
Chapter 7:Understanding Class Inheritance
Chapter 7:Understanding Class InheritanceChapter 7:Understanding Class Inheritance
Chapter 7:Understanding Class Inheritance
 
L04 Software Design 2
L04 Software Design 2L04 Software Design 2
L04 Software Design 2
 
java tutorial 2
 java tutorial 2 java tutorial 2
java tutorial 2
 
Lecture 5 Inheritance
Lecture 5 InheritanceLecture 5 Inheritance
Lecture 5 Inheritance
 
Implementation of interface9 cm604.30
Implementation of interface9 cm604.30Implementation of interface9 cm604.30
Implementation of interface9 cm604.30
 
Abstract classes and interfaces
Abstract classes and interfacesAbstract classes and interfaces
Abstract classes and interfaces
 
Object oriented concepts
Object oriented conceptsObject oriented concepts
Object oriented concepts
 
Code smells and remedies
Code smells and remediesCode smells and remedies
Code smells and remedies
 
05slide
05slide05slide
05slide
 

Viewers also liked

Enrichment For E Learning
Enrichment For E LearningEnrichment For E Learning
Enrichment For E Learningz.jonesrizzi
 
Mardi Gras
Mardi GrasMardi Gras
Mardi Gras306844
 
NicolePowerPointPresentation
NicolePowerPointPresentationNicolePowerPointPresentation
NicolePowerPointPresentationguest07ef16
 
Interactive
InteractiveInteractive
Interactive306844
 
Mardi Gras
Mardi GrasMardi Gras
Mardi Gras306844
 
Interactive
InteractiveInteractive
Interactive306844
 
CT of Pheochromocytoma: Findings in Symptomatic & Incidentally Discovered Tumors
CT of Pheochromocytoma: Findings in Symptomatic & Incidentally Discovered TumorsCT of Pheochromocytoma: Findings in Symptomatic & Incidentally Discovered Tumors
CT of Pheochromocytoma: Findings in Symptomatic & Incidentally Discovered TumorsGaspar Alberto Motta Ramírez
 
Intrabdominal renal mass
Intrabdominal renal massIntrabdominal renal mass
Intrabdominal renal mass
Gaspar Alberto Motta Ramírez
 
I Nte Racti Ve T Hi Ng Y U No
I Nte Racti Ve T Hi Ng Y U NoI Nte Racti Ve T Hi Ng Y U No
I Nte Racti Ve T Hi Ng Y U NoAlejandraBecerra
 
Gcse French Revision Speaking
Gcse French Revision SpeakingGcse French Revision Speaking
Gcse French Revision Speakingsaby777
 
Gcse French Revision Listening
Gcse French Revision ListeningGcse French Revision Listening
Gcse French Revision Listeningsaby777
 

Viewers also liked (14)

Enrichment For E Learning
Enrichment For E LearningEnrichment For E Learning
Enrichment For E Learning
 
Mardi Gras
Mardi GrasMardi Gras
Mardi Gras
 
NicolePowerPointPresentation
NicolePowerPointPresentationNicolePowerPointPresentation
NicolePowerPointPresentation
 
Interactive
InteractiveInteractive
Interactive
 
Sonrie
SonrieSonrie
Sonrie
 
Mardi Gras
Mardi GrasMardi Gras
Mardi Gras
 
Interactive
InteractiveInteractive
Interactive
 
CT of Pheochromocytoma: Findings in Symptomatic & Incidentally Discovered Tumors
CT of Pheochromocytoma: Findings in Symptomatic & Incidentally Discovered TumorsCT of Pheochromocytoma: Findings in Symptomatic & Incidentally Discovered Tumors
CT of Pheochromocytoma: Findings in Symptomatic & Incidentally Discovered Tumors
 
Intrabdominal renal mass
Intrabdominal renal massIntrabdominal renal mass
Intrabdominal renal mass
 
I Nte Racti Ve T Hi Ng Y U No
I Nte Racti Ve T Hi Ng Y U NoI Nte Racti Ve T Hi Ng Y U No
I Nte Racti Ve T Hi Ng Y U No
 
Gcse French Revision Speaking
Gcse French Revision SpeakingGcse French Revision Speaking
Gcse French Revision Speaking
 
Alimentos
AlimentosAlimentos
Alimentos
 
Gcse French Revision Listening
Gcse French Revision ListeningGcse French Revision Listening
Gcse French Revision Listening
 
Objetos Discapacitados
Objetos DiscapacitadosObjetos Discapacitados
Objetos Discapacitados
 

Similar to Conceitos Fundamentais de Orientação a Objetos

Core java
Core javaCore java
Core java
prabhatjon
 
Indus Valley Partner aptitude questions and answers
Indus Valley Partner aptitude questions and answersIndus Valley Partner aptitude questions and answers
Indus Valley Partner aptitude questions and answers
Sushant Choudhary
 
Oracle Certified Associate (OCA) Java SE 8 Programmer II (1Z0-809) - Practice...
Oracle Certified Associate (OCA) Java SE 8 Programmer II (1Z0-809) - Practice...Oracle Certified Associate (OCA) Java SE 8 Programmer II (1Z0-809) - Practice...
Oracle Certified Associate (OCA) Java SE 8 Programmer II (1Z0-809) - Practice...
Udayan Khattry
 
1z0-808-certification-questions-sample
1z0-808-certification-questions-sample1z0-808-certification-questions-sample
1z0-808-certification-questions-sample
java8certificationquestions
 
Simulado java se 7 programmer
Simulado java se 7 programmerSimulado java se 7 programmer
Simulado java se 7 programmer
Miguel Vilaca
 
MX Server is my friend
MX Server is my friendMX Server is my friend
MX Server is my friend
Gabriel Daty
 
MX Server is my friend
MX Server is my friendMX Server is my friend
MX Server is my friend
Gabriel Daty
 
MX Server is my friend
MX Server is my friendMX Server is my friend
MX Server is my friend
Gabriel Daty
 
MX Server is my friend
MX Server is my friendMX Server is my friend
MX Server is my friend
Gabriel Daty
 
Examf cs-cs141-2-17
Examf cs-cs141-2-17Examf cs-cs141-2-17
Examf cs-cs141-2-17
Fahadaio
 
Let's talk about Certifications
Let's talk about CertificationsLet's talk about Certifications
Let's talk about Certifications
José Maria Silveira Neto
 
CORE JAVA
CORE JAVACORE JAVA
CORE JAVA
Shohan Ahmed
 
Java Questions and Answers
Java Questions and AnswersJava Questions and Answers
Java Questions and Answers
Rumman Ansari
 
2 object orientation-copy
2 object orientation-copy2 object orientation-copy
2 object orientation-copyJoel Campos
 
Fnt software solutions placement paper
Fnt software solutions placement paperFnt software solutions placement paper
Fnt software solutions placement paperfntsofttech
 
FSOFT - Test Java Exam
FSOFT - Test Java ExamFSOFT - Test Java Exam
FSOFT - Test Java Exam
Nguyễn Đăng Đức
 

Similar to Conceitos Fundamentais de Orientação a Objetos (20)

Core java
Core javaCore java
Core java
 
Indus Valley Partner aptitude questions and answers
Indus Valley Partner aptitude questions and answersIndus Valley Partner aptitude questions and answers
Indus Valley Partner aptitude questions and answers
 
Oracle Certified Associate (OCA) Java SE 8 Programmer II (1Z0-809) - Practice...
Oracle Certified Associate (OCA) Java SE 8 Programmer II (1Z0-809) - Practice...Oracle Certified Associate (OCA) Java SE 8 Programmer II (1Z0-809) - Practice...
Oracle Certified Associate (OCA) Java SE 8 Programmer II (1Z0-809) - Practice...
 
Scjp6.0
Scjp6.0Scjp6.0
Scjp6.0
 
1z0-808-certification-questions-sample
1z0-808-certification-questions-sample1z0-808-certification-questions-sample
1z0-808-certification-questions-sample
 
Simulado java se 7 programmer
Simulado java se 7 programmerSimulado java se 7 programmer
Simulado java se 7 programmer
 
MX Server is my friend
MX Server is my friendMX Server is my friend
MX Server is my friend
 
MX Server is my friend
MX Server is my friendMX Server is my friend
MX Server is my friend
 
MX Server is my friend
MX Server is my friendMX Server is my friend
MX Server is my friend
 
MX Server is my friend
MX Server is my friendMX Server is my friend
MX Server is my friend
 
1
11
1
 
Examf cs-cs141-2-17
Examf cs-cs141-2-17Examf cs-cs141-2-17
Examf cs-cs141-2-17
 
Let's talk about Certifications
Let's talk about CertificationsLet's talk about Certifications
Let's talk about Certifications
 
CORE JAVA
CORE JAVACORE JAVA
CORE JAVA
 
Java Questions and Answers
Java Questions and AnswersJava Questions and Answers
Java Questions and Answers
 
7
77
7
 
2 object orientation-copy
2 object orientation-copy2 object orientation-copy
2 object orientation-copy
 
Fnt software solutions placement paper
Fnt software solutions placement paperFnt software solutions placement paper
Fnt software solutions placement paper
 
Core java Essentials
Core java EssentialsCore java Essentials
Core java Essentials
 
FSOFT - Test Java Exam
FSOFT - Test Java ExamFSOFT - Test Java Exam
FSOFT - Test Java Exam
 

Recently uploaded

FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
Elena Simperl
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Thierry Lestable
 
ODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User Group
CatarinaPereira64715
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Inflectra
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
Product School
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
Product School
 
"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi
Fwdays
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
Prayukth K V
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Jeffrey Haguewood
 
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptxIOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
Abida Shariff
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
Elena Simperl
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Product School
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
 

Recently uploaded (20)

FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
 
ODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User Group
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
 
"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
 
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptxIOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 

Conceitos Fundamentais de Orientação a Objetos

  • 1. Conceitos Fundamentais de Orientação a Objetos. Grupo de Estudo de Java Joselito Seção 1
  • 2.
  • 3. QUESTION 01 Which four are primitive integer types in Java? (Choose four.)‏ A. int B. byte C. long D. char E. float F. String G. Integer
  • 4. QUESTION 02 Which two compile without error? (Choose two.)‏ A. boolean b = 0; B. float f = 3.14; C. double d = 1000; D. char c = '0078';
  • 5. QUESTION 03 Which three are legal ways to declare and initialize an instance variable? (Choose three.)‏ A. static int x = 42; B. public int x = 'c'; C. public int x = null; D. public Integer f = null; E. static integer f = new integer (42); F. public integer f = new integer(42);
  • 6. QUESTION 04 Which two are valid? (Choose two.)‏ A. enum Suit { CLUBS, DIAMONDS, HEARTS, SPADES } class EnumTest { public static void main(String args[]) { System.out.println(Suit.CLUBS); } } B. class EnumTest { public static void main(String args[]) { enum Num { ONE, TWO, THREE, FOUR } System.out.println(Num.ONE); } } C. class EnumTest { enum Colors { Red = 1, Green = 2, Blue = 4, Yellow = 8 } public static void main(String args[]) { System.out.println(Colors.Red); } } D. class EnumTest { enum Days { Sat, Sun, Mon, Tue, Wed, Thu, Fri } public static void main(String args[]) { System.out.println(days.Sat); }
  • 7. QUESTION 05 Given: 1. class Variables { 2. int i; 3. String s; 4. Object o; 5. String g = null; 6. Integer y; 7. char c; 8. } Which four are object references? (Choose four.)‏ A. i B. s C. o D. g E. y F. c
  • 8. QUESTION 06 Which three are true? (Choose three.)‏ A. An abstract class CANNOT be instantiated. B. An interface can extend multiple interfaces. C. All methods in an abstract class must be abstract. D. If abstract class B directly extends abstract class A, class B must implement all abstract methods declared in A. E. If concrete class C extends concrete class B, and B implements interface A, then all methods from interface A can be invoked on an instance of C.
  • 9. QUESTION 07 Which two are true? (Choose two.)‏ A. An abstract class can implement an interface. B. An abstract class can be extended by an interface. C. An interface can be extended by an abstract class. D. An interface CANNOT be extended by another interface. E. An abstract class can be extended by a concrete class. F. An abstract class CANNOT be extended by an abstract class.
  • 10. QUESTION 08 Given: 1. abstract class A {} 2. class B {} 3. interface C {} 4. interface D {} 5. // insert code here Which, inserted at line 5, results in a compilation failure? A. class E extends A {} B. class E extends A, B {} C. class E implements C {} D. class E implements C, D {} E. interface E extends C, D {} F. class E extends B implements D {}
  • 11. QUESTION 09 Which two are true about the relationship "A keyboard has 101 keys."? (Choose two.)‏ A. This is a one-to-one relationship. B. This is a composition relationship. C. This is a one-to-many relationship. D. This is a many-to-many relationship. E. This is a not a composition relationship.
  • 12. QUESTION 10 Exhibit: Which correctly implements the relationship shown in the diagram? A. class Cat { Dog d; } class Dog { Cat c; } B. class Cat { } class Dog { cat c; } C. class Cat { Dog d; } class Dog { } D. class Cat { } class Dog { }
  • 13. QUESTION 11 You are asked to create a Dog class that exposes the Dog class String name and int breed to other code as read-only attributes, provides encapsulation, and adheres to the standard JavaBeans naming conventions. Which approach implements these requirements? A. Provide public getName()/setName() and public getBreed()/setBreed() methods in the Dog class, and mark the name and breed instance variables private. B. Provide private name() and private breed() methods in the Dog class, and mark the name and breed instance variables public. C. Provide public getName() and public getBreed() methods in the Dog class, and mark the name and breed instance variables private. D. Provide public name() and public breed() methods in the Dog class, and mark the name and breed instance variables private. E. Provide private getName() and private getBreed () methods in the Dog class, and mark the name and breed instance variables private.
  • 14. QUESTION 12 Given: 1. class Exam { 2. private int num = 0; 3. public int getNum() { 4. return num; 5. } 6. } 7. public class Sample { 8. public static void main(String[] args) { 9. Exam e = new exam (); 10. e.num = 100; 11. int num = e.getNum(); 12. System.out.print1n("The number is: " + num); 13. } 14. } What is the result? A. Compilation fails. B. The number is: 0 C. The number is: 100 D. An exception is thrown at runtime.
  • 15. QUESTION 13 Given: 1. public class Boat{ 2. // insert code here 3. public void setGas(int v){ 4. gas = v; 5. } 6. } Which, inserted at line 2, is valid and demonstrates encapsulation? A. struct int gas; B. public int gas; C. private int gas; D. protected int gas;
  • 16. QUESTION 14 Given: 1. // insert code here 2. void play(); 3. void stop(); 4. } 5. // insert code here 6. public void play() { } 7. public void stop() { } 8. } Which, inserted at lines 1 and 5, allows the code to compile? A. 1. interface Player { 5. class DVDPlayer implements Player { B. 1. implements Player { 5. class DVDPlayer interface Player { C. 1. class Player { 5. interface DVDPlayer implements Player { D. 1. interface Player { 5. class DVDPlayer extends Player { E. 1. abstract class Player { 5. class DVDPlayer extends Player {
  • 17. QUESTION 15 Given: 3. interface Pet { 4. void eat(); 5. } 6. class Dog implements Pet { public void eat() { } } 7. class Beagle extends Dog { public void eat() { } } Which demonstrates the "program to an interface" principle? A. class PetFood { public void go(Pet p) { p.eat(); } } B. class PetFood { public void go(Dog d) { d.eat(); } } C. class PetFood { public void go(Beagle b) { b.eat(); } } D. class PetFood extends Pet { public void go(PetFood d) { d.eat(); } } E. interface PetFood implements Pet { public void go(Pet d) { d.eat(); } }
  • 18. Respostas 01.ABCD 02.CD 03.ABD 04.AB 05.BCDE 06.ABE 07.AE 08.B 09.BC 10.A 11.A 12.C 13.C 14.A 15.A
  • 19. QUESTION 01 Which four are primitive integer types in Java? (Choose four.)‏ A. int B. byte C. long D. char E. float F. String G. Integer
  • 20. QUESTION 02 Which two compile without error? (Choose two.)‏ A. boolean b = 0; B. float f = 3.14; C. double d = 1000; D. char c = '0078';
  • 21. QUESTION 03 Which three are legal ways to declare and initialize an instance variable? (Choose three.)‏ A. static int x = 42; B. public int x = 'c'; C. public int x = null; D. public Integer f = null; E. static integer f = new integer (42); F. public integer f = new integer(42);
  • 22. QUESTION 04 Which two are valid? (Choose two.)‏ A. enum Suit { CLUBS, DIAMONDS, HEARTS, SPADES } class EnumTest { public static void main(String args[]) { System.out.println(Suit.CLUBS); } } B. class EnumTest { public static void main(String args[]) { enum Num { ONE, TWO, THREE, FOUR } System.out.println(Num.ONE); } } C. class EnumTest { enum Colors { Red = 1, Green = 2, Blue = 4, Yellow = 8 } public static void main(String args[]) { System.out.println(Colors.Red); } } D. class EnumTest { enum Days { Sat, Sun, Mon, Tue, Wed, Thu, Fri } public static void main(String args[]) { System.out.println(days.Sat); }
  • 23. QUESTION 05 Given: 1. class Variables { 2. int i; 3. String s; 4. Object o; 5. String g = null; 6. Integer y; 7. char c; 8. } Which four are object references? (Choose four.)‏ A. i B. s C. o D. g E. y F. c
  • 24. QUESTION 06 Which three are true? (Choose three.)‏ A. An abstract class CANNOT be instantiated. B. An interface can extend multiple interfaces. C. All methods in an abstract class must be abstract. D. If abstract class B directly extends abstract class A, class B must implement all abstract methods declared in A. E. If concrete class C extends concrete class B, and B implements interface A, then all methods from interface A can be invoked on an instance of C.
  • 25. QUESTION 07 Which two are true? (Choose two.)‏ A. An abstract class can implement an interface. B. An abstract class can be extended by an interface. C. An interface can be extended by an abstract class. D. An interface CANNOT be extended by another interface. E. An abstract class can be extended by a concrete class. F. An abstract class CANNOT be extended by an abstract class.
  • 26. QUESTION 08 Given: 1. abstract class A {} 2. class B {} 3. interface C {} 4. interface D {} 5. // insert code here Which, inserted at line 5, results in a compilation failure? A. class E extends A {} B. class E extends A, B {} C. class E implements C {} D. class E implements C, D {} E. interface E extends C, D {} F. class E extends B implements D {}
  • 27. QUESTION 09 Which two are true about the relationship "A keyboard has 101 keys."? (Choose two.)‏ A. This is a one-to-one relationship. B. This is a composition relationship. C. This is a one-to-many relationship. D. This is a many-to-many relationship. E. This is a not a composition relationship.
  • 28. QUESTION 10 Exhibit: Which correctly implements the relationship shown in the diagram? A. class Cat { Dog d; } class Dog { Cat c; } B. class Cat { } class Dog { cat c; } C. class Cat { Dog d; } class Dog { } D. class Cat { } class Dog { }
  • 29. QUESTION 11 You are asked to create a Dog class that exposes the Dog class String name and int breed to other code as read-only attributes, provides encapsulation, and adheres to the standard JavaBeans naming conventions. Which approach implements these requirements? A. Provide public getName()/setName() and public getBreed()/setBreed() methods in the Dog class, and mark the name and breed instance variables private. B. Provide private name() and private breed() methods in the Dog class, and mark the name and breed instance variables public. C. Provide public getName() and public getBreed() methods in the Dog class, and mark the name and breed instance variables private. D. Provide public name() and public breed() methods in the Dog class, and mark the name and breed instance variables private. E. Provide private getName() and private getBreed () methods in the Dog class, and mark the name and breed instance variables private.
  • 30. QUESTION 12 Given: 1. class Exam { 2. private int num = 0; 3. public int getNum() { 4. return num; 5. } 6. } 7. public class Sample { 8. public static void main(String[] args) { 9. Exam e = new exam (); 10. e.num = 100; 11. int num = e.getNum(); 12. System.out.print1n("The number is: " + num); 13. } 14. } What is the result? A. Compilation fails. B. The number is: 0 C. The number is: 100 D. An exception is thrown at runtime.
  • 31. QUESTION 13 Given: 1. public class Boat{ 2. // insert code here 3. public void setGas(int v){ 4. gas = v; 5. } 6. } Which, inserted at line 2, is valid and demonstrates encapsulation? A. struct int gas; B. public int gas; C. private int gas; D. protected int gas;
  • 32. QUESTION 14 Given: 1. // insert code here 2. void play(); 3. void stop(); 4. } 5. // insert code here 6. public void play() { } 7. public void stop() { } 8. } Which, inserted at lines 1 and 5, allows the code to compile? A. 1. interface Player { 5. class DVDPlayer implements Player { B. 1. implements Player { 5. class DVDPlayer interface Player { C. 1. class Player { 5. interface DVDPlayer implements Player { D. 1. interface Player { 5. class DVDPlayer extends Player { E. 1. abstract class Player { 5. class DVDPlayer extends Player {
  • 33. QUESTION 15 Given: 3. interface Pet { 4. void eat(); 5. } 6. class Dog implements Pet { public void eat() { } } 7. class Beagle extends Dog { public void eat() { } } Which demonstrates the "program to an interface" principle? A. class PetFood { public void go(Pet p) { p.eat(); } } B. class PetFood { public void go(Dog d) { d.eat(); } } C. class PetFood { public void go(Beagle b) { b.eat(); } } D. class PetFood extends Pet { public void go(PetFood d) { d.eat(); } } E. interface PetFood implements Pet { public void go(Pet d) { d.eat(); } }