Facebook Twitter Instagram
    • Home
    • About
    Facebook Twitter Instagram
    latest:Home»Education»UoPeople CS 1102-01 Programming 1 – AY2024-T4 Review Quiz Answers
    Education

    UoPeople CS 1102-01 Programming 1 – AY2024-T4 Review Quiz Answers

    By adminJune 9, 2024No Comments12 Mins Read
    In our blog post, we delve into the comprehensive review quiz questions and answers from UoPeople’s CS 1102-01 Programming 1 course, offering invaluable insights and reinforcement of key concepts. Whether you’re a seasoned coder seeking to brush up on foundational knowledge or a newcomer eager to dive into the world of programming, this review is an essential resource for honing your skills and understanding.

    Started on
    StateFinished
    Completed on
    Time taken10 mins 50 secs
    Marks40.00/40.00
    Grade100.00 out of 100.00

    Question 1

    Correct
    Mark 1.00 out of 1.00

    Question text

    Which of the following is not a valid Java identifier?
    Question 1Answer

    a.

    myVariable

    b.

    _variable

    c.

    123variable

    d.

    $variable

    Question 2

    Correct
    Mark 1.00 out of 1.00

    Question text

    Which interface in the Collection Hierarchy maps keys to values and does not allow duplicate keys?
    Question 2Answer

    a.

    List

    b.

    Set

    c.

    Map

    d.

    Iterator

    Question 3

    Correct
    Mark 1.00 out of 1.00

    Question text

    What is the purpose of method overloading in Java?
    Question 3Answer

    a.

    To override superclass methods with more specific implementations.

    b.

    To create multiple methods with the same name but different parameters.

    c.

    To limit the number of methods in a class.

    d.

    To restrict method access to subclasses only.

    Question 4

    Correct
    Mark 1.00 out of 1.00

    Question text

    Which of the following is the correct way to declare and initialize an array in Java?

    CLICK HERE TO JOIN BINGMAT TELEGRAM CHANNEL FOR ALL FREE ANSWERS Join Now
    CLICK HERE TO JOIN BINGMAT WHATSAPP CHANNEL FOR ALL FREE ANSWERS Join Now

    a. int[ ] numbers = new int[5] {1, 2, 3, 4, 5};

    b. int[ ] numbers = {1, 2, 3, 4, 5};

    c.  int numbers[ ] = new int[ ]{1, 2, 3, 4, 5};

    d.  int numbers = [1, 2, 3, 4, 5];

     

    Question 4Answer

    a.

    Option a and Option b

    b.

    Option b and Option c

    c.

    Option c

    d.

    Option b

    Feedback

    Your answer is correct.

    Question 5

    Correct
    Mark 1.00 out of 1.00

    Question text

    What is the result of the following code snippet?

    int x = 10;

    int y = 5;

    boolean result = (x > y) && (x != y);

    System.out.println(result);

    Question 5Answer

    a.

    True

    b.

    False

    c.

    10

    d.

    5

    Feedback

    Your answer is correct.

    Question 6

    Correct
    Mark 1.00 out of 1.00

    Question text

    What is the purpose of the Iterator interface in the Collection Hierarchy?
    Question 6Answer

    a.

    To provide a way to iterate over the elements of a collection

    b.

    To enforce immutability on the collection

    c.

    To define a generic type for the collection

    d.

    To enable parallel processing of the collection

    Question 7

    Correct
    Mark 1.00 out of 1.00

    Question text

    Which of the following statements is true about static nested classes?
    Question 7Answer

    a.

    They can access non-static methods and variables of the outer class directly.

    b.

    They can be instantiated without an instance of the outer class.

    c.

    They can only be declared within static methods.

    d.

    They can be inherited by the subclasses of the outer class.

    Question 8

    Correct
    Mark 1.00 out of 1.00

    Question text

    What is the output of the following code snippet?

                   for (int i = 0; i <= 10; i += 2) {

                 System.out.print(i + ” “);

                   }

    Question 8Answer

    a.

    0 2 4 6 8 10

    b.

    2 4 6 8 10

    c.

    0 2 4 6 8

    d.

    2 4 6 8

    Feedback

    Your answer is correct.
    Also Read  Barclay College (Kansas): Programs, Requirements, and How to Apply

    Question 9

    Correct
    Mark 1.00 out of 1.00

    Question text

    What is the output of the following code snippet?

     

    int[ ] numbers = new int[5];

    System.out.println(numbers[3]);

     

     

    Question 9Answer

    a.

    0

    b.

    null

    c.

    error

    d.

    ArrayIndexOutOfBoundsException

    Feedback

    Your answer is correct.

    Question 10

    Correct
    Mark 1.00 out of 1.00

    Question text

    In OOP, what is the purpose of the “this” keyword?
    Question 10Answer

    a.

    To reference the current object within a method

    b.

    To declare a variable with class scope

    c.

    To instantiate a new object

    d.

    To define a constructor for the class

    Question 11

    Correct
    Mark 1.00 out of 1.00

    Question text

    What happens when an instance variable with the same name as a static variable is declared in a class?
    Question 11Answer

    a.

    The instance variable shadows the static variable.

    b.

    The static variable shadows the instance variable.

    c.

    Both variables are accessible without any conflict.

    d.

    It causes a compilation error.

    Question 12

    Correct
    Mark 1.00 out of 1.00

    Question text

    In Java, method overloading allows developers to:
    Question 12Answer

    a.

    Override a method inherited from a superclass.

    b.

    Define multiple methods with the same name but different return types.

    c.

    Define multiple methods with the same name but different access modifiers.

    d.

    Define multiple methods with the same name but different parameters.

    Question 13

    Correct
    Mark 1.00 out of 1.00

    Question text

    Which of the following code snippets correctly demonstrates the creation of an object in Java?

     

    Question 13Answer

    a.

     

    new Object();

     

    b.

    Object obj = Object();

    c.

    Object obj = new Object;

    d.

    Object obj = new Object();

    Feedback

    Your answer is correct.

    Question 14

    Correct
    Mark 1.00 out of 1.00

    Question text

    Which of the following is the correct way to declare a constant variable in Java?

    Question 14Answer

    a.

    final int PI = 3.14;

    b.

    const int PI = 3.14;

    c.

    int PI = 3.14;

    d.

    static int PI = 3.14;

    Feedback

    Your answer is correct.

    Question 15

    Correct
    Mark 1.00 out of 1.00

    Question text

    Which of the following is an advantage of using static methods and variables?
    Question 15Answer

    a.

    They allow for better encapsulation and information hiding.

    b.

    They can be overridden in the subclass for polymorphism.

    c.

    They can be accessed without creating an instance of a class.

    d.

    They allow for dynamic binding and late binding.

    Question 16

    Correct
    Mark 1.00 out of 1.00

    Question text

    In Java, what is the benefit of using inheritance?
    Question 16Answer

    a.

    It allows for code reuse and promotes a hierarchical structure.

    b.

    It eliminates the need for polymorphism.

    c.

    It makes code more complex and harder to maintain.

    d.

    It reduces the performance of the program.

    Question 17

    Correct
    Mark 1.00 out of 1.00

    Question text

    What is the output of the following code snippet?

    int i = 0;

    do {

        if (i == 3)

            continue;

        System.out.print(i + ” “);

        i++;

    } while (i < 5);

    Question 17Answer

    a.

    0 1 2 3 4

    b.

    1 2 3 4

    c.

    0 1 2

    d.

    0 1 2 3

    Feedback

    Your answer is correct.

    Question 18

    Correct
    Mark 1.00 out of 1.00

    Question text

    Which JavaFX class is used to display a web page?
    Question 18Answer

    a.

    WebView

    b.

    WebPane

    c.

    WebDisplay

    d.

    WebBrowser
    Also Read  Universidade Estadual de Campinas (Unicamp): Programs, Requirements, and How to Apply

    Question 19

    Correct
    Mark 1.00 out of 1.00

    Question text

    Which keyword is used to prevent a method from being overridden in the subclass?
    Question 19Answer

    a.

    final

    b.

    static

    c.

    abstract

    d.

    private

    Question 20

    Correct
    Mark 1.00 out of 1.00

    Question text

    What is the output of the following code snippet?

           int i = 0;

    outer:

    while (i < 5) {

        inner:

        for (int j = 0; j < 3; j++) {

            if (i == 3)

                break outer;

            if (j == 2)

                continue inner;

            System.out.print(i + j + ” “);

        }

        i++;

    }

    Question 20Answer

    a.

    0 1 2 3 4 5 6 7

    b.

    0 1 1 2 2 3

    c.

    0 1 2 3 4 5

    d.

    0 1 2 4 5 6 7 8

    Feedback

    Your answer is correct.

    Question 21

    Correct
    Mark 1.00 out of 1.00

    Question text

    How are constructors used in object-oriented programming?
    Question 21Answer

    a.

    To define attributes and methods of an object

    b.

    To allocate memory for object variables

    c.

    To initialize object attributes with predefined values

    d.

    To establish communication between classes

    Question 22

    Correct
    Mark 1.00 out of 1.00

    Question text

    What is the output of the following code snippet?

     

    ArrayList<String> fruits = new ArrayList<>();

    fruits.add(“Apple”);

    fruits.add(“Orange”);

    fruits.add(“Banana”);

    System.out.println(fruits.size());

     

     

    Question 22Answer

    a.

    1

    b.

    2

    c.

    3

    d.

    0

    Feedback

    Your answer is correct.

    Question 23

    Correct
    Mark 1.00 out of 1.00

    Question text

    Which of the following statements about inheritance and polymorphism is true in Java?
    Question 23Answer

    a.

    Inheritance and polymorphism are independent concepts and do not impact each other.

    b.

    Inheritance is a prerequisite for polymorphism.

    c.

    Polymorphism can only be achieved through method overloading.

    d.

    Inheritance and polymorphism cannot be used together in the same program.

    Question 24

    Correct
    Mark 1.00 out of 1.00

    Question text

    What is the output of the following code snippet?

    int x = 5;

    int y = 2;

    int result = x % y;

    System.out.println(result);

    Question 24Answer

    a.

    3

    b.

    2

    c.

    1

    d.

    0

    Feedback

    Your answer is correct.

    Question 25

    Correct
    Mark 1.00 out of 1.00
     

    Question text

    To differentiate between a static method and a non-static (instance) method, you would primarily: 
    Question 25Answer

    a.

    Test their execution time

    b.

    Verify their return type

    c.

    Determine their association with class or instances

    d.

    Relate them to their superclass

    Question 26

    Correct
    Mark 1.00 out of 1.00
     

    Question text

    How can you create a tool tip in Java Swing?
    Question 26Answer

    a.

    By calling the setToolTipText() method on the component and passing the tool tip text.

    b.

    By creating an instance of the ToolTip class and setting its text property.

    c.

    By calling the addToolTip() method on the component and passing a ToolTip object.

    d.

    By using the ToolTipManager class to manage tool tips for the component.

    Question 27

    Correct
    Mark 1.00 out of 1.00
     

    Question text

    What is the purpose of a JavaFX scene graph?
    Question 27Answer

    a.

    It defines the structure and layout of a user interface.

    b.

    It represents the hierarchical structure of all the visual elements in a JavaFX application.

    c.

    It manages the rendering and animation of visual elements in a JavaFX application.

    d.

    It handles all the user events and actions in a JavaFX application.
    Also Read  Universidade Estadual de Campinas (Unicamp): Programs, Requirements, and How to Apply

    Question 28

    Correct
    Mark 1.00 out of 1.00
     

    Question text

    Which layout manager in Java Swing allows components to be arranged in a stack-like manner?
    Question 28Answer

    a.

    FlowLayout

    b.

    BorderLayout

    c.

    CardLayout

    d.

    BoxLayout

    Question 29

    Correct
    Mark 1.00 out of 1.00
     

    Question text

    The process of defining a new class based on an existing class is known as:
    Question 29Answer

    a.

    Inheritance

    b.

    Polymorphism

    c.

    Encapsulation

    d.

    Abstraction

    Question 30

    Correct
    Mark 1.00 out of 1.00
     

    Question text

    Which method is used to replace the element at a specific index in an ArrayList in Java?
    Question 30Answer

    a.

    set()

    b.

    replace()

    c.

    modify()

    d.

    assign()

    Question 31

    Correct
    Mark 1.00 out of 1.00
     

    Question text

    Which access modifier allows a class member to be accessed only within the same class?
    Question 31Answer

    a.

    public

    b.

    private

    c.

    protected

    d.

    default (no modifier)

    Question 32

    Correct
    Mark 1.00 out of 1.00
     

    Question text

    What is the output of the following code snippet?

     

    int[] numbers = {5, 2, 7, 1, 8};

    Arrays.sort(numbers);

    System.out.println(numbers[2]);

     

     

    Question 32Answer

    a.

    5

    b.

    7

    c.

    2

    d.

    1

    Feedback

    Your answer is correct.

    Question 33

    Correct
    Mark 1.00 out of 1.00
     

    Question text

    What is the output of the following code snippet?

    int[ ] numbers = {5, 2, 8, 1, 3};

    Arrays.sort(numbers);

    System.out.println(numbers[0]);

     

    Question 33Answer

    a.

    1

    b.

    2

    c.

    3

    d.

    5

    Feedback

    Your answer is correct.

    Question 34

    Correct
    Mark 1.00 out of 1.00

    Question text

    Which method of the Thread class is used to check if a thread is still active and running?
    Question 34Answer

    a.

    isAlive()

    b.

    isActive()

    c.

    isRunning()

    d.

    isExecuting()

    Question 35

    Correct
    Mark 1.00 out of 1.00

    Question text

    Which Stream API operation is used to apply a function to each element and transform it into another element?
    Question 35Answer

    a.

    map()

    b.

    filter()

    c.

    reduce()

    d.

    collect()

    Question 36

    Correct
    Mark 1.00 out of 1.00
     

    Question text

    Which interface in the Collection Hierarchy allows duplicate elements and maintains insertion order?
    Question 36Answer

    a.

    List

    b.

    Set

    c.

    Map

    d.

    Iterator

    Question 37

    Correct
    Mark 1.00 out of 1.00
     

    Question text

    When using a do-while loop, the code block is executed:
    Question 37Answer

    a.

    zero or more times

    b.

    at least once

    c.

    based on a specific condition

    d.

    until the loop variable reaches a certain value

    Question 38

    Correct
    Mark 1.00 out of 1.00

    Question text

    What is the significance of inheritance in object-oriented programming?
    Question 38Answer

    a.

    It allows objects to communicate with each other.

    b.

    It ensures that attributes and methods are defined within a class.

    c.

    It enables the creation of subclasses that inherit characteristics from a parent class.

    d.

    It facilitates the encapsulation of data and behavior within objects.

    Question 39

    Correct
    Mark 1.00 out of 1.00

    Question text

    Which JavaFX class is used to display text and images?
    Question 39Answer

    a.

    Text

    b.

    Label

    c.

    Button

    d.

    Image

    Question 40

    Correct
    Mark 1.00 out of 1.00

    Question text

    Which keyword is used to skip the remaining code in the loop and continue with the next iteration?
    Question 40Answer

    a.

    exit

    b.

    skip

    c.

    break

    d.

    continue

    Share. Facebook Twitter Pinterest LinkedIn Email
    Add A Comment

    Leave A Reply Cancel Reply

    Post You May Like
    • Legit June/July NECO Arabic Questions 2025 Answers (Essay, Literature & Obj) 100% Verified Solution
    • Legit June/July NECO Commerce Questions 2025 Free Answers (Essay & Obj) 100% Verified Solution
    • Legit June/July NECO Catering Craft Practice Questions 2025 Free Answers (Essay & Obj) 100% Verified Solution
    • Legit June/July NECO Data Processing Questions 2025 Free Answers (Essay & Obj) 100% Verified Solution
    • CDCFIB Recruitment 2025: Apply for Positions in Correctional, Fire, Civil Defence, and Immigration Services
    © 2025 Recruitment portal. Designed by bingmat.

    Type above and press Enter to search. Press Esc to cancel.