SAMPLE QUESTION BANK
(ROUND 0)
AREA : SQL Page 1 of 2
Q1: What is a Deadlock? How does SQL address it?
A1: Multiple transactions waiting for each others lock to get released (candidate could explain with an example situation). To address it, SQL identifies one transaction and Rolls it back.
Q2: What is the difference between clustered and un-clustered index?
A2: In a Clustered index, the table itself is re-ordered. In an Un-clustered index, separate index is stored with pointers to the main table. You can have only one Clustered index, but up to 255 Un-clustered indexes. (both are however, implemented as Binary trees)
Q3: How is “truncate table” different from “delete table”?
A3: Delete Table Truncate table
- Locked - Not Locked
- Can be Rolled back - Cannot be Rolled back
- Trigger fired - No Trigger fired
- Slower - Faster
- Row by row - Page by Page
- Transaction Log entries done - No Transaction Log entries
Q4: What are the advantages of using “Stored Procedures”?
A4: They are Pre-compiled and faster
Q5: In SQL Server – What is an “instead of” trigger? How do you access them?
A5: It is a Trigger that runs before the table is affected.
Q6: What are “magic tables”? How can you access them?
A6: Magic tables namely “Inserted”, “Deleted” – temp tables created whenever a DML statement is encountered. Can access them only through a trigger.
Q7: What is a “live-lock”?
A7: Request for exclusive lock waiting for a long time due to overlapping requests for shared lock. (candidate could explain with an example situation).
Q8: What is a view?
A8: It is a “Named Virtual Derived Table”
(candidate need not give verbatim definition, but maybe in his own words) Each word in the above definition could be probed to get level of understanding.
SAMPLE QUESTION BANK
(ROUND 0)
AREA : SQL Page 2 of 2
Q9: What is the difference between “username” and “login-name”?
A9: Username Login-name
- for individual database - for SQL server
- stored in “sysusers” - stored in “syslogin” in master
database
Q10: How do you query from 2 different tables from 2 different databases on the same server?
A10: SELECT FROM <databse-name>.<owner-name>.<table-name>
Q11: Where is the test for a “Stored Procedure” or a “view” stored?
A11: It is stored in “syscomments” (system table)
Q12: Where is the structure of a table stored?
A12: It is stored in “syscolumns” (system table)
Q13: In SQL, given a date (eg 26-09-2002) find the
a) first day of the week (for that date)
b) last day of the week (for that date)
c) last day of the month (for that date)
(Note - assume Sunday to be day1, Monday to be day 2 and so on)
A13:
a) SELECT DATEADD (@Date, - (DATEPART (dw, @Date) – 1) )
b) SELECT DATEADD (@Date, 7 - (DATEPART (dw, @Date) ) )
c) SELECT
DAY(DATEADD(d, -DAY(DATEADD(m,1,@Date)),DATEADD(m,1,@Date)))
AS 'Last day of the month'
SAMPLE QUESTION BANK
(ROUND 0)
AREA : COM+ Page 1 of 4
1) Why do we need COM?
COM (or COM+) promotes software reuse and distribution using the following principles –
Binary Encapsulation – COM (or COM+) promotes binary encapsulation by enabling a client application running in one runtime (lets say a VB client – therefore the VB runtime) to communicate to a COM component developed using C++ (therefore C++ runtime). This is possible by COM mandating a well-defined protocol [COM - ‘v’ table] that enables arbitrary runtimes to communicate with a COM component so long as the runtimes are extended to understand and adhere to the protocol
Location Transparency – COM (or COM+) promotes distribution by enabling COM objects to be distributed across apartment, process and machine boundaries. Client has no knowledge of actually the component is distributed
Interface based programming model - COM (or COM+) promotes the notion of separating interface out of implementation. Clients to the component query for the interfaces exposed by the object without worrying about the underlying implementation
Runtime Services – COM+ provides runtime services like Transaction Management, connection/resource pooling, object pooling, just in time activation to enable a scalable platform to build enterprise solutions
2) Explain Reflexive, Transitive and Symmetric rules of COM
Reflexive – Assuming that a component implements IX, IY and IZ (apart from IUnknown which has to be any way implemented), client has to successfully Query Interface to get back IX every time no matter how many times the client Query Interfaces to get back IX
Transitive – Client can Query Interface IY from IX and IZ from IX as well
Symmetric - Client can Query Interface IY from IX and IX from IY
SAMPLE QUESTION BANK
(ROUND 0)
AREA : COM+ Page 2 of 4
3) Explain the ACID properties of Transaction?
Atomicity – A transaction executes exactly once and is atomic—all the work is done or none of it is.
Consistency – A transaction is a unit of integrity because it preserves the consistency of data, transforming one consistent state of data into another consistent state of data.
Isolation - A transaction is a unit of isolation—allowing concurrent transactions to behave as though each were the only transaction running in the system. There are three degrees of isolation –
Degree 1 - Dirty Read – Let’s say that we have two transactions T1 & T2 concurrently running, T1 updating a record and T2 trying to read the same record. By having transactions running is Degree 1 isolation level, T2 will be able to read un-committed record “dirty read”, even though T1 has updated but not yet committed or aborted. In effect no locks are held in the database to ensure that a “read” transaction is potentially able to read a “dirty record”. It’s also possible that transaction T1 can abort its updation causing T2 to hold an obsolete data
Degree 2 – Committed Read – Here locks are held therefore T2 is always guaranteed to get back a committed data, although it’s possible to have a “phantom read”. This is possible when say T2 gets a resultset than goes on do some other processing and than again executes the same query, in the meanwhile a third transaction T3 has inserted a new record. The resultset obtained out of executing the query the second time will yield the new record inserted as a part of the resultset which would have not been there when the query was executed the first time. This is the “phantom read”
Degree 3 – Repeatable Read – No matter how many times transaction T2 executes the query it will always yield the same resultset, this means “phantom reads” are not possible. This is achieved by holding a table level lock.
Durability - A transaction is also a unit of recovery. If a transaction succeeds, the system guarantees that its updates will persist, even if the computer crashes immediately after the commit.
SAMPLE QUESTION BANK
(ROUND 0)
AREA : COM+ Page 3 of 4
4) Explain what we mean by “Apartments” in COM+?
All COM+ objects will live in a certain Apartment and also provide an execution environment for them. Just as the way a COM+ component is associated to an apartment, each client thread can initialize itself with an Apartment type using Co_InitializeEx(…).
Calls within an apartment are direct, while calls across apartments are indirect and require proxy and stub code.
Apartments allow for objects with different synchronization and reentrancy properties and have two categories: single-threaded and multithreaded. Objects in a single-threaded apartment (STA) execute on the particular thread in which they were created. STAs allow only one method to execute at a time. They are designed for user interfaces and rely on the Microsoft® Windows® message queue to process incoming calls.
Objects in a multithreaded apartment (MTA) execute on any thread and allow any number of methods to occur simultaneously but its important that the provider of a COM+ component should protect the internal state of the component by using proper synchronization primitives (like mutex/critical section etc). MTAs support reentrance implicitly.
5) Explain what we mean by “Marshalling” and the support provided by COM (COM+)
Mechanism of passing function calls and parameters of a component across apartment (process and machine as well) boundaries. COM supports following marshalling mechanisms –
Standard Marshalling – Done by the proxy/stub code that’s generated by the MIDL compiler on the interfaces published in the IDL (this technique can be done only in a C++ environment)
Type-Library Marshalling – Developments environments like VB uses STDOLEAUTO32.DLL (called the Universal Marshaller) for type library marshalling. The universal marshaller will use the type library to get the type information for marshalling and the data that needs to be marshaled is restricted to OLE Automation compatible types
Custom Marshalling – Component implementers can provide their own custom marshalling technique by implementing a standard interface called IMarshal. Custom Marshalling is generally implemented as following –
Ø Custom Proxies
Ø MBV’d (Marshal by Value) objects
Ø FTM (Free Threaded Marshaller)
SAMPLE QUESTION BANK
(ROUND 0)
AREA : COM+ Page 4 of 4
6) What is the most efficient way to get back to result status from a COM call?
HRESULT
7) Explain why we need to model an enterprise solution as ‘n’ tier solution if you were to use COM+ services and broad set of guidelines/thumb rules to keep in mind when designing such applications targeting COM+ platform?
I leave this answer to the person who is interviewing, as there are lots of things we can bring in here
SAMPLE QUESTION BANK
(ROUND 0)
AREA : Visual Basic Page 1 of 2
- What are cursor types supported in ADO and explain one of them?
There are four different cursor types defined in ADO:
- Dynamic cursor — allows you to view additions, changes, and deletions by other users; allows all types of movement through the Recordset that doesn't rely on bookmarks; and allows bookmarks if the provider supports them.
- Keyset cursor — behaves like a dynamic cursor, except that it prevents you from seeing records that other users add, and prevents access to records that other users delete. Data changes by other users will still be visible. It always supports bookmarks and therefore allows all types of movement through the Recordset.
- Static cursor — provides a static copy of a set of records for you to use to find data or generate reports; always allows bookmarks and therefore allows all types of movement through the Recordset. Additions, changes, or deletions by other users will not be visible. This is the only type of cursor allowed when you open a client-side Recordset object.
- Forward-only cursor — allows you to only scroll forward through the Recordset. Additions, changes, or deletions by other users will not be visible. This improves performance in situations where you need to make only a single pass through a Recordset.
- How is an Error trapped in Visual Basic and what are the methods supported by it?
The Err object in visual basic helps in trapping errors. It supports two methods. Raise and clear.
- What are the three compatibility options in visual basic?
- No compatibility
- Project compatibility
- Binary compatibility
- What is the difference between classes and modules?
The primary difference between classes and modules is that classes can be instantiated and standard modules cannot. Because there is never more than one copy of a standard module's data, when one part of your program changes a public variable in a standard module, any other part of the program gets the same value if it subsequently reads that variable. Class data, on the other hand, exists separately for each instantiated object. Another difference is that unlike standard modules, classes can implement interfaces.
SAMPLE QUESTION BANK
(ROUND 0)
AREA : Visual Basic Page 2of 2
5. What is the difference between modal and modeless dialogs?
Modal does not allow control to the parent until the current windows in acted on
In Modeless the current window can be ignored and the control can be transferred to the parent windows
6. What is the default threading model in Visual Basic?
Apartment Threaded model is the default
7. What is late binding and early binding?
Early bound objects allow the compiler to allocate memory and perform other optimizations before an application executes. In late binding it is during runtime.
8. What are Watch Windows?
You can use the Watch window to evaluate variables and expressions and keep the results.
9. How to release object reference in case of VB?
1. Set object = nothing
10. When do you use Implements in VB?
When you want to implement an interface
11. What are the different access modifiers supported in visual basic?
- public
- private
- friend
- protected
SAMPLE QUESTION BANK
(ROUND 0)
AREA : .NET FRAMEWORK Page 1 of 2
1. What is the CTS?
CTS = Common Type System. This is the range of types that the .NET runtime understands, and therefore that .NET applications can use. However note that not all .NET languages will support all the types in the CTS. The CTS is a superset of the CLS.
2. What is the CLS?
CLS = Common Language Specification. This is a subset of the CTS which all .NET languages are expected to support. The idea is that any program which uses CLS-compliant types can interoperate with any .NET program written in any language.
In theory this allows very tight interop between different .NET languages - for example allowing a C# class to inherit from a VB class.
3. What is IL?
IL = Intermediate Language. Also known as MSIL (Microsoft Intermediate Language) or CIL (Common Intermediate Language). All .NET source code (of any language) is compiled to IL. The IL is then converted to machine code at the point where the software is installed, or at run-time by a Just-In-Time (JIT) compiler.
4. What does 'managed' mean in the .NET context?
Managed code: The .NET framework provides several core run-time services to the programs that run within it - for example exception handling and security. For these services to work, the code must provide a minimum level of information to the runtime. Such code is called managed code. All C# and Visual Basic.NET code is managed by default. VS7 C++ code is not managed by default, but the compiler can produce managed code by specifying a command-line switch (/com+).
5. What is reflection?
All .NET compilers produce metadata about the types defined in the modules they produce. This metadata is packaged along with the module (modules in turn are packaged together in assemblies), and can be accessed by a mechanism called reflection. The System.Reflection namespace contains classes that can be used to interrogate the types for a module/assembly.
6. What is an assembly?
Assemblies are the unit of versioning in .NET. Assemblies act as the smallest distribution unit for component code in the .net framework. CLR requires all types to be belong to an assembly
An assembly is sometimes described as a logical .EXE or .DLL, and can be an application (with a main entry point) or a library. An assembly consists of one or more files (dlls, exes, html files etc), and represents a group of resources, type definitions, and implementations of those types.
SAMPLE QUESTION BANK
(ROUND 0)
AREA : .NET FRAMEWORK Page 2 of 2
7. What is the difference between a private assembly and a shared assembly?
Location and visibility: A private assembly is normally used by a single application, and is stored in the application's directory, or a sub-directory beneath. A shared assembly is normally stored in the global assembly cache, which is a repository of assemblies maintained by the .NET runtime. Shared assemblies are usually libraries of code which many applications will find useful, e.g. the .NET framework classes.
Versioning: The runtime enforces versioning constraints only on shared assemblies, not on private assemblies.
8. What is an Application Domain or App DOmain?
An AppDomain can be thought of as a lightweight process. Multiple AppDomains can exist inside a Win32 process. The primary purpose of the AppDomain is to isolate an application from other applications.
9. What is garbage collection?
Garbage collection is a system whereby a run-time component takes responsibility for managing the lifetime of objects and the heap memory that they occupy. This concept is not new to .NET - Java and many other languages/runtimes have used garbage collection for some time.
10. What is serialization?
Serialization is the process of converting an object into a stream of bytes. Deserialization is the opposite process of creating an object from a stream of bytes. Serialization/Deserialization is mostly used to transport objects (e.g. during remoting), or to persist objects (e.g. to a file or database).
11. What is Code Access Security (CAS)?
CAS is the part of the .NET security model that determines whether or not a piece of code is allowed to run, and what resources it can use when it is running. For example, it is CAS that will prevent a .NET web applet from formatting your hard disk.
12. Can you tell me what is a web service ?
A web service is a software component or program that is accessible to other programs over internet-friendly protocols such as HTTP and XML.
13. Mention some of the benefits of the Managed environment
Garbage collection, provides a uniform type system across all .NET languages, fully supports versioning and provides extensible meta data , available at run time through reflection
14. What is the GAC (Global Assembly Cache) ?
The global assembly cache is a machine wide code cache that contains assemblies that have been installed for machine wide use.
SAMPLE QUESTION BANK
(ROUND 0)
AREA : ASP Page 1 of 2
1. What are the different types of objects in ASP
ASP includes five standard objects for global use:
Request—to get information from the user
Response—to send information to the user
Server—to control the Internet Information Server
Session—to store information about and change settings for the user's current Web-server session
Application—to share application-level information and control settings for the lifetime of the application
ErrorObject.
Object Context
2. What is the difference betweeen Response.Redirect and Server.Transfer
Server.Transfer acts as an efficient replacement for Response.Redirect. Response.Redirect tells the browser to request a different page. Since a redirect forces a new page request, the browser has to make two round trips to the Web server, and the Web server has to handle an extra request. IIS 5.0 introduced a new function, Server.Transfer, which transfers execution to a different ASP page on the server. This avoids the extra round trip, resulting in better overall system performance, as well as a better user experience.
3. What is remote scripting
In essence, Remote Scripting allows you to call server-side Active Server Pages (ASP) scripts without having to refresh the page.
4. What is the difference between get and post.
The method="get" attribute is used when the information to be given to server side is encoded as a part of the url itself.
The method="post" attribute instructs the browser to encode the input parameters in the body of the request that it sends to the server (as opposed to encoding them in the URL).
5. What is the size that get and post can handle
get - 9k char and post - 100Kb
6. What are different types of ASP components?
7. What is the purpose of GLOBAL.ASA file?
This file is used to declare all global, session-wide, and application-wide variables. It also houses function modules that allow us to insert code to do housekeeping tasks when the application or a session starts and stops.
SAMPLE QUESTION BANK
(ROUND 0)
AREA : ASP Page 2 of 2
8. How can you pass informaion from one page to another
post, get, hidden variables, cookies, session variables, HTTP Header
9. What are the differences between Application Object and Session Object
The Session object
The Session object is used to store information about the current user's Web-server session. Variables stored with this object exist as long as the user's session is active, even if more than one application is used. This object supports one method, Abandon, which (believe it or not!) abandons the current Web-server session, destroying any objects, and supports two properties, SessionID, containing the identifier for the current session, and Timeout, specifying a time-out value for the session. One thing to bear in mind about the session identifier: It's not a GUID. It's only good as long as the current Web-server session is running. If you shut down the Web-server service, the identifiers will start all over again. So don't use it to create logon IDs, or you'll have a bunch of duplicates and one heck of a headache.
The Application object
The Application object can store information that persists for the entire lifetime of an application (a group of pages with a common root). Generally, this is the whole time that the IIS server is running. This makes it a great place to store information that has to exist for more than one user (such as a page counter). The downside of this is that since this object isn't created anew for each user, errors that may not show up when the code is called once may show up when it is called 10,000 times in a row. In addition, because the Application object is shared by all the users, threading can be a nightmare to implement.
10.How do you retrieve data from the DB from an ASP page?
Using ADODB or from a COM component
SAMPLE QUESTION BANK
(ROUND 0)
AREA : C # Page 1 of 2
1. What standard types does C# supply?
C# supports a very similar range of basic types to C++, including int, long, float, double, char, string, arrays, structs and classes. However, don't assume too much. The names may be familiar, but some of the details are different. For example, a long is 64 bits in C#, whereas in C++ the size of a long depends on the platform (typically 32 bits on a 32-bit platform, 64 bits on a 64-bit platform). Also classes and structs are almost the same in C++ - this is not true for C#.
2. Is it true that all C# types derive from a common base class?
Yes and no. All types can be treated as if they derive from object (System.Object), but in order to treat an instance of a value type (e.g. int, float) as object-derived, the instance must be converted to a reference type using a process called 'boxing'. In theory a developer can forget about this and let the run-time worry about when the conversion is necessary, but in reality this implicit conversion can have side-effects that may trip up the unwary.
3. What are the fundamental differences between value types and reference types?
C# divides types into two categories - value types and reference types. Most of the basic intrinsic types (e.g. int, char) are value types. Structs are also value types. Reference types include classes, interfaces, arrays and strings. The basic idea is straightforward - an instance of a value type represents the actual data (stored on the stack), whereas an instance of a reference type represents a pointer or reference to the data (stored on the heap).
4. Does C# support multiple inheritance (MI)?
C# supports multiple inheritance of interfaces, but not of classes
5. What types of object can I throw as exceptions?
Only instances of the System.Exception classes, or classes derived from System.Exception. This is in sharp contrast with C++ where instances of almost any type can be thrown.
6. What are delegates?
A delegate is a class derived from System.Delegate. However the language has a special syntax for declaring delegates which means that they don't look like classes. A delegate represents a method with a particular signature. An instance of a delegate represents a method with a particular signature on a particular object (or class in the case of a static method).
7. What is an efficient way of handling string manipulations?
Using the StringBuilder class
8. How does one learn what is the type of any given object
ANSWER: Call the GetType method (which is available for all objects)
SAMPLE QUESTION BANK
(ROUND 0)
AREA : C# Page 2 of 2
QUESTION: Does C# allow multiple class inheritance or single class inheritance
ANSWER: C# allows single Class inheritance and multiple interface implementation
QUESTION: If i want to implement a collection class and if i want consumers of my class to be able to enumerate through my collection, what interface should i implement ?
ANSWER: IEnumerable
QUESTION: Some of the charateritics of a struct in C#
ANSWER: Its a value type. They are sealed so they cannot be inherited from. They cannot declare a default parameterless constructor
QUESTION: All values types inherit from which class in C#. Some of their characteristics
ANSWER: System.ValueType. They are stored on the stack. When they are passed to methods they are passed by value (i.e. a copy)
QUESTION: Some of the differences in C# when compared to C++
ANSWER: Main method has a capital M, Classes do not end with a semi colon. Booleans do not convert to integers. There are no header files. There are no global variables. There is no multiple inheriance (multiple interface implementation is there).
QUESTION: How is a value type which is residing on the stack, moved to the heap.
ANSWER: You box the value type (i.e convert it to an object).
SAMPLE QUESTION BANK
(ROUND 0)
AREA : C++ Page 1 of 2
1) Why we need to "virtual destructors" ?
Ans - To enable proper destruction of derived class objects addressed thru a base class pointer
2) Why we need smart pointers ? and how we implement them
Ans - Smart pointers are C++ classes/templates that can wrap up an arbitrary heap based pointer. Smart pointers enable proper clean up of the heap based pointers both during normal function execution and when the control transfers to a catch block. The idea tis to encapsulate the heap based pointer in smart pointer object that is instantiated as a local/stack variable. When an exception happens , the C++ runtime will trigger stack un winding and also would ensure that destructors of the stack variables are called by the runtime automatically. Here the dtor of the smart pointer (being a stack variable) would ensure that it automatically frees up memory of the smart pointer.
e.g
void foo()
{
try
{
std::autoptr<SomeType> stackvar = std::autoptr<SomeType>( new SomeType() ); //Sometype is the heap based
// pointer wrapped up in smart // pointer
}
catch( ... )
{
//runtime will take care of calling the dtor of the smart pointer to enable freeing the memory of the encapsulated //pointer
}
}
3) Explain the difference between 'C' macros and templates ?
'C' Marcos are statements that will be expanded by the pre processor and hence they do not obey the naming and typing rules of the language (C++). They are pure text substitution. C++ templates are expanded by the compiler during the compilation stage , but templates obey the naming, typing rules of C++. Templates are first class user defined abstractions just like a class
4) Explain as to when to use inheritence and when to use templates?
When the behaviour is standardized but the types can be arbitary, use tempolates for example assuming stack is a type the behaviour of the stack is standardized in terms of push and pop, there is no need to override these behaviours. We can have stack of double, long or any user defined type. Therefore this candidate is a good one for using templates. If behaviours are not standardized use Inheritence. A good example is an abstration like Shape, behaviour like Draw cannot be standardized as "drawing" for a ploygon will be different from "drawing" for a circle
5) What are the different situations whereing copy ctor is invoked ?
Copy ctors are invoked during the following situations -
a) When a function returns an object by value
b) when a function sends a parameter as an object by value
SAMPLE QUESTION BANK
(ROUND 0)
AREA : C++ Page 2 of 2
6) Are return values treated as a part of overloaded methods ?
NO
7) Expalin the need of virtual base classes ?
Virtual base classes are required when we have multiple inheritence .
Consider this inheritence hierarchy
class A
{
};
class B : public virtual A
{
};
class C :public virtual A
{
};
class D : public B, public C //note the use of multiple inheritence
{
};
Now by having the virtual base classes class D will have only one copy of A
8) Explaing what are function objects ?
Function objects are nothing but C++ classes or templates that overload the function call operator. Function Objects serve to provide an encapsulated way of defining and using function pointers in an application
e.g
class A
{
operator()(void* a , int b); //the overloaded function call serves to provide the declaration of the function pointer
};
No comments:
Post a Comment
Write your openion about my blog spot..To get automatic facebook updates like my Pagehttps://www.facebook.com/shivashankar4u ..It takes only 1 min to write the comment and to like the page.. Thanks.