SQL Recipes
A FREE cookbook for SQL queries and examples
FAQ Search Today's Posts Mark Forums Read

SQL - Questions and Answers Have a SQL question? Post it here. First do a search to see if someone hasn't already answered it.

Go Back   SQL Recipes a FREE cookbook of SQL queries and examples > SQL queries and examples > SQL - Questions and Answers

Reply
 
LinkBack Thread Tools Search this Thread
  #1 (permalink)  
Old 10-10-2008, 02:30 PM
96problems 96problems is offline
Junior Member
 
Join Date: Oct 2008
Posts: 6
96problems is on a distinguished road
Default ANY dialect question:

c


Lab-2
1.Create a class called employee that contains the employee number (type long), name , and salary (type double). Include a method called getdata() to get data from user for insertion into the object, and another method putdata() to display the data. Write another method increment() to increase the salaries the salaries of all employees by 20%.
2.Create a class called room whose constructor contains three double values, as arguments which represents length, breadth and height of the room. Have the room class compute the volume of the air in the room and store the result in a double variable. Include a method called Volume() that displays the volume of each room object.
3.Define a class STATE with the attributes – names of state & its capital, population, chief minister, area etc. Write an C# program that can do the following-
1.Read a given number of state details & store it in an array of given size.
2.Print the details of all states.
3.Print the details of a particular state.
4.Print the details of the most populated state.
5.Print the details of the least populated state.
6.Modify the details of a given state.

4.A bank has two kinds of accounts, savings and fixed deposit. The interest rates for these are 4% and 11%respectively. Calculate the total amount (principal +interest) for these two schemes after a certain period of time. Show the use of enum if possible. Calculate the actuals on simple interest basis.
5.Create a class Height with the following DataMembers

Identifier
Type
Feet
Int
Inches
Int

Overload the + operator such that it should increase the value contained in the Inches field by one and when the Inches value crosses 12 it should revert to zero after increasing the Feet value by one.
Write a Main() method to implement the same and display the output to the users console.

6.Create a class shapes for different geometric figures like cube, sphere, cylinder, cone etc. Write a method to find out the volume of each shape, it should take the argument of same type (radius or height or both radius and height). Write a main method that reads the shape and its radius and/or height as it is and displays the result.


1.Differentiate between static and dynamic polymorphism.
2.what are virtual methods?
3.What is method overloading?
4.What is inheritance ?Explain with an example.
5.difference b/w method overriding and method hiding.
6.Differentiate method overloading and method overriding.
7.What does sealed keyword represent?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

ANSWER(S):

  #2 (permalink)  
Old 09-03-2009, 02:21 PM
96problems 96problems is offline
Junior Member
 
Join Date: Oct 2008
Posts: 6
96problems is on a distinguished road
Default ANY answer. Re: c

Abstract Class
Cannot be instantiated.
Must be inherited and its methods should be overridden.
It have some concrete methods.
Access modifiers allowed.


• Interface
Have definition of a method not implementation. (implement through class)
Multiple inheritance possible through Interface only
Only Public Access modifier only allowed. Default Public
No need of virtual overridden.
It’s used for to define a set of properties, methods and events.

Functions and sp
1).You can call functions in sps , but not sps in function
Function returns value
2).Procedures can have input,output parameters for it whereas functions can have only input parameters.

3)Exception can be handled by try-catch block in a procedure whereas try-catch block cannot be used in a function.

4)We can go for transaction management in procedure whereas we can't go in function.

these r only in 3.5

listview
inbuilt ajax.
linq datasource
datapager in listview



* Describe the difference between a Thread and a Process?
o A process is a collection of threads (at least one) sharing the same resources (virtual memory, security context etc.).
A thread is an entity in a process that can actually be executed on the CPU.


.Net Architecture....So Imppppp

Architecture of .Net is based on CLR. CLR is the Common Language Runtime which runs as virtual machine on Operating
System. CLR manages execution of code right from memory allocation to Garbage collection. CLR consists of CLS(common Language Specification and
CTS (Common type System). Every program that is written in .NET runs on CLR. We can write code on different languages which should be
compliant with CLS. Languages like C#.net,VB.net,J#.net are supported by CLR. All code written in such language is
known as Managed Code. With the help of such language, different types application like, Console Based, Web based
and windows based can be written. Also it can uses ADO.NET for back end connectivity.




Authentication: The process of determining the identity of a user. In effect, authentication validates that the user is who he or she claims to be.

Authorization: The process of granting access privileges to resources or tasks within an application. Applications typically authenticate users and then authorize them based on their identities or roles within an organization.



Authentication
An authentication system is how you identify yourself to
the computer. The goal behind an authentication system is
to verify that the user is actually who they say they are.
There are many ways of authenticating a user. Like
Password based authentication
Device based authentication
Biometric Authentication

Authorization
Once the system knows who the user is through
authentication, authorization is how the system decides
what the user can do.
A good example of this is using group permissions or the
difference between a normal user and the superuser on a
unix system.



OOPS


Objects:
This is the basic unit of object oriented programming. That is both data and function that operate on data are bundled as a unit called as object.
Classes:
The concept of class is similar to the concept of structure in C. In other words classes are the data types on which objects are created. So while a class is created no memory is allocated only when an object is created memory gets allocated.
Inheritance:
As the name suggests Inheritance is the process of forming a new class from an existing class that is from the existing class called as base class, new class is formed called as derived class. This is a very important concept of object oriented programming since this feature helps to reduce the code size.
Data Abstraction:
Data abstraction is the process of representing essential details not including internal details.
Example index of the book
Data Encapsulation:
Data Encapsulation is the process of combining data and functions into a single unit called class. By this method one cannot access the data directly. Data is accessible only through the functions present inside the class. Thus Data Encapsulation gave rise to the important concept of data hiding.
Polymorphism:
The ability to use an operator or function in different ways in other words giving different meaning or functions to the operators or functions is called polymorphism. Poly refers many. That is a single function or an operator functioning in many ways different upon the usage is called polymorphism.
Overloading:
The concept of overloading is also a branch of polymorphism. When the exiting operator or function is made to operate on new data type it is said to be overloaded.
Reusability:
That is object oriented programming has the feature of allowing an existing class which is written and debugged to be used by other programmers and there by provides a great time saving and also code efficiency to the language. Also it is possible to a have the existing class and adds new features to the existing class as pet the programmer’s choice.
Thus the object oriented programming features helps the program ad there by users of the application to achieve increased performance, it saves time of developing the application, give optimized code for the application, helps in gaining secured applications and there by helps in easier maintenance.




TRUNCATE is a DDL command and cannot be rolled back. All of the memory space is released back to the server.
DELETE is a DML command and can be rolled back.

Both commands accomplish identical tasks (removing all data from a table) but TRUNCATE is much faster.








The access modifiers in .NET are
1. public

2. private

3. protected(Only access inside the class,and can be accessed in the derived class too)

4. internal(Internal are accessible only within files in the same assembly)

5. protected internal
public

Public means visible to everyone and everywhere.

Access cases
1. By objects of the class

2. By derived classes
private

Private means hidden and usable only by the class itself. No code using a class instance can access a private member and neither can a derived class. Information or functionality that will not be needed or has no meaning outside of the context of a specific class should be made private.

Access cases
1. Cannot be accessed by object

2. Cannot be accessed by derived classes
protected

Protected members are similar to private ones in that they are accessible only by the containing class. However, protected members also may be used by a descendant class. So members that are likely to be needed by a descendant class should be marked protected.

Access cases
1. Cannot be accessed by object

2. By derived classes





Internal are public to the entire assembly but private to any outside assemblies. Internal is useful when you don't want to allow other assemblies to have the functionality.

Access cases

In same assembly (public).
1. By objects of the class

2. By derived classes
In other assembly (internal)
1. Cannot be accessed by object

2. Cannot be accessed by derived classes
protected internal

Finally, we have the only compound access modifier allowed in .NET. Members marked as protected internal may be accessed only by a descendant class that's contained in the same assembly as its base class. You use protected internal in situations where you want to deny access to parts of a class' functionality to any descendant classes found in other applications.

Note: that it's illegal to combine two access modifiers for a class but can only be applied to the members.

Access cases

In same assembly (protected).
1. Cannot be accessed by object

2. Can be accessed by a derived classes
In other assembly (internal)
1. Cannot be accessed by object

2. Cannot be accessed by derived classes




The virtual keyword is used to modify a method, property, indexer or event declaration, and allow it to be overridden in a derived class. For example, this method can be overridden by any class that inherits it:



primary key:- The attribute or combination of attributes
that uniquely identifies a row or record.

Foreign Key:- an attribute or combination of attribute in a
table whose value match a primary key in another table.

Composite key:- A primary key that consists of two or more
attributes is known as composite key

candidate key:- is a column in a table which has the
ability to become a primary key.

Alternate Key:- an alternate key (or secondary key) is any candidate key which is not selected to be the primary key (PK). ...

Boxing
Converting a value type to reference type is called Boxing. Unboxing is an explicit operation.

int i=0;
object o=i; //boxing
int j=(int) o; //unboxing



Page Life Cycle

*** *** *** Stage
*** *** Events/Method
Page Initialization
Page_Init
View State Loading
LoadViewState
Postback data processing
LoadPostData
Page Loading
Page_Load
PostBack Change Notification
RaisePostDataChangedEvent
PostBack Event Handling
RaisePostBackEvent
Page Pre Rendering Phase
Page_PreRender
View State Saving
SaveViewState
Page Rendering
Page_Render
Page Unloading
Page_UnLoad
*
Delegates:
It like function pointers in c..
Event handling mechanism of .NET. To raise events, a class must define one delegate per event type. To handle events, types must implement one event handler per event type. Delegates can reference both instance and static methods. C# uses the delegate keyword.
Best eg:
Let say I write a class that checks for stock prices and sends an alert when the stocks go above or below a threshold.
This could take days or months (perhaps not these days though).

Now you write code and want to be notified.
You could call my method repeatedly (say every five minutes and check).

The alternative is to call my method and pass me your method so that I can call it when the event of interest occurs.

That way, you call me once, pass me your method and forget about it. When the event occurs, you will get notified.

Those are the kind of things delegates are good for.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 12-10-2009, 12:01 PM
96problems 96problems is offline
Junior Member
 
Join Date: Oct 2008
Posts: 6
96problems is on a distinguished road
Default ANY answer. Re: c

What is trigger? what is the use ?
Oracle default date format DD-MON-YYYY
Master page vs user control
Page life cycle
String vs string Builder
use of mybase in c#
web service methods?
Ado.net is Disconnected or connected ?
Override vs overloading?
name space for exception
What is the classses of Ado.net?
Interface
delegates ?
.net framework? new features in .net 2.0,.net 3.0,.net 3.5
WPF ,WCF,WWF.
what is meant by Rendering
What is meant by attribute
What is meant by class and methods?


Question


GAC
Assembly-
Index
Types of Index
Difference between exe, dll
strong names
Validators
Delegates
Abstarct class
Interface
dataset vs Datareader
cursors
Triggers
delete vs truncate
polymorphism
overloading and overriding
constructor
destructor
property
ado.net
.net 3.5 new features
throw
how do you handle exceptions
static
managed code and unmanaged code
Garbage collection
wat is meant by generics
HashTable
How many catch blocks are possible in c#?
Arraylist vs Generics
Creation of dataset and datatable
Sixth highest salary
Garbage Collection
Interoperability
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 04:33 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0
Copyright (c) 2006-2008 SQL Recipes

1 2 3 4 5 6 7 8