Object Oriented Programming (Cs504d)

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 Sanjayc
S
Sanjayc
Community Contributor
Quizzes Created: 1 | Total Attempts: 267
| Attempts: 267 | Questions: 20
Please wait...
Question 1 / 20
0 %
0/100
Score 0/100
1. To check which object is of which class, which of the following is used

Explanation

The keyword "instanceof" is used to check if an object is an instance of a particular class or implements a specific interface. It returns true if the object is an instance of the class or a subclass of it, or if it implements the interface. In this case, "instanceof" is the correct answer because it is specifically used for determining the class of an object. The other options, sizeof and comma, are not related to checking the class of an object.

Submit
Please wait...
About This Quiz
Object Oriented Programming (Cs504d) - Quiz

This quiz titled 'Object Oriented Programming (CS504D)' assesses key concepts in Java OOP, including syntax, access modifiers, and design principles. It is designed to test understanding of fundamental Java programming elements, suitable for learners aiming to enhance their software development skills.

Personalize your quiz and earn a certificate with your name on it!
2. The Scanner class defined in which package?

Explanation

The correct answer is utility. The Scanner class is defined in the utility package in Java. This package contains various utility classes and interfaces that provide useful functions for input, output, and other general purposes. The Scanner class specifically is used for reading input from different sources, such as the keyboard or a file.

Submit
3. From any non-sub-class Class outside the package, which access is possible?

Explanation

From any non-sub-class Class outside the package, the access that is possible is public. This means that any class outside the package can access the public members (variables, methods, etc.) of the non-sub-class Class. Public access allows for the widest accessibility and is not restricted to any specific class or package.

Submit
4. In Java >>> operator is called

Explanation

The ">>>" operator in Java is known as the right shift with zero fill operator. This operator shifts the bits of a number to the right by a specified number of positions, and fills the leftmost positions with zeros. Unlike the regular right shift operator (>>), the zero fill operator does not preserve the sign bit, meaning that it treats the number as an unsigned value.

Submit
5. In OOPs which mechanism binds data and function together ?

Explanation

Encapsulation is the mechanism in Object-Oriented Programming (OOP) that binds data and functions together. It allows the data to be hidden and accessed only through the functions defined within the class. This helps in achieving data abstraction and ensures that the data is accessed and modified in a controlled manner. Encapsulation also provides data security and helps in maintaining the integrity of the object's state.

Submit
6. Which will legally declare, construct, and initialize an array?

Explanation

The correct answer is "int mylist[]={4,6,9};" because it is the only option that uses the correct syntax to declare, construct, and initialize an array. The other options either use incorrect syntax or do not properly initialize the array.

Submit
7. Which is a reserved word in the Java programming language? 

Explanation

"native" is a reserved word in the Java programming language. In Java, reserved words are predefined keywords that have specific meanings and cannot be used as identifiers or variable names. The "native" keyword is used to indicate that a method is implemented in a language other than Java, typically in a platform-specific manner.

Submit
8. Which command disassembles a class file?

Explanation

The command "javap" is used to disassemble a class file in Java. It allows the user to view the bytecode instructions and other information about the class file. By running "javap" followed by the name of the class file, the user can see the structure, fields, and methods of the class in a human-readable format. This command is helpful for debugging and understanding the internal workings of a Java program.

Submit
9. Java supports Unicode character set which is

Explanation

Java supports Unicode character set which uses 16 bits to represent each character. Unicode is a universal character encoding standard that supports a wide range of characters from different scripts and languages. In Java, characters are represented using the UTF-16 encoding scheme, where each character is stored in 16 bits. This allows Java to handle and manipulate characters from various languages and scripts effectively.

Submit
10. Which of the following is an example of procedural programming language?

Explanation

ALGOL is an example of a procedural programming language. Procedural programming focuses on writing step-by-step instructions or procedures to solve a problem. ALGOL, short for Algorithmic Language, was one of the earliest high-level programming languages developed in the late 1950s. It was designed to be used for scientific and engineering computations and featured a block structure, allowing for the creation of reusable code blocks. Although not widely used today, ALGOL played a significant role in the development of subsequent programming languages, influencing the design of languages like Pascal and C.

Submit
11. This reference is built-in reference can only used within

Explanation

The reference being referred to in the question is a "built-in reference," which suggests that it is a reference to a built-in object or feature within the programming language. The answer states that this built-in reference can only be used within a non-static function of the class. This implies that the built-in reference has certain limitations or restrictions, and it can only be accessed or utilized within a specific type of function in the class.

Submit
12. Data is given less importance in

Explanation

A procedural language is a programming language that follows a linear, step-by-step approach to solving a problem. In procedural programming, data is given less importance compared to the sequence of instructions or procedures that manipulate the data. The focus is on writing procedures or functions that perform specific tasks. This approach is often used in languages like C, Pascal, and Fortran, where the emphasis is on breaking down a problem into smaller, manageable parts and executing them in a specific order. Therefore, data is not given as much significance as the sequence of instructions in a procedural language.

Submit
13. Which of the following is an object based language (OBL) ?

Explanation

JavaScript is an object-based language because it uses objects to represent and manipulate data. It supports object-oriented programming concepts such as inheritance and encapsulation. Objects in JavaScript are instances of classes, and they can have properties and methods. JavaScript also has a prototype-based inheritance model, where objects can inherit properties and methods from other objects. This makes JavaScript a suitable choice for building interactive web applications that require dynamic behavior and manipulation of objects.

Submit
14. Object communicate with each other by sending messages in the form of

Explanation

Objects communicate with each other by sending messages in the form of functions. Functions are a way for objects to interact with each other and perform specific actions. They can be called by one object and executed by another, allowing for communication and collaboration between different objects in a program. Through the use of functions, objects can pass data, trigger actions, and respond to events, enabling them to work together to achieve a desired outcome.

Submit
15. Public class Test{}    What is the prototype of the default constructor? 

Explanation

The prototype of the default constructor for the given class "Test" is "Test()". This is because the default constructor has the same name as the class and does not take any parameters.

Submit
16. Java is pure object oriented programming language because

Explanation

Java is considered a pure object-oriented programming language because it enforces the rule that a single line of code cannot go outside of a class. In Java, all code must be written within a class, and objects are created from these classes. This encapsulation ensures that all code is organized and structured within classes, promoting modularity and reusability. Additionally, Java's platform independence and ability to be both compiled and interpreted further solidify its status as a pure object-oriented language.

Submit
17. What will be the output if you execute the following java code?     import java.lang.*;      class firstapp        {           static()                {                 System.out.println("Hello world");                 }        } 

Explanation

The code provided is attempting to define a static method in the class "firstapp". However, the method name is missing, which results in a compilation error. The correct syntax for defining a static method is "static void methodName()". Therefore, the correct answer is "Compilation error".

Submit
18. Which design model lies behind the concept of object oriented programming?

Explanation

The design model that lies behind the concept of object-oriented programming is bottom-up design. This approach involves breaking down a problem into smaller, more manageable components or objects, and then gradually building up the overall solution by combining these objects. It emphasizes starting with the details and gradually constructing the larger system. This contrasts with top-down design, which starts with the overall structure and breaks it down into smaller components.

Submit
19. Which conditional statement always returns true value?

Explanation

The correct answer is "if(a=0)". This is because the single equals sign (=) is an assignment operator, not a comparison operator. Therefore, the statement "if(a=0)" will always assign the value 0 to the variable "a" and then evaluate the result as true.

Submit
20. Array subscript in Java always starts at

Explanation

In Java, array subscripts always start at 0. This means that the first element of an array is accessed using the subscript 0. Therefore, the correct answer is 0.

Submit
View My Results

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

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

  • Current Version
  • Mar 17, 2023
    Quiz Edited by
    ProProfs Editorial Team
  • Jul 17, 2015
    Quiz Created by
    Sanjayc
Cancel
  • All
    All (20)
  • Unanswered
    Unanswered ()
  • Answered
    Answered ()
To check which object is of which class, which of the following is...
The Scanner class defined in which package?
From any non-sub-class Class outside the package, which access is...
In Java >>> operator is called
In OOPs which mechanism binds data and function together ?
Which will legally declare, construct, and initialize an array?
Which is a reserved word in the Java programming language? 
Which command disassembles a class file?
Java supports Unicode character set which is
Which of the following is an example of procedural programming...
This reference is built-in reference can only used within
Data is given less importance in
Which of the following is an object based language (OBL) ?
Object communicate with each other by sending messages in the form of
Public class Test{}    What is the prototype of the...
Java is pure object oriented programming language because
What will be the output if you execute the following java...
Which design model lies behind the concept of object oriented...
Which conditional statement always returns true value?
Array subscript in Java always starts at
Alert!

Advertisement