Posts

Showing posts from January, 2024

Gujarat Board, Class XII, Computer Science, Year 2023, Java Questions with Answers and Explanation

1) Which of the following keeps the data safe from unintended actions and inadvertent access by outside Objects? (A) Data Abstraction (B) Polymorphism (C) Aggregation (D) Encapsulation Answer: (D) Encapsulation Explanation: Encapsulation is a fundamental concept in object-oriented programming that involves bundling data (attributes) and the methods (functions) that operate on the data into a single unit known as a class. It helps keep the data safe from unintended actions and inadvertent access by outside objects. Encapsulation achieves this by restricting direct access to the internal details of an object and providing controlled access through well-defined interfaces (methods).   2) Which is a general concept used to embody all the common features of a particular set of objects? (A) Class (B) Behaviour (C) Attributes (D) Method Answer: (A) Class Explanation: A class is a general concept used to embody all the common features of a particular set of objects in...

Gujarat Board, Class XII, Computer Science, 2022 July, Java Questions with Answers and Explanation

1) Which of the following is a special kind of method that is invoked when a new object is created? (A) Console (B) Constructor (C) Conductors (D) Consumer Answer: (B) Constructor Explanation: In object-oriented programming, a constructor is a special method that is automatically called when an object of a class is created. It initializes the object's state and performs any necessary setup. The purpose of a constructor is to ensure that the object is in a valid state after it is created. In Java, the constructor has the same name as the class and is invoked using the `new` keyword when an object is instantiated. 2) Which of the following statement should be added as the first non-comment or non-blank line in the source file of java? (A) Package (B) Private (C) Public (D) Protocol Answer: (A) Package Explanation: The `package` statement in Java is used to declare a package name for the Java class. It should be the first non-comment line in a Java source file, a...