| Back to Questions Page |
| |
| Question |
How is the using() pattern useful? What is IDisposable? How
does it support deterministic finalization?
|
Rank |
Answer Posted By |
|
Question Submitted By :: Gvsk |
| This Interview Question Asked @ IntraLogic |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer | The using statement defines a scope at the end of which an
object will be disposed.
How to use
using (expression | type identifier = initializer) statement
where:
expression
An expression you want to call Dispose on upon exiting the
using statement.
type
The type of identifier.
identifier
The name, or identifier, of the type type. It is possible
to define more than one identifier of type type. Precede
each identifier = initializer with a comma.
initializer
An expression that creates an object.
statement
The embedded statement or statements to executed.
You create an instance in a using statement to ensure that
Dispose is called on the object when the using statement is
exited. A using statement can be exited either when the end
of the using statement is reached or if, for example, an
exception is thrown and control leaves the statement block
before the end of the statement.
The object you instantiate must implement the
System.IDisposable interface.
Example
// cs_using_statement.cs
// compile with /reference:System.Drawing.dll
using System.Drawing;
class a
{
public static void Main()
{
using (Font MyFont = new Font("Arial", 10.0f),
MyFont2 = new Font("Arial", 10.0f))
{
// use MyFont and MyFont2
} // compiler will call Dispose on MyFont and
MyFont2
Font MyFont3 = new Font("Arial", 10.0f);
using (MyFont3)
{
// use MyFont3
} // compiler will call Dispose on MyFont3
}
}
Reference Link: http://msdn2.microsoft.com/en-
us/library/yh598w02(VS.71).aspx  |
| Chirantan |
| |
| |
| Question |
What is the difference between XML Web Services using ASMX
and .NET Remoting using SOAP? |
Rank |
Answer Posted By |
|
Question Submitted By :: Gvsk |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer | XML web services using ASMX conform to the WS-I basic
profile, which means that it meets certain interoperability
standards.
.NET Remoting isn't implemented with much concern for
interoperability. Services implemented using .NET
Remoting, even if they use an open standard like SOAP as
the transport layer, cannot be consumed by non-.NET clients.  |
| Skybeaver |
| |
| |
| Question |
Describe what an Interface is and how it?s different from a
Class. |
Rank |
Answer Posted By |
|
Question Submitted By :: Gvsk |
| This Interview Question Asked @ Spinsys |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer | In Interface,we cannot specify any definition inside but
where as class we can.  |
| Mouli |
| |
| |
|
|
| |
| Answer | interface is define as the declaration part of the function.
interface is differ from the class by class can access the
interface but interface cannot access the class  |
| Kalaivani |
| |
| |
| Answer | Class can hold both member function and data, depending upon
the member function class becomes abstract class and etc.
but if a class contain only pure virtual function then it
becomes "Interface",remember all functions should be pure
having no data member.  |
| Nishikant Sahu |
| |
| |
| Answer | interface is collection of abstract method.we can not
define any method in interface.we can implement that
abstract method by using the class.there is a restriction
in interface that you have to implement all the abstract
method in the class which is declared in interface.and we
can not create an object of interface.if we want to execute
the interface method then we have to implement first that
interface in any class after that create the object of
class ,then we can access execute that method
but in class we have to define the methods, which is
declered.we can also access that method through the object
of the class.  |
| Amit Upadhyay |
| |
| |
| Question |
Describe the difference between a Thread and a Process? |
Rank |
Answer Posted By |
|
Question Submitted By :: Gvsk |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer | We can have multiple threads in a single process.Thus we
can say threads are working units of a process.  |
| Guest |
| |
| |
| Answer | 1)
process is self loadable
while
thread is depends on operating system
2)
communication is possible between processes through some
mechanism
ex:shared memory, message queues
communication is possible between threads directly  |
| Subbu |
| |
| |
| Answer | A thread is building block of process, there can be
multiple thread or at least one thread per process.
Process is self loadable but thread need a process to run.  |
| Anshu |
| |
| |
| Answer | Thread uses shared memory. But process uses different
memory.  |
| P Suresh Kumar |
| |
| |
| Answer | We can execute a process (EXE) but threads can be created
and executed from inside a process  |
| Nk |
| |
| |
| Answer | Thread is a path for execution and the executable which is
running is called a process.  |
| Pds |
| |
| |
| Question |
In a class only declaration of the function is there but
defintion is not there then what is that function?
|
Rank |
Answer Posted By |
|
Question Submitted By :: Guest |
| This Interview Question Asked @ Hughes |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer | virtual function  |
| Guest |
| |
| |
| Answer | abstract functions
if u specify any function as abstract,there itself in it's
home class u can't find solution,u have to define those
function in the later derived classes through inheritance.  |
| Santhi |
| |
| |
| Answer | If a function does't have definition is a pure virtual
function . The class which have the pure virtual function is
called as Abstract Class or Interface.  |
| Bharat |
| |
| |
| Answer | In a class only declaration of function is there but
definition is not there then such functions are called as
abstract functions.  |
| Manju |
| |
| |
| Question |
polymorphism means? |
Rank |
Answer Posted By |
|
Question Submitted By :: Guest |
| This Interview Question Asked @ BFL |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer | It is a feature that allows one interface to be used for
general class of actions. The specific action is determined
by the exact nature of the situation. In general
polymorphism means "one interface, multiple methods", This
means that it is possible to design a generic interface to
a group of related activities. This helps reduce complexity
by allowing the same interface to be used to specify a
general class of action. It is the compiler's job to select
the specific action (that is, method) as it applies to each
situation  |
| Swetcha |
| |
| |
| Answer | The above answer is well explained. In technical terms it
can be explained as same function name with different
signature. Signature means only interms of arguments, and
not for return types. The idea is very simple and is a
feature which make the end user comfortable, and as Swetcha
said, it is finally the compiler will decide, which function
to call when, according to the type of data passed to the
function.
eg. int add(int, int)
double add(double, double)
char add(char, char)
but the following is not possible
int add(int, int)
char add(int, int)  |
| Sujith |
| |
| |
| Question |
what is the diff b/n c and c++
a. dynamic scoping
b. nested switching
c. declaration of variables in any code block
d. separation of compilation and linking
|
Rank |
Answer Posted By |
|
Question Submitted By :: Guest |
| This Interview Question Asked @ Hughes |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer | declaration of variables in any code block
 |
| Swetcha |
| |
| |
| Question |
int f() {
int I = 12;
int &r = I;
r += r / 4;
int *p = &r;
*p += r;
return I;
}
Referring to the sample code above, what is the return value
of the function "f()"?
a) 12
b) 15
c) 24
d) 17
e) 30
|
Rank |
Answer Posted By |
|
Question Submitted By :: Ramesh.chaluvadi |
| This Interview Question Asked @ Quark |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer | ans: 30 i.e 'e'  |
| Guest |
| |
| |
| Answer | int I=12;
int &r=I;
here r is a reference to I
r+=r/4;
=>r=r+r/4;
=>r=12+12/4;[r=I=12]
=>r=12+3
=>r=15
=>I=15
int *p=&r;
so, p is a pointer to r(i.e.,to I)
*p +=r;
=>*p = *p+r
=>*p=15+15
=>*p=30
=>I=30
so the return value of the f() is 30  |
| Uma Sankar Pradhan |
| |
| |
| Question |
catch(exception &e)
{
. . .
}
Referring to the sample code above, which one of the
following lines of code produces a written description of
the type of exception that "e" refers to?
a) cout << e.type();
b) cout << e.name();
c) cout << typeid(e).name();
d) cout << e.what();
e) cout << e;
|
Rank |
Answer Posted By |
|
Question Submitted By :: Ramesh.chaluvadi |
| This Interview Question Asked @ Quark |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer | cout<<typeid(e).name() is the correct one  |
| Guest |
| |
| |
| Answer | ans:c  |
| Santhoo035 |
| |
| |
| Question |
template<class T, class X> class Obj {
T my_t;
X my_x;
public:
Obj(T t, X x) : my_t(t), my_x(x) { }
};
Referring to the sample code above, which one of the
following is a valid conversion operator for the type T?
a) T operator T () { return my_t; }
b) T operator(T) const { return my_t; }
c) operator(T) { return my_t; }
d) T operator T (const Obj &obj) { return obj.my_t; }
e) operator T () const { return my_t; }
|
Rank |
Answer Posted By |
|
Question Submitted By :: Ramesh.chaluvadi |
| This Interview Question Asked @ Quark |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer | option 'e' is the correct one  |
| Guest |
| |
| |
| Question |
class X
{
public:
int x;
static void f(int z);
};
void X::f(int y) {x=y;}
What is the error in the sample code above?
a) The class X does not have any protected members.
b) The static member function f() accesses the non-static z.
c) The static member function f() accesses the non-static x.
d) The member function f() must return a value.
e) The class X does not have any private members.
|
Rank |
Answer Posted By |
|
Question Submitted By :: Ramesh.chaluvadi |
| This Interview Question Asked @ Quark |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer | option 'c' is the answer  |
| Guest |
| |
| |
| Question |
The "virtual" specifier in a member function enables which
one of the following?
a) Monmorphism
b) Late binding
c) Metamorphism
d) Solomorphism
e) Inheritance
|
Rank |
Answer Posted By |
|
Question Submitted By :: Ramesh.chaluvadi |
| This Interview Question Asked @ Quark |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer | Late binding  |
| Guest |
| |
| |
| Answer | Metamorphism  |
| Leo Theboss |
| |
| |
| Answer | Late Binding  |
| Richa |
| |
| |
| Question |
Which one of the following describes characteristics of
"protected" inheritance?
a) The base class has access only to the public or protected
members of the derived class.
b) The derived class has non-public, inheritable, access to
all but the private members of the base class.
c) The derived class has access to all members of the base
class.
d) The private members of the base class are visible within
the derived class.
e) Public members of the derived class are privately
accessible from the base class.
|
Rank |
Answer Posted By |
|
Question Submitted By :: Ramesh.chaluvadi |
| This Interview Question Asked @ Quark |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer | Answer is b)  |
| Guest |
| |
| |
| Answer | d  |
| Roshanpr |
| |
| |
| Answer | the right answer is b
option <b>  |
| Ravi |
| |
| |
| Question |
class Foo {
public:
Foo(int i) { }
};
class Bar : virtual Foo {
public:
Bar() { }
};
Bar b;
Referring to the above code, when the object 'b' is defined,
a compiler error will occur. What action fixes the compiler
error?
a) Adding a virtual destructor to the class Bar
b) Adding a constructor to Bar which takes an int parameter
c) Adding "Foo()" to the Bar constructor
d) Adding a copy constructor to the class Foo
e) Adding "Foo(0)" to the Bar::Bar initializer list
|
Rank |
Answer Posted By |
|
Question Submitted By :: Ramesh.chaluvadi |
| This Interview Question Asked @ Quark |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer | Ans. E  |
| Guest |
| |
| |
|
| |
|
Back to Questions Page |