Finalize method is implicitly called by GarbageCollector to delete the object if it is no longer in use whereas Dispose method is explicitly called inside a class through IDisposible interface to forcefully remove the object and its references.
In the .NET framework, the Types are of either Value type or reference type depending on, how they stored the value.
@Value type: if the data-type stores the value into its own memory space, it is called as a Value type. In value type, we can directly provide the values to the variable. Datatypes such as int, char, float, double, enum, struct, etc., are of value type.
@Reference type: Reference type does not store value directly in the variable. It stores a pointer to another memory location, which stores the data. As reference type stores the address of the data, not actual data, so if we change in an address it will create another copy for the reference which will point to the same data. Example are objects, array, Classes, Interfaces, etc.
Delegate is an object that holds the reference to methods in c#. It is same as a function pointer in C.
There are some built-in DBMS packages provided by Oracle. With the help of Oracle DBMS packages, we can create various Oracle applications.
Following are some basic packages provided by Oracle:
Oracle dbms_alert
Oracle dbms_application_info
Oracle dbms_aqadm
Oracle dbms_crypto
Oracle dbms_fga
Oracle dbms_job
Oracle dbms_job.submit
Oracle dbms_lob
Oracle dbms_metadata
Oracle dbms_monitor
A Linked list is a linear data structure similar to an array, which is used to store the data in an organized way.
In Linked list data elements are not stored in contiguous blocks.
Applications of the Linked list:
Methods for daemon thread:
1.public void setDaemon(boolean status): This method sets the current thread as user thread or daemon thread.
2.Boolean isDaemon(): This method checks whether the current thread is daemon or not. It returns the true or false Boolean value.
The itoa() function in C language used to convert an integer value to its equivalent null-terminated String. It stores the result in an array.
Syntax:
1.char * itoa ( int value, char * str, int base );
Parameters:
value: A value which needs to be converted
str: A parameter which stores the converted value as an array
base: It represents the numerical value, which is used to give the conversion base, as base 2 for binary, base 10 for decimal.
A postback is a request sent from a client to server from the same page user is already working with. When we refresh our page or we submit some page, then the data of the current page is send back to the server.
The C pre-processor is used to scan and modify a source code before its compilation. The line starting with the symbol # followed by the directive name, in the source code, is known as pre-processor directive. Pre-processor directive invoked by the compiler to process some code before the compilation process.
Each line in code can have a single pre-processor directive
Pre-processor directive does not include a semicolon at the end.
Header files are the files which contain macro definitions and functions definition. It used with pre-processor directives with a file extension of ".h."
There are two types of header files in C:
System header files: These header files come with the compiler
User-created header files: These files are written by the programmer.
Following are some mainly used header files in C
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>, and many more.
Yes. Just declare the class public and make the method sealed.
To create an interface in Java, we can use the keyword "interface" followed by the interface name.
Example
interface Employee {
int empid = 23;
String empname="John";
}
We can implement an interface in a class by using keyword "implement" and can use abstract methods.
In UML (Unified Modeling Language) there are various types of relationships for the object-oriented system. Association and Aggregation are also a type of relationship in UML.
Aggregation: Aggregation is a specific type of association between two or more objects. In Aggregation, objects can have their lifecycle with ownership. It is a one-directional association. If we destroy one object, it will not affect another one. It is also called as HAS-A relationship.
Association: Association is a relation between two objects with their own lifetime and without any ownership. An association relationship can be represented by the following type:
The aggregation and composition are the part of the association.
The term encapsulation, Inheritance, and abstraction are the features of object-oriented programming. These features provide the facility to deal with the objects.
Encapsulation: Encapsulation is one of the primary features of OOPs concept. The process of binding the data and methods in a single unit is called as encapsulation.
With the help of encapsulation, we can hide the data members from other classes, and it is only accessible by its current class.
There are two ways to achieve encapsulation:
Inheritance: - Inheritance in Java is a process by which on class can inherit the properties (methods and fields) of another class. It increases the reusability of methods and fields. We can use inherited methods and also can add new methods. Inheritance shows parent-child relationship also known as IS-A relationship.
There are the following terms used in inheritance:
Child class/Subclass: Child class or sub-class is one who inherits the other class.
Superclass/ Parent class: Superclass or Parent class is on which got inherited by another class. It is also known as base class. For inheriting one class, into another class we use extends keyword in Java.
Syntax for inheritance:
@class A extends B
@{
@ //methods and fields
@}
Where class A is child class, and class B is Parent class.
Abstraction: Abstraction is a one of the important Feature of OOPs concept, which helps a user to show only the functionality not the implementation details of the object. In Java languages we can achieve abstraction in two ways:
By using the abstract class (0 to 100%): A class which is declared using 'abstract' keyword is considered as an abstract class. An abstract class can have an abstract method as well as non-abstract methods.
Syntax:
1.abstract class A{ }
By using interface (100%): An interface in Java is the same as a class in java, it can have abstract methods and variables. But it cannot have a method body. we can declare it by using the interface keyword
Syntax:
1.Interface Interface_Name{
2.//Methods }
Organization of data in the computer can be done with the help of data structure so that data can be accessed easily and efficiently. There are different types of data structure used in computer, and two of them are Stack and Queue data Structure.
Stack: A stack is a type of linear-data structure, which logically represents and arrange the data in the form of a stack. As a real-life example of a stack is "plates arranged in the form of the stack." In a stack structure, any operation can be performed on data items from one end only.
A Stack structure follows a particular order for operation on data items, and that order can be LIFO (Last in First Out) or FILO (First in Last Out). A stack can be represented in the form of an array.
Types of Operations performed on Stack:
@Push: Push is an operation that can be performed, to add an element in the stack.
As in the above diagram, the top element was 93 (before addition of a new element), and after performing PUSH operation, a top element is @Now pointer will point at the top of the stack.
@Pop: If we try to remove or delete an element from the Stack, then it is called as Pop operation.
As in the above diagram, if we want to delete an element from the top of the Stack, then it can be done by the Pop operation.
@isEmpty: If we wanted to check whether the stack is empty or not, then we can perform an isEmpty operation. It will return three values: If we will perform a Pop operation on empty Stack, then it is called underflow condition.
Empty -1
Single element present 0
Stack is full N-1
Stack overflow N
@Peek or Top: If we perform Peek operation it checks all the elements of the stack and returns the top element.
Queue: A Queue is an ordered collection of data elements same as a stack, but it enables insertion operation from one end called as REAR end and deletion operation from other end called as a FRONT end.
A Queue structure follows an order of FIFO (First in First Out) for insertion and deletion of the data element.
Real life example of a queue is people waiting to buy a movie ticket in a line.
Types of Operations performed on Stack: The two main operations which can be performed
On Stack are Enqueue and Dequeue.
Enqueue:
This operation is performed to add an element in the queue at the rear end. After adding an element in a queue, the count of Rear pointer increased by @Below is the Array representation of queue with Enqueue operation.
Dequeue:
This operation is performed to remove an element from the queue at the front end. After removing an element from the queue, the count of Front pointer gets decremented by @Below is the diagram which shows the removal of the data element from a queue.
Other operations performed on the queue are:
Peek: This operation is used to get all the data elements of queue without deletion of an element, at the front end.
Isfull: This operation is performed to check whether a queue is full or not.
Isempty: This operation is performed to check whether a queue is empty or not.
The smallest package in Java API is java. applet package.
An interface is not a class but an object with a set of methods. The method inside an interface has only method definitions without ant body. An interface is used to implement multiple inheritance in code. This feature of an interface is quite different from that of abstract classes because a class cannot derive the features of more than one class but can easily implement multiple interfaces. Variables in interface must be declared as public, static, and final while methods must be public and abstract.
Session is more secure than View State as it is stored in server side memory and creates a unique session id for each session.
There two types of connection in Ado.Net.They are connected Architecture and disconnected architecture:
An assembly exists as a .DLL or .EXE that contains MSIL code that is executed by CLR. An assembly contains interface and classes, it can also contain other resources like bitmaps, files etc. It carries version details which are used by the CLR during execution. Two assemblies of the same name but with different versions can run side-by-side enabling applications that depend on a specific version to use assembly of that version.
String class is immutable in Java that me we are unable to change its value. It is because a String object is always cached in the String pool, and these pools can be shared between various clients. So there will always a risk that if we change in client's string it will automatically affect all the client's action. So every time when we try to change the String value, it will create a new object
In the Java language, we can use two types of variables that are static variable and non-static variable.
The main differences between both the variables are given below:
C and C++ both are the computer programming languages. Both the languages enable us to write efficient code. As C++ is an advanced version of C language, therefore it has some extra features than C languages.
The main advantages of C++ over the C language are given below:
An immutable class is one in which once an object is created, then we cannot alter the values, or we cannot change its content. As in Java, we have wrapper classes like String, Boolean, Integer, etc., all these classes are immutable classes, and we can also create an immutable class by own.
Following are some requirement to create an immutable class in Java:
Data abstraction:
Data abstraction is a technique to hide the irrelevant internal details of data from the user. It makes an easier user interaction with the database. This technique creates an easier way of database designing.
There are three levels of data abstraction:
@Physical level
@Logical level
@View level
A custom control is a loosely coupled control which can be used across various applications.
We need to only include its reference (.dll) to the project and it can be added to your toolbox.You can also keep it inside a class library.
Main difference between User Controls and Custom Controls are:
Following is a program for factorial of a number using Recursion in Java.
@public class Factoria{
@ @ static int display(int n){
@ if (n == 0)
@ return 1;
@ else
@ return(n * display(n-1));
@ }
@ public static void main(String args[]){
@ int i, fact=1;
@ int number=5;//It is the number to calculate factorial
@ fact = display(number);
@ System.out.println("Factorial of "+number+" is: "+fact);
@ }
@}
Output:
Factorial of 5 is: 120
Interface in Java is a way to achieve the abstraction. An Interface is like a class and also can have methods and variable as a class does but Interface only contains method signature and does not have a body.
Syntax:
@Interface Interface_Name{
@//Methods
@}
View State is one of the state management methods used to retain the page and it's control values between post backs. It Store the values of page or control properties that you define. One bit of state that does not need to be persisted across post-backs is the control's properties specified in the declarative syntax, since they are automatically reinstated in the page's instantiate stage. View State is a client side state management.
A foreign key is a field in a table, used to create a link between two tables. It defined in one table but refer to the primary key of another table. A table which contains the foreign key is called the child table. And the table which includes the candidate key is called as parent table.
Some important points for foreign key:
A value for a foreign key can be NULL.
All values for foreign key should be present for all equivalent values of a primary key.
Following is a program for swapping two strings without using the third variable in Java
@public class Swap {
@ public static void main(String args[]) {
@ String a = "Hello";
@ String b = "world";
@ System.out.println("Before swap: " + a + " " + b);
@ a=a+b;
7. b = a.substring(0, a.length() - b.length());
8. a = a.substring(b.length());
9. System.out.println("After swap: " + a + " " + b);
@ } }
Output:
Before swap: Hello world
After swap: world Hello
Normalization is a technique of efficient database designing and organizing to achieve two basic requirements:
Normalization increases the performance of the database, as it allows a database to take very less space in memory.
There are mainly four types of Normalization, which are given below:
1NF: A relation in the table be in first normal form if each attribute is single value attribute
2NF
3NF
BCNF
Client-side state management: This maintains information on the client's machine using Cookies, View State, and Query Strings.
Cookies: A cookie is a small text file on the client machine either in the client's file system or memory of client browser session. Cookies are not good for sensitive data. Moreover, Cookies can be disabled on the browser. Thus, you can't rely on cookies for state management.
View State: Each page and each control on the page has View State property. This property allows automatic retention of page and controls state between each trip to server. This me control value is maintained between page postbacks. Viewstate is implemented using _VIEWSTATE, a hidden form field which gets created automatically on each page. You can't trmit data to other page using view state.
Querystring: Query strings can maintain limited state information. Data can be passed from one page to another with the URL but you can send limited size of data with the URL. Most browsers allow a limit of 255 characters on URL length.
Server-side state management: This kind of mechanism retains state in the server.
Application State: The data stored in the application object can be shared by all the sessions of the application. Application object stores data in the key value pair.
Session State: Session State stores session-specific information and the information is visible within the session only. ASP.NET creates unique sessionId for each session of the application. SessionIDs are maintained either by an HTTP cookie or a modified URL, as set in the application's configuration settings. By default, SessionID values are stored in a cookie.
Database: Database can be used to store large state information. Database support is used in combination with cookies or session state.
An abstract class is a class that cannot be instantiated and is always used as a base class. We cannot instantiate an abstract class directly. This implies that we cannot create an object of the abstract class; it must be inherited. We can have abstract as well as non-abstract members in an abstract class. We must declare at least one abstract method in the abstract class. An abstract class is always public. An abstract class is declared using the abstract keyword. The basic purpose of an abstract class is to provide a common definition of the base class that multiple derived classes can share.
The size of a class depends on the size of its members. There are the following factors which determine the size of a class:
Yes, we can check that a given link-list is circular or not. A link-list will be a circular link-list if it follows the two main requirements: