Intro To Class, Objects And Methods

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 Dipishar
D
Dipishar
Community Contributor
Quizzes Created: 1 | Total Attempts: 412
| Attempts: 412 | Questions: 17
Please wait...
Question 1 / 17
0 %
0/100
Score 0/100
1. Not all statements that performed tasks are located in method Main. 

Explanation

In a program, tasks can be performed by statements that are not necessarily located within the method Main. This is because a program can have multiple methods, and each method can contain statements that perform tasks. Therefore, it is possible for statements that perform tasks to be located outside of the method Main. Thus, the statement "Not all statements that performed tasks are located in method Main" is true.

Submit
Please wait...
About This Quiz
Object Oriented Programming Quizzes & Trivia

This quiz titled 'Intro to Class, Objects and Methods' assesses understanding of fundamental concepts in object-oriented programming, including classes, objects, methods, and data types. It is designed to... see moretest knowledge crucial for programming and software development. see less

2. An object's property can have which of the following accessors?

Explanation

An object's property can have both "get" and "set" accessors. The "get" accessor allows us to retrieve the value of the property, while the "set" accessor allows us to modify or update the value of the property. By using both accessors, we can control how the property is accessed and manipulated by other parts of the program.

Submit
3. Which one refers to the data represented by an object's instance variables? 

Explanation

Attributes refer to the data represented by an object's instance variables. Instance variables are variables that hold the state or characteristics of an object. These variables define the object's attributes and are unique to each instance of the class. Behaviors, methods, and information are not the correct terms to describe the data represented by an object's instance variables.

Submit
4. The int type should be used for monetary amounts. 

Explanation

The int type should not be used for monetary amounts because it does not support decimal places. Monetary amounts often require precision and accuracy, which can be achieved by using data types such as decimal or double.

Submit
5. Each object of class is identical except for the values and references it holds. 

Explanation

This statement is true because in object-oriented programming, a class is a blueprint for creating objects. Each object created from the same class will have the same structure and behavior defined by the class. However, the values and references held by each object can be different, allowing each object to have its own unique state. Therefore, while the objects may differ in their specific data and references, their overall structure and behavior will be identical.

Submit
6. How many classes are there in a program/app? 

Explanation

In a program or app, there can be one or more classes. This means that there can be at least one class or multiple classes present in the program or app. The presence of classes allows for the organization and structuring of code, enabling the implementation of different functionalities and features. Therefore, the correct answer is "one or more."

Submit
7. Which of the following simple types should be used for monetary values?

Explanation

The decimal type should be used for monetary values because it provides the highest level of precision and accuracy when dealing with decimal numbers. This is important when dealing with financial calculations to ensure that there is no loss of precision or rounding errors. The float and double types are not suitable for monetary values as they are binary floating-point types and can introduce rounding errors. The int type is also not suitable as it only represents whole numbers and cannot handle decimal values.

Submit
8. Method headers contain all of the following except: 

Explanation

Method headers in programming languages typically include the access modifier, method name, return type, and parameters. The left brace, on the other hand, is not part of the method header. It is used to denote the beginning of the method body or the block of code that defines the functionality of the method.

Submit
9. In UML class diagrams, the + sign 

Explanation

The + sign in UML class diagrams signifies the public visibility symbol. In UML, visibility symbols are used to represent the access level of class members. The + symbol specifically represents public visibility, which means that the class member can be accessed by any other class or object. This allows for the member to be used and modified by other parts of the system.

Submit
10. Every #C app is composed of at least one: 

Explanation

Every C# app is composed of at least one public class declaration. This is because a class is the fundamental building block of any C# application. It serves as a blueprint for creating objects and contains the code and data that define the behavior and characteristics of those objects. Without a public class declaration, there would be no structure or organization to the code, and it would be impossible to create and interact with objects in the application.

Submit
11. The comma-seperated values specified in a method called are:

Explanation

In programming, when a method is called, the comma-separated values that are passed to the method are called arguments. These arguments can be variables, literals, or expressions. They provide the necessary data for the method to perform its task. The method can then use these arguments to perform calculations, manipulate data, or produce a result. Therefore, the correct answer is "arguments."

Submit
12. Methods always return a value or reference. 

Explanation

Methods do not always return a value or reference. In some cases, methods can be declared as void, which means they do not return anything. Void methods are used to perform a certain action without returning any value. Therefore, the statement is false.

Submit
13. How would the following method header be represented in a UML class diagram?

Explanation

The method header "+ DisplayMessage ( courseName: string)" in a UML class diagram represents a public method named "DisplayMessage" that takes a parameter "courseName" of type string. The "+" symbol indicates that the method is public, and the parameter type is specified after the colon ":". This method can be called with a string argument, allowing the course name to be displayed.

Submit
14. The keyword new is used to create a new method of a class. 

Explanation

The keyword "new" is not used to create a new method of a class. Instead, it is used to create a new instance of a class or to override an existing method in a subclass.

Submit
15. Instance variables and local variables both represent the attributes of a class. 

Explanation

Instance variables and local variables do not represent the same thing in a class. Instance variables are variables that are declared within a class but outside of any method, and they hold the state or data of an object. Local variables, on the other hand, are variables that are declared within a method or a block of code and are only accessible within that specific method or block. Therefore, instance variables and local variables serve different purposes and have different scopes within a class.

Submit
16. Which of the following method headers does the following method call match?

Explanation

The given method call matches the method header "action (string x, int y, double z)" because the method call has a string argument followed by an int argument and then a double argument, which matches the parameter types and order of the method header.

Submit
17. C# is known as an extensible language because it declares all classes ahead of time.

Explanation

C# is not known as an extensible language because it does not declare all classes ahead of time. In C#, classes can be defined and declared at any point in the code, allowing for flexibility and adaptability. This dynamic nature of C# makes it more extensible as new classes can be added or modified during runtime. Therefore, the correct answer is False.

Submit
View My Results

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

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

  • Current Version
  • Mar 21, 2023
    Quiz Edited by
    ProProfs Editorial Team
  • Mar 17, 2015
    Quiz Created by
    Dipishar
Cancel
  • All
    All (17)
  • Unanswered
    Unanswered ()
  • Answered
    Answered ()
Not all statements that performed tasks are located in method...
An object's property can have which of the following accessors?
Which one refers to the data represented by an object's instance...
The int type should be used for monetary amounts. 
Each object of class is identical except for the values and references...
How many classes are there in a program/app? 
Which of the following simple types should be used for monetary...
Method headers contain all of the following except: 
In UML class diagrams, the + sign 
Every #C app is composed of at least one: 
The comma-seperated values specified in a method called are:
Methods always return a value or reference. 
How would the following method header be represented in a UML class...
The keyword new is used to create a new method of a class. 
Instance variables and local variables both represent the attributes...
Which of the following method headers does the following method call...
C# is known as an extensible language because it declares all classes...
Alert!

Advertisement