Programski Jezici 1.Kol

Reviewed by Editorial Team
The ProProfs editorial team is comprised of experienced subject matter experts. They've collectively created over 10,000 quizzes and lessons, serving over 100 million users. Our team includes in-house content moderators and subject matter experts, as well as a global network of rigorously trained contributors. All adhere to our comprehensive editorial guidelines, ensuring the delivery of high-quality content.
Learn about Our Editorial Process
| By Akacadjo
A
Akacadjo
Community Contributor
Quizzes Created: 1 | Total Attempts: 423
| Attempts: 423 | Pitanja: 52
Please wait...

Question 1 / 52
0 %
0/100
Score 0/100
1. Kako se klasa definise kao apstraktna?

Explanation

An abstract class is defined by adding the keyword "abstract" in the class header. This indicates that the class cannot be instantiated and may contain abstract methods, which are methods without a body. By adding the "abstract" keyword, it is explicitly stating that the class is abstract.

Submit
Please wait...
About This Quiz
Programski Jezici 1.Kol - Quiz

2. Ukoliko zelimo da sprecimo dalje izvodjenje iz nase klase, u njenom zaglavlju se mora staviti kljucna rec:

Explanation

The correct answer is "final". In Java, the "final" keyword is used to prevent further derivation or extension of a class. When a class is declared as "final", it cannot be subclassed or inherited by any other class. This is useful when we want to ensure that the class remains unchanged and cannot be modified or extended by other developers.

Submit
3. Ukoliko u programu imamo klase Vozilo, PutnickoVozilo i TeretnoVozilo, koja je najverovatnija organizacija klasa?

Explanation

The most likely organization of classes is that the class "Vozilo" is the base class, while "PutnickoVozilo" and "TeretnoVozilo" are derived classes from the class "Vozilo". This means that "PutnickoVozilo" and "TeretnoVozilo" inherit properties and methods from the base class "Vozilo".

Submit
4. Ako zelimo da omogucimo koriscenje  objekta nase klase kao da je tekstualni podatak tipa String, potrebno je da definisemo sledeci metod u nasoj klasi

Explanation

The correct answer is "toString". In order to enable the use of an object of our class as if it were a String data type, we need to define the toString method in our class. This method is used to convert an object to its string representation, allowing it to be used as a String.

Submit
5. Koja klasa se nalazi na vrhu hijerarhije klasa u javi?

Explanation

The correct answer is "Object". In Java, the Object class is at the top of the class hierarchy. This means that all other classes in Java are subclasses of the Object class, either directly or indirectly. The Object class provides common methods and behaviors that are inherited by all other classes, such as toString(), equals(), and hashCode(). Therefore, Object is the most general and fundamental class in Java.

Submit
6. Sta je izlaz sledeceg programa u Javi:   class Roditelj { void prikazi()  {    System.out.println("Roditelj");   } } class Dete extends Roditelj { void prikazi()   {     System.out.println("Dete");   }   public static void main(String args[])  {   Roditelj r = new Dete();   r.prikazi();   } }

Explanation

The output of the program is "Dete" because the main method creates an object of the Dete class and assigns it to a reference variable of type Roditelj. When the prikazi() method is called on this object, the version of the method defined in the Dete class is executed, which prints "Dete" to the console. This demonstrates polymorphism, where a subclass object can be assigned to a superclass reference variable and the appropriate method is called based on the actual type of the object.

Submit
7. Sta se radi sa objektom koji vise nije potreban u programu?

Explanation

In Java, objects that are no longer needed in the program are automatically removed by the Garbage Collection process. This process identifies and collects objects that are no longer referenced by any part of the program, freeing up the memory allocated to those objects. This automated process helps in managing memory efficiently and eliminates the need for manual removal of objects.

Submit
8. Kako se klasa definise kao apstraktna?

Explanation

The correct answer is "Ubacivanjem kljucne reci abstract u zaglavlje klase" (By inserting the keyword abstract in the class header). This is because when the abstract keyword is used in the class header, it indicates that the class is abstract. An abstract class is a class that cannot be instantiated and is meant to be subclassed. It can contain abstract methods, which are methods without a body, and concrete methods with implementations.

Submit
9. U programu se moze proveravati da li dati objekat pripada odredjenoj klasi, sa logickim operatorom:

Explanation

The correct answer is instanceof. The instanceof operator is used in programming to check if an object belongs to a specific class. It returns true if the object is an instance of the specified class or any of its subclasses, and false otherwise. This operator is commonly used in object-oriented programming languages to perform type checking and determine the class hierarchy of objects.

Submit
10. Ukoliko nam neki objekat vise nije potreban u programu, kako to eksplicitno mozemo ukazati?

Explanation

In Java, when an object is no longer needed in the program, we can explicitly indicate this by assigning the reference to null. This means that the reference no longer points to any object, allowing the Java garbage collector to eventually remove the object from memory. This is a common practice to free up memory and optimize the performance of the program.

Submit
11. Da li je dozvoljeno napisati sledeci kod u Javi:   class Sabiranje {   void saberi(int a, int b)    {      System.out.println(a+b);     }    void saberi(int a, int b, int c)//change no of arguments i.e 3    {     System.out.println(a+b+c);    } }

Explanation

The given code is allowed in Java because it demonstrates a classic example of method overloading. The two methods in the class "Sabiranje" have the same name but different parameter lists, which is allowed in method overloading. This means that the methods can be called with different arguments, and the appropriate method will be executed based on the number and types of the arguments. Therefore, the code is valid and demonstrates the concept of method overloading.

Submit
12. Da li je u Javi dozvoljeno da catch blok bude prazan?   try { ... } catch (Exception e) {     }

Explanation

It is allowed to have an empty catch block in Java, but it is not considered good practice because the purpose of the catch block is to handle and recover from the exception. Without any code inside the catch block, the exception will not be handled or recovered from, which can lead to unexpected behavior or errors in the program. It is recommended to at least print the error message by using e.getMessage() to provide some information about the exception.

Submit
13. Sta ce na standardnom izlazu ispisati sledeci kod?   class Student{     private String ime;     private String jmbg;     private int godinaUpisa;       public Student(String ime, String jmbg, int godinaUpisa) {           this.ime = ime;           this.jmbg = jmbg;           this.godinaUpisa = godinaUpisa;     }       public Student(String ime, String jmbg) {          this(ime, jmbg, 2018);     }      public void ispisi() {          System.out.println("Ime:  " +ime+ ", jmbg: " +jmbg+ ", godina upisa: " +godinaUpisa);    } }   public class Test {     public static void main(String[] args) {          Student a = new Student("Pera", "25252525012501");          a.ispisi();     } }

Explanation

The code creates an instance of the Student class with the name "Pera" and the JMBG "25252525012501". The constructor used is the one that takes in the name, JMBG, and year of enrollment as parameters. Since the year of enrollment is not provided, the default value of 2018 is used. The ispisi() method is then called on the created instance, which prints out the name, JMBG, and year of enrollment as "Ime: Pera, jmbg: 25252525012501, godina upisa: 2018".

Submit
14. Ukoliko zelimo da obezbedimo mogucnost sortiranja objekata nase klase (na primer metodom Arrays.sort() ), moramo uraditi sledece stvari:

Explanation

The correct answer is that the class must implement the Comparable interface and define the compareTo() method. This is because the compareTo() method is used by the sorting algorithm to compare objects and determine their order. By implementing the Comparable interface and providing the compareTo() method, we allow the sorting method (e.g. Arrays.sort()) to correctly sort objects of our class based on our specified criteria.

Submit
15. Sta ce na standardnom izlazu ispisati sledeci kod?   final class A    {         int i;     }   class B extends A {          int j;          void display(){                  System.out.println(j + " " + i);          } }   class inheritance {          public static void main(String args[])         {                 B obj = new B();                 obj.dispaly();          } }

Explanation

The program will not compile because class B is trying to inherit from a final class A.

Submit
16. Posmatra se sledeci kod. Sta ce biti ispisano na standardnom izlazu kao rezultat rada programa?   final class Complex {        private final double re;      private final double im; } public String ispisi() {     return "( " +  re  + " +  "+ im + "i)";    } }   class Main {    public static void main(String args[])    {         Complex c = new Complex(10, 15);         System.out.println(c);     } }  

Explanation

The program will output "Complex@8e2fb5 (8e2fb5 is the hashcode of object c)". This is because when we try to print an object directly, it will call the toString() method of the object. Since the Complex class does not have a toString() method, it will use the default implementation from the Object class, which returns the class name followed by the hashcode of the object.

Submit
17. Kod nasledjivanja klasa, kada nova klasa prosiruje postojecu klasu, za novu klasu vazi:

Explanation

When a new class extends an existing class in inheritance, the new class inherits all the fields and methods of the existing class. This means that the new class can access and use all the variables and functions that are defined in the existing class. There is no restriction on the visibility of the fields and methods being inherited, so both protected and public fields and methods are inherited by the new class. However, private fields and methods are not inherited. Therefore, the correct answer is "Nasledjuje sva polja i metode postojece klase" which translates to "It inherits all the fields and methods of the existing class".

Submit
18. Ako postoji  statican metod test unutar klase ispit, na koji nacin se taj metod poziva  u programu?

Explanation

The correct answer is "Metod se poziva naredbom Ispit.test(), bez potrebe da se prvo instancira objekat klase ispit." This means that the method can be called directly using the class name followed by the method name, without the need to create an instance of the class.

Submit
19. Data je definicija klase Student:   class Student {      private String name;      public String getName() { return name; }      public void setName(String name) { this.name = name; } }   Sta ce biti ispisano na standardnom izlazu nakon izvrsenja sledeveg koda?   class Test {      public static void main(String args[])      {            Student student = new Student();            student.setName("Bob");              Student studentClone = student;              studentClone.setName("Alice");            System.out.println(student.getName());       } }  

Explanation

The code creates an instance of the Student class and sets its name to "Bob". Then, a reference variable studentClone is created and assigned the same memory address as student. When the name of studentClone is changed to "Alice", it also changes the name of the original student object. Therefore, when the code prints the name of the student object, it will be "Alice".

Submit
20. Koliko konstrukrora moze imati klasa?

Explanation

The correct answer states that a class can have one or more constructors, but all of them must have different signatures. This means that a class can have multiple ways of being instantiated, each with different parameters. The requirement for different signatures ensures that the constructors can be differentiated and called appropriately based on the arguments provided.

Submit
21. Princip podtipa u Javi obezbedjuje da:

Explanation

This answer correctly states the principle of subtype polymorphism in Java. It means that an object of a derived class (subtype) can always be used where an object of its base class (supertype) is expected. This is a fundamental concept in object-oriented programming, as it allows for code reusability and flexibility by treating objects of different derived classes as objects of their common base class.

Submit
22. Da li su sledece definicije klase u Javi ispravne:   abstract class A { } class B extends A { } final class C extends B { } final class D extends C { }

Explanation

The class D is incorrectly defined because it extends the class C which is final.

Submit
23. Tekuca instanca klase, odnosno promenljiva klasnog tipa koja u trenutku poziva metode dobija vrednost reference na objekat za koji je metoda pozvana, u Javi se oznacava sa kljucnomreci:

Explanation

In Java, the keyword "this" is used to refer to the current instance of a class. It is used to access the members (variables and methods) of the current object. By using "this", we can differentiate between the instance variables and parameters with the same name. It is commonly used in constructors and setter methods to set the values of instance variables.

Submit
24. Kako se naziva proces definisanja vise od jedne metode sa istim  imenom unutar iste klase?

Explanation

The correct answer is "Preopterecenje metoda (overload)". This term refers to the process of defining multiple methods with the same name but different parameters within the same class. Overloading allows for more flexibility and versatility in programming, as it enables the same method name to be used for different purposes based on the input parameters. This helps to improve code readability and maintainability.

Submit
25. Date su definicije klase A i klase B u Javi?   public class A public void say() {    System.out.print("Hello from an instance of the class A!"); }   public class B extends A { public void say()   {       System.out.print("Hello from an instance of the class B!");    } }   Sta ce biti ispisano na standardnom izlazu posle izvrsenja sledeceg koda u main metodi? A a = new B(); a.say();    

Explanation

The correct answer is "Hello from an instance of the class B!" because the code creates an object of class B and assigns it to a reference of type A. Since class B extends class A and overrides the say() method, when the say() method is called on the object, it will execute the version of the method defined in class B, which prints "Hello from an instance of the class B!"

Submit
26. public class MyClass {   int i;   public MyClass(){/code/}   public MyClass(int i){/code}  //more code... }   Kako se moze kreirati objekat ove klase?  

Explanation

The correct answer is MyClass mc = new MyClass(i);. This is because the class MyClass has two constructors - a default constructor with no parameters and another constructor with an int parameter. Therefore, we can create an object of this class by using the constructor with the int parameter and passing the desired value for the parameter. The other options are incorrect because they either do not use the correct constructor or have incorrect syntax.

Submit
27. Sta ce na standardnom izlazu ispisati sledeci kod?   class A {      private int i;      protected int j;      A() {           i=1;           j=2;      } }   public class Test {       public static void main(String[] args) {             A a1 = new A();             B b1 = new A();              System.out.println(a1.equals(a2));       } }

Explanation

The code will not compile because the class A does not have a declaration for class B. Therefore, the line "B b1 = new A();" will cause a compilation error.

Submit
28. Oznaci sintaksno ispravna zaglavlja klase ( pretpostavlja se da sve nasledjene klase i interfejsi postoje):

Explanation

The correct answer is a combination of three options. The first option "public class MyClassSub extends MyClass implements MyInterface{}" is syntactically correct because it extends the class MyClass and implements the interface MyInterface. The second option "public class MyClass{}" is also correct as it defines the class MyClass. The third option "public class MyClassSub extends MyClass{}" is also valid as it extends the class MyClass. Therefore, the correct answer includes all three options.

Submit
29. Posmatra se metoda:   public int podeli (int a, int b) {    if(b==0) throw new ArithmeticException ("Pokusaj deljenje sa nulom");    return a/b; }   Da li je metoda ispravno definisana, odnosno  da li ce moci  da se kompajlira?

Explanation

The given method is not correctly defined because it is missing a clause in the method header to indicate that it can throw an exception of type IllegalArgumentException.

Submit
30. U sledecem kodu:    public class MyVlacc { private int value; public void setValue(int i){ / kod  / } }   Metod setValue dodeljuje vrednost promenljive i atributu value. Koji od sledecih delova koda se moze napisati u telu metode da bi se definisala ovakva metoda?

Explanation

The correct answer is "value=i;" and "this.value=i;". In order to assign the value of the parameter "i" to the attribute "value", we can use either "value=i;" or "this.value=i;". Both statements achieve the desired result of assigning the value of "i" to the attribute "value".

Submit
31. Za pristup clanovima bazne klase koji su zaklonjeni clanovima izvedene klase, korsiti se kljucna rec:

Explanation

The correct answer is "super". In object-oriented programming, the "super" keyword is used to access members of the base class that are hidden by members of the derived class. It allows the derived class to call the overridden method or constructor of the base class. By using "super", the derived class can access and use the functionality of the base class while still being able to override or extend it.

Submit
32. Konkretna klasa koja implementira dati interfejs A, mora da:

Explanation

The correct answer is "eksplicitno deklarise u zaglavlju klase da implementira interfejs A kljucnom reci implements, definise sve metode iz interfejsa A". This is because in order for a specific class to implement a given interface, it must explicitly declare in the class header that it implements interface A using the keyword "implements". Additionally, the class must define all the methods from interface A.

Submit
33. Sta ce na standardnom izlazu ispisati sledeci kod?   class exception_handling;? {      public static void main(String args[])      {            try           {                  int a, b;                  b = 0;                  a = 5 / b;                  System.out.print("A");           }          catch(ArithmeticException e)          {                System.out.print("B");            }     } } 

Explanation

The correct answer is B because when the code is executed, an ArithmeticException is thrown due to the division by zero (5/0). This exception is caught by the catch block that specifically handles ArithmeticException. Therefore, "B" is printed on the standard output.

Submit
34. Promenljive tipa apstraktne klase mogu pokazivati na koje objekte?

Explanation

Variables of an abstract class type can point to objects of both the specific abstract class and objects of classes derived from that abstract class.

Submit
35. Sta od ponudjenih odgovora predstavlja ispravan konstruktor za klasu Radnik?

Explanation

The correct answers for the given question are "Radnik (Radnik r) { }" and "Radnik () { }". These are the correct constructors for the class "Radnik". The first constructor takes an object of type "Radnik" as a parameter, which allows for creating a new object based on an existing one. The second constructor is a default constructor with no parameters, which allows for creating a new object without any initial values.

Submit
36. Sta ce na standardnom izlazu ispisati sledeci kod:   class box {            int width;            int height;            int lenght; }   class mainclass {        public static void main(String args[]) {                 box obj = new box();               obj.height = 1;               obj.lenght = 2;               obj.width = 1;                  System.out.println(obj.toString());         } }  

Explanation

The code creates an object of the "box" class and assigns values to its height, length, and width attributes. Then, it uses the toString() method to print the object. Since the "box" class does not have a custom implementation of the toString() method, the default implementation is used, which prints the class name followed by the object's hash code. Therefore, the output will be "imeKlase@hashcode".

Submit
37. Klasa A je definisana na sledeci nacin:   abstract class A{}   Sta je rezultat sledeceg koda?   public class Test {   public static void main(String[] args) {        A a = new A();   } }

Explanation

The correct answer is "Greska prilikom prevodjenja programa, ne moze se instancirati apstraktna klasa". This is because class A is defined as an abstract class, which means it cannot be instantiated directly. Abstract classes are meant to be extended by other classes, and objects can only be created from concrete subclasses of the abstract class. Therefore, attempting to create an object of type A will result in a compilation error.

Submit
38. Sta ce biti ispisano na standardnom izlazu nakon izvrsenja sledeceg koda?   class A {     int i;     public void display()     {       System.out.println(i);      } }   class B extends A {      int j;      public B( int i, int j){         this.i=i;         tihs.j=j;      }      public void display()     {         System.out.println(j);      } } class Test {      public static void main(String args[])      {          B obj2 = new B(1,2);          A r = obj2;          r.display();       } }

Explanation

The code will result in a compilation error because the class A does not have a defined constructor.

Submit
39. U Javi, polimorfizam se manifestuje kroz:

Explanation

Polimorfizam se manifestuje kroz princip podtipa, preopterećenje i nadjačavanje metoda. Princip podtipa se odnosi na mogućnost korišćenja objekata izvedenih klasa kao objekata baznih klasa. Preopterećenje metoda se odnosi na mogućnost definisanja više metoda sa istim imenom, ali sa različitim parametrima. Nadjačavanje metoda se odnosi na mogućnost da izvedena klasa implementira metodu koju je već definisala bazna klasa, ali sa drugačijom implementacijom.

Submit
40. _______ postoje u programu klasa Vozilo i klasa Automobil izvedena iz klase Vozilo:   clasas Vozilo { ..... }   class Automobil extends Vozilo { .... }   Da li je dozvoljeno napisati sledece u main metodi:   Automobil a = new Automobil(); Vozilo v = a; Automobil b = v;

Explanation

The given code snippet is attempting to assign an object of type Vozilo to a variable of type Automobil without explicit type conversion. In Java, when assigning objects to variables of different types, explicit type conversion is required if the assignment is not directly compatible. In this case, since Vozilo is the superclass of Automobil, the assignment from Automobil to Vozilo is allowed. However, the assignment from Vozilo to Automobil is not allowed without explicit type conversion. Therefore, it is not allowed to assign an object of type Vozilo to a variable of type Automobil without explicit type conversion.

Submit
41. Definisana je klasa A na sledeci nacin:   class A {      int a;      int b;      public A (int a, int b) {           this.a = a;           this.b = b;      }      public boolean equal (A second)      {           if(this.a==second.a && this.b==second.b)                 return true;           else                 return false;        } }   Sta je rezultat izvrsenja sledeceg koda:   A a1 = new A(2,1); A a2 = new A(2,1); if(a1==a2) System.out.println("Sa==su jednaki."); else System.out.println("Sa==nisu jednaki.");   if(a1.equal(a2)) System.out.println("Sa equal su jednaki."); else System.out.println("Sa equal nisu jednaki.");

Explanation

The code creates two objects of class A, a1 and a2, with the same values for the variables a and b. However, when comparing the objects using the "==" operator, it checks if the two object references are pointing to the same memory location, which is not the case here. Therefore, the condition "a1==a2" evaluates to false and the statement "Sa==nisu jednaki." is printed.

On the other hand, when using the "equal" method defined in class A, it compares the values of the variables a and b of the two objects. Since the values are the same, the condition "a1.equal(a2)" evaluates to true and the statement "Sa equal su jednaki." is printed.

Submit
42. Sta je neispravno u sledecem kodu:   abstract class xy {        abstract sum ( int x, int y ) { } }

Explanation

The given code does not define a constructor. In Java, every class should have at least one constructor, either explicitly defined or implicitly provided by the compiler. Since the abstract class "xy" does not have a constructor, it is considered incorrect.

Submit
43. Ako   class Zivotinja {  } class Ljubimac extends Zivotinja {}   public class Test {    public static void main(String[] args) {        Ljubimac lj = new Ljubimac();        Zivotinja z = new Zivotinja();        ubacen kod      } }   KOje od sledecih komandi se mogu ubaciti na oznaceno mesto?  

Explanation

The correct answers are "Ljubimac a1 = lj;", "Zivotinja z1 = new Ljubimac();", and "Zivotinja z2 = lj;". These statements are valid because they involve creating objects of the appropriate classes and assigning them to variables of compatible types. "Ljubimac a1 = lj;" is valid because a Ljubimac object can be assigned to a Ljubimac variable. "Zivotinja z1 = new Ljubimac();" is valid because a Ljubimac object can be assigned to a Zivotinja variable. "Zivotinja z2 = lj;" is valid because a Ljubimac object can be assigned to a Zivotinja variable.

Submit
44. Koje od navedenih tvrdnji su tacne za staticke metode?

Explanation

Static methods can be called in a program independently of the objects of their class, meaning that they can be accessed without creating an instance of the class. Additionally, static methods can only access static fields, as they do not have access to object-specific fields.

Submit
45. Dinamicko vezivanje se obavlja po kom jednostavnom pravilu?

Explanation

Dynamic binding refers to the process of determining which overridden method will be called for a class variable. In dynamic binding, the method that is called depends on the actual type of the object that the variable points to, regardless of the declared type of the variable. Therefore, the correct answer states that the overridden method that is called for a class variable depends on the actual type of the object it points to, regardless of the declared type.

Submit
46. class Osoba {     private String ime;     private String jmbg;         public Osoba(String ime, String jmbg) {           this.ime = ime;           this.jmbg = jmbg;     }   class Student extends Osoba {       private int godinaUpisa;         public Student(String ime, String jmbg, int godinaUpisa) {                 this.ime = ime;            this.jmbg = jmbg;            this godinaUpisa = godinaUpisa;     }      public void ispisi() {          System.out.println("Ime:  " + ime + ", jmbg: " + jmbg + ", godina upisa: " + godinaUpisa);    } }   public class Test {     public static void main(String[] args) {          Student a = new Student("Pera", "25252525012501", 2018);          a.ispisi();     } }

Explanation

The correct answer is "Program se nece kompajlirati, greska je u konstruktoru klase Student". This is because in the constructor of the Student class, there is a syntax error where the keyword "this" is missing before the variable "godinaUpisa". This causes a compilation error and the program will not be able to run. Additionally, the answer also states that there is an error in the method "ispisi" of the Student class, but this is incorrect as there is no error in that method.

Submit
47. Enkapsulacija je vazan objektno orijentisani princip, za koji vaze:

Explanation

The correct answer states that encapsulation is an important object-oriented principle that involves allowing access to the values of class fields only through public methods, protecting all fields and internal methods within the class, allowing them to be modified only in a controlled manner, and hiding all object fields of the class. This ensures that the internal implementation of the class cannot be changed without affecting the programs that use it.

Submit
48. Ukoliko je apstraktna klasa A definisana sa apstraktnom metodom metodaA(), a klasa B nasledjuje klasu A, koje tvrdnje su tacne?

Explanation

If class B implements methodA(), it means that it provides a concrete implementation of the abstract method defined in class A. In this case, class B is a concrete class that can be instantiated. On the other hand, if class B does not implement methodA(), it must also be defined as abstract and cannot be instantiated.

Submit
49. Koje tvrdnje su tacne za interfejse:

Explanation

Interfejsi se sastoje od skupa apstraktnih metoda bez implementacije, što znači da samo deklarišu metode koje treba implementirati u klasama koje ih implementiraju. Ovo omogućava da se definiše zajednički skup metoda koje klase moraju implementirati, ali ne definiše njihovu konkretne implementaciju. Takođe, interfejsi omogućavaju klasama da implementiraju više interfejsa, što pruža slične mogućnosti kao višestruko nasleđivanje.

Submit
50. Koje od navedenih tvrdnji su tacne za apstraktne klase:

Explanation

An abstract class must have one or more abstract methods. An abstract class can contain a main method. An abstract class can have static methods. An abstract class can implement an interface. However, an abstract class cannot be defined with the final modifier in the class header.

Submit
51. Koje od sledecih tvrdnji su tacne za nasledjivanje klasa:

Explanation

The first statement is correct because members of a base class declared with the protected modifier are not accessible in derived classes outside of the package. The second statement is correct because it is not possible to override a method that is declared as private in the base class. The third statement is incorrect because methods in the base class declared with the private modifier do not behave the same as if they were defined as final. The fourth statement is incorrect because methods in the base class declared with the protected modifier do not behave the same as if they were defined as final. The fifth statement is correct because members of a base class with the protected modifier are accessible in the package code and in all classes that are derived from the base class, even if they are outside of that package.

Submit
52. Koje tvrdnje za definisanje klase su tacne?

Explanation

The correct answer states that class data members can be protected or public, class data members that are methods must be defined within the class body, and class data members can be both variables and methods.

Submit
View My Results

Quiz Review Timeline (Updated): Mar 16, 2023 +

Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.

  • Current Version
  • Mar 16, 2023
    Quiz Edited by
    ProProfs Editorial Team
  • Sep 06, 2018
    Quiz Created by
    Akacadjo
Cancel
  • All
    All (52)
  • Unanswered
    Unanswered ()
  • Answered
    Answered ()
Kako se klasa definise kao apstraktna?
Ukoliko zelimo da sprecimo dalje izvodjenje iz nase klase, u njenom...
Ukoliko u programu imamo klase Vozilo, PutnickoVozilo i TeretnoVozilo,...
Ako zelimo da omogucimo koriscenje  objekta nase klase kao da je...
Koja klasa se nalazi na vrhu hijerarhije klasa u javi?
Sta je izlaz sledeceg programa u Javi: ...
Sta se radi sa objektom koji vise nije potreban u programu?
Kako se klasa definise kao apstraktna?
U programu se moze proveravati da li dati objekat pripada odredjenoj...
Ukoliko nam neki objekat vise nije potreban u programu, kako to...
Da li je dozvoljeno napisati sledeci kod u Javi: ...
Da li je u Javi dozvoljeno da catch blok bude prazan? ...
Sta ce na standardnom izlazu ispisati sledeci kod? ...
Ukoliko zelimo da obezbedimo mogucnost sortiranja objekata nase klase...
Sta ce na standardnom izlazu ispisati sledeci kod? ...
Posmatra se sledeci kod. Sta ce biti ispisano na standardnom izlazu...
Kod nasledjivanja klasa, kada nova klasa prosiruje postojecu klasu, za...
Ako postoji  statican metod test unutar klase ispit, na koji...
Data je definicija klase Student: ...
Koliko konstrukrora moze imati klasa?
Princip podtipa u Javi obezbedjuje da:
Da li su sledece definicije klase u Javi ispravne: ...
Tekuca instanca klase, odnosno promenljiva klasnog tipa koja u...
Kako se naziva proces definisanja vise od jedne metode sa istim ...
Date su definicije klase A i klase B u Javi? ...
Public class MyClass ...
Sta ce na standardnom izlazu ispisati sledeci kod? ...
Oznaci sintaksno ispravna zaglavlja klase ( pretpostavlja se da sve...
Posmatra se metoda: ...
U sledecem kodu:  ...
Za pristup clanovima bazne klase koji su zaklonjeni clanovima izvedene...
Konkretna klasa koja implementira dati interfejs A, mora da:
Sta ce na standardnom izlazu ispisati sledeci kod? ...
Promenljive tipa apstraktne klase mogu pokazivati na koje objekte?
Sta od ponudjenih odgovora predstavlja ispravan konstruktor za klasu...
Sta ce na standardnom izlazu ispisati sledeci kod: ...
Klasa A je definisana na sledeci nacin: ...
Sta ce biti ispisano na standardnom izlazu nakon izvrsenja sledeceg...
U Javi, polimorfizam se manifestuje kroz:
_______ postoje u programu klasa Vozilo i klasa Automobil izvedena iz...
Definisana je klasa A na sledeci nacin: ...
Sta je neispravno u sledecem kodu: ...
Ako ...
Koje od navedenih tvrdnji su tacne za staticke metode?
Dinamicko vezivanje se obavlja po kom jednostavnom pravilu?
Class Osoba { ...
Enkapsulacija je vazan objektno orijentisani princip, za koji vaze:
Ukoliko je apstraktna klasa A definisana sa apstraktnom metodom...
Koje tvrdnje su tacne za interfejse:
Koje od navedenih tvrdnji su tacne za apstraktne klase:
Koje od sledecih tvrdnji su tacne za nasledjivanje klasa:
Koje tvrdnje za definisanje klase su tacne?
Alert!

Advertisement