Briefly explain encapsulation and why it is important in object-oriented - programming.

1 Answer

Answer :

Encapsulation is the principle that all of the data and functionality required by an object be contained by that object. This allows objects to exist as independent, interchangeable units of functionality without maintaining dependencies on other units of code.

Related questions

Description : Is C# object-oriented?

Last Answer : Yes, C# is an OO language in the tradition of Java and C++.

Description : Is C# is object oriented?

Last Answer : Yes, C# is an OO language in the tradition of Java and C++.

Description : Abstraction and encapsulation are fundamental principles that underlie the object oriented approach to software development. What can you say about the following two statements? I. Abstraction allows us to focus on what something ... and II are correct. (3) Only II is correct. (4) Only I is correct.

Last Answer : (1) Neither I nor II is correct.

Description : Define what is meant by data encapsulation?

Last Answer : Data encapsulation also referred to as data hiding, is the mechanism whereby the implementation details of a class are kept hidden from the user. The user can only perform a restricted set of operations on the hidden members of the class by executing special functions called methods.

Description : Briefly explain how to convert a string representation of a number to a numeric type, such as an Integer or a Double.

Last Answer : All numeric data types have a Parse method that accepts a string parameter and returns the value represented by that string cast to the appropriate data type. You can use the Parse method of each data type to convert strings to that type.

Description : Briefly explain the difference between Public (public), Friend (internal), and Private (private) access levels as they apply to user-defined types and members.

Last Answer : In user-defined types, Public (public) classes can be instantiated by any element of the application. Friend (internal) classes can be instantiated only by members of the same assembly, and Private ( ... the same assembly, and Private (private) members can be accessed only from within the type. 

Description : Briefly explain what is meant by a reference type and a value type.

Last Answer : A value type holds all of the data represented by the variable within the variable itself. A reference type contains a reference to a memory address that holds the data instead of the actual data itself. 

Description : Briefly highlight the differences between imperative and declarative security as they pertain to code access security.

Last Answer : Imperative security is implemented by calling methods of Permission objects in code at run time. Declarative security is configured by attaching attributes representing permissions to classes ... request assembly-wide permissions using the Assembly (assembly) directive with declarative security.

Description : Briefly describe the five accessibility requirements of the Certified for Windows logo program.

Last Answer : The five requirements are o Support standard system settings. This requires your application to be able to conform to system settings for colors, fonts, and other UI elements. o Be ... information by sound alone. This requirement can be met by providing redundant means of conveying information.

Description : Briefly describe how to use the PrintDocument component to print a document. Discuss maintaining correct line spacing and multipage documents.

Last Answer : The PrintDocument class exposes the Print method, which raises the PrintPage event. Code to render printed items to the printer should be placed in the PrintPage event handler. The PrintPage event ... been printed, you must incorporate all logic for printing multiple pages into your event handler.

Description : Briefly describe the three types of user-developed controls and how they differ.

Last Answer : The three types of user-developed controls are inherited controls, user controls, and custom controls. An inherited control derives from a standard Windows Forms control and inherits the ... inherit only generic control functionality. All specific functionality must be implemented by the developer.

Description : What are the four major parts of a SQL SELECT statement? Briefly describe each one.

Last Answer : The four major parts of a SELECT statement are SELECT, FROM, WHERE, and ORDER BY. SELECT specifies the fields to be retrieved. FROM specifies the table from which the records are to be retrieved. WHERE ... the records to be retrieved, and ORDER BY allows you to specify a sort order for the records.

Description : Briefly describe an XmlDataDocument and how it relates to a DataSet.

Last Answer : An XmlDataDocument is an in-memory representation of data in a hierarchical XML format. Each XmlDataDocument is synchronized with a DataSet. Whenever changes are made to one object, the other is instantly updated. Thus, you can use the XmlDataDocument to perform XML manipulations on a DataSet.

Description : Briefly discuss the advantages and disadvantages of using typed DataSet objects.

Last Answer : Typed DataSet objects allow you to work with data that is represented as members of the .NET common type system. This allows your applications to be aware of the types of data returned in a DataSet and serves ... if you do not know the structure of your data, and can be used with any data source. 

Description : Briefly contrast connected and disconnected data access in ADO.NET.

Last Answer : In ADO.NET, connected data access is available through the DataReader, which is a lightweight class designed to provide very fast and efficient data access. It is severely limited, however, in ... to update the database and keeping the connection open just long enough to execute those commands.

Description : What are the two kinds of multidimensional arrays? Briefly describe each.

Last Answer : Multidimensional arrays can be either rectangular arrays or jagged arrays. A rectangular array can be thought of as a table, where each row has the same number of columns. Rectangular arrays with ... dimensional jagged array is like a table where each row might have a different number of columns.

Description : Briefly summarize the similarities and differences between arrays and collections.

Last Answer : Arrays and collections allow you to manage groups of objects. You can access a particular object by index in both arrays and collections, and you can use For Each Next (foreach) syntax to iterate ... Collections namespace can grow or shrink dynamically, and items can be added or removed at run time.

Description : Briefly describe how a class is similar to a structure. How are they different?

Last Answer : Both classes and structures can have members such as methods, properties, and fields, both use a constructor for initialization, and both inherit from System.Object. Both classes and structures can be ... are value types, and the memory that holds structure instances is allocated on the stack. 

Description : Briefly describe what members are, and list the four types of members.

Last Answer : Members are the parts of a class or a structure that hold data or implement functionality. The primary member types are fields, properties, methods, and events.

Description : Briefly describe how garbage collection works.

Last Answer : The garbage collector is a thread that runs in the background of managed .NET applications. It constantly traces the reference tree and attempts to find objects that are no longer referenced. When a nonreferenced object is found, its memory is reclaimed for later use.

Description : Briefly describe the major components of the .NET Framework and describe what each component does.

Last Answer : The .NET Framework consists of two primary parts: the common language runtime, which manages application execution, enforces type safety, and manages memory reclamation, and the .NET base class library, which consists of thousands of predeveloped classes that can be used to build applications.

Description : What is object oriented programming?

Last Answer : Object-oriented programming provides a higher level for programmers to envision and develop their applications. Without attempting to define the concept, we merely note that one deals with objects and ... problem is solved by interfacing the objects. It reduces the complexity of the program design.

Description : _________is popular object oriented programming language used for general purpose: a) C b) C++ c) FORTRAN d) None of These

Last Answer : b) C++

Description : Which of the following are not programming paradigms types: a) Object Oriented Programming b) Aspect Oriented Programming c) Session Oriented Programming d) Structured Programming e) None of These

Last Answer : c) Session Oriented Programming

Description : Classic OOP - Object Oriented programming can be traced back to a language called Simula, and in particular Simula 67, which was popular during the _____: a) 1930s b) 1960s c) 1950s d) None of These

Last Answer : b) 1960s

Description : One of the principal advantage of object oriented programming techniques over procedural programming techniques is that they enable programmers to create ______that do not need to be changed when a new type of object is added: a) Networks b) Modules c) Data Slates d) None of These

Last Answer : b) Modules

Description : Object Oriented Programming (OOP) is a _______philosophy: a) Network b) Design c) Data Type d) None of These

Last Answer : b) Design

Description : Name any two basics Principle of Object-Oriented Programming.

Last Answer : Ans. Encapsulation and Polymorphism

Description : Define class and object. (OBJECT-ORIENTED-PROGRAMMING-WITH-C++)

Last Answer : Class: Class is a user defined data type that combines data and functions together. It is a collection of objects of similar type.  Object: It is a basic run time entity that represents a person, place or any item that the program has to handle.

Description : Write down characteristics of object oriented programming.

Last Answer : Characteristics of object oriented programming are: Emphasis is on data rather than procedure. Programs are divided into objects. Data structures are designed such that they characterize the ... can be easily added whenever necessary. Follows bottom-up approach in program designing. 

Description : Give four differences between object oriented programming and procedure oriented programming.

Last Answer : Give four differences between object oriented programming and procedure oriented programming.

Description : State any four object oriented programming language.

Last Answer : Object oriented programming language: C++ Smalltalk Object pascal java Simula Ada Turbo pascal Eiffel C# Python

Description : State the concepts of object oriented programming.

Last Answer : Basic Concepts of Object Oriented Programming:  1. Objects  Objects are the basic run time entities in an object-oriented system. They may represent a person, a place, a ... objects that communicate with each other. Objects communicate with one another by sending and receiving information.

Description : The pure object oriented programming language with extensive metadata available and modifiable at run time is (A) Small talk (B) C++ (C) Java (D) Eiffel

Last Answer : (A) Small talk

Description : Language model used in LISP is ................. (A) Functional programming (B) Logic programming (C) Object oriented programming (D) All of the above

Last Answer : (A) Functional programming

Description : Write the applications of object oriented programming.

Last Answer : Applications of object oriented programming are: 1) Real time systems 2) Simulation and modeling 3) Object-oriented databases 4) Hypertext, hypermedia and expertext 5) AI and expert systems ... and parallel programming 7) Decision support and office automation systems 8) CIM/CAM/CAD systems

Description : In Visual Basic .NET or Visual C# programming, when would you use Structured Query Language (SQL)? How are they executed? 

Last Answer : ADO.NET handles most of the database communication for you behind-thescenes. You would only use SQL statements when generating ad-hoc queries for the database. You execute SQL statements by ... returning statements, such as DELETE, INSERT INTO, or UPDATE statements, use the ExecuteNonQuery method.

Description : Which namespace enables multithreaded programming in XML?

Last Answer : System.Threading

Description : What are the three possible settings for the CommandType property of a SqlCommand object or an OleDbCommand object, and what does each mean?

Last Answer : A Command object can have a CommandType property setting of Text, StoredProcedure, or TableDirect. When set to Text, the command executes the SQL string that is stored in the Command object's ... that the command should return the entire contents of the table indicated by the CommandText property. 

Description : What size is a .NET object?

Last Answer : Each instance of a reference type has two fields maintained by the runtime - a method table pointer and a sync block. These are 4 bytes each on a 32-bit system, making a total of 8 bytes ... bytes, even for classes with no data (e.g. System.Object). Values types have no equivalent overhead. 

Description : What does the Dispose method do with the connection object? 

Last Answer : Deletes it from the memory. To Do: answer better. The current answer is not entirely correct.

Description : Given part of a stack trace: aspnet.debugging.BadForm.Page_Load(Object sender, EventArgs e) +34. What does the +34 mean?

Last Answer : It is an actual offset (at the assembly language level) – not an offset into the IL instructions. 

Description : Is object destruction deterministic?

Last Answer : No

Description : object is an alias for what? 

Last Answer : System.Object 

Description : How do you dereference an object? 

Last Answer : Set it equal to null. 

Description : Does an object need to be made to run main?

Last Answer : No

Description : What does the Dispose method do with the connection object? 

Last Answer : Deletes it from the memory. To Do: answer better. The current answer is not entirely correct.

Description : ………… enable us to hide, inside the object, both the data fields and the methods that act on that data. A) Encapsulation B) Polymorphism C) Inheritance D) Overloading

Last Answer : A) Encapsulation

Description : The “part-whole”, or “a-part-of”, relationship in which objects representing the components of something associated with an object representing the entire assembly is called as (A) Association (B) Aggregation (C) Encapsulation (D) Generalisation

Last Answer : (B) Aggregation

Description : How data is shared by functions in a procedure oriented programming?

Last Answer : Stack memory