Archive for - C

You are browsing the archives of - C.

C# Interview Questions(181-200)

Difference between value and reference type. what are value types and reference types?
Value type - bool, byte, chat, decimal, double, enum , float, int, long, sbyte, short, strut, uint, ulong, ushort
Value types are stored in the Stack
Reference type - class, delegate, interface, object, string
Reference types are stored in the Heap
What are the two kinds of [...]

C# Interview Questions(171-180)

When should you call the garbage collector in .NET?
As a good rule, you should not call the garbage collector. However, you could call the garbage collector when you are done using a large object (or set of objects) to force the garbage collector to dispose of those very large objects from memory. However, this is [...]

C# Interview Questions(161-170)

What connections does Microsoft SQL Server support?
Windows Authentication (via Active Directory) and SQL Server authentication (via Microsoft SQL Server username and password).
Between Windows Authentication and SQL Server Authentication, which one is trusted and which one is untrusted?
Windows Authentication is trusted because the username and password are checked with the Active Directory, the SQL Server authentication [...]

C# Interview Questions(151-160)

What’s a delegate?
A delegate object encapsulates a reference to a method.
What’s a multicast delegate?
A delegate that has multiple handlers assigned to it. Each assigned handler (method) is called.
Why are there five tracing levels in System.Diagnostics.TraceSwitcher?
The tracing dumps can be quite verbose. For applications that are constantly running you run the risk of overloading the machine [...]

C# Interview Questions(141-150)

Why can’t you specify the accessibility modifier for methods inside the interface?
They all must be public, and are therefore public by default.
What happens if you inherit multiple interfaces and they have conflicting method names?
It’s up to you to implement the method inside your own class, so implementation is left entirely up to you. This might [...]

C# Interview Questions(131-140)

What class is underneath the SortedList class?
A sorted HashTable.
Will the finally block get executed if an exception has not occurred?
Yes.
What’s the C# syntax to catch any possible exception?
A catch block that catches the exception of type System.Exception. You can also omit the parameter data type in this case and just write catch {}.
Can multiple catch [...]

C# Interview Questions(121-130)

Why does DllImport not work for me?
All methods marked with the DllImport attribute must be marked as public static extern.
What is a delegate?
A delegate object encapsulates a reference to a method. In C++ they were referred to as function pointers.
What is the difference between an interface and abstract class?
In the interface all methods must be [...]

C# Interview Questions(111-120)

How do I create a Delegate/MulticastDelegate?
C# requires only a single parameter for delegates: the method address. Unlike other languages, where the programmer must specify an object reference and the method to invoke, C# can infer both pieces of information by just specifying the method’s name. For example, let’s use System.Threading.ThreadStart: Foo MyFoo = new Foo(); [...]

C# Interview Questions(100-110)

How do I convert a string to an int in C#?
Here’s an example: using System;
class StringToInt
{
public static void Main()
{
String s = “105″;
int x = Convert.ToInt32(s);
Console.WriteLine(x);
}
}
How do you directly call a native function exported from a DLL?
Here’s a quick example of the DllImport attribute in action: using System.Runtime.InteropServices;
class C
{
[ DllImport("user32.dll")]
public static extern int MessageBoxA(int h, string [...]

C# Interview Questions(91-100)

What is the wildcard character in SQL?
Let us say you want to query database with LIKE for all employees whose name starts with La. The wildcard character is %, the proper query with LIKE would involve La%.
What is the role of the DataReader class in ADO.NET connections?
It returns a read-only dataset from the data source [...]

C# Interview Questions(81-90)

Can I define a type that is an alias of another type (like typedef in C++)?
Not exactly. You can create an alias within a single file with the “using” directive: using System; using Integer = System.Int32; // alias
But you can’t create a true alias, one that extends beyond the file in which it is declared. [...]

C# Interview Questions(71-80)

Why do I get a security exception when I try to run my C# app?
Some security exceptions are thrown if you are working on a network share. There are some parts of the frameworks that will not run if being run off a share (roaming profile, mapped drives, etc.). To see if this is what’s [...]

C# Interview Questions(61-70)

From a versioning perspective, what are the drawbacks of extending an interface as opposed to extending a class?
With regard to versioning, interfaces are less flexible than classes. With a class, you can ship version 1 and then, in version 2, decide to add another method. As long as the method is not abstract (i.e., as [...]

C# Interview Questions(51-60)

How can I create a process that is running a supplied native executable (e.g., cmd.exe)?
The following code should run the executable and wait for it to exit before
continuing: using System;
using System.Diagnostics;
public class ProcessTest {
public static void Main(string[] args) {
Process p = Process.Start(args[0]);
p.WaitForExit();
Console.WriteLine(args[0] + ” exited.”);
}
}
Remember to add a reference to System.Diagnostics.dll when you compile.
What is [...]

c# interview questions(41-50)

How do I create a multi language, multi file assembly?
Unfortunately, this is currently not supported in the IDE. To do this from the command line, you must compile your projects into netmodules (/target:module on the C# compiler), and then use the command line tool al.exe (alink) to link these netmodules together.
C# provides a default constructor [...]

C# Interview Questions(31-40)

Is there regular expression (regex) support available to C# developers?
Yes. The .NET class libraries provide support for regular expressions. Look at the documentation for the System.Text.RegularExpressions namespace.
Is there a way to force garbage collection?
Yes. Set all references to null and then call System.GC.Collect(). If you need to have some objects destructed, and System.GC.Collect() doesn’t seem [...]

C# interview questions(21-30)

So let’s say I have an application that uses MyApp.dll assembly, version 1.0.0.0. There is a security bug in that assembly, and I publish the patch, issuing it under name MyApp.dll 1.1.0.0. How do I tell the client applications that are already installed to start using this new MyApp.dll?
Use publisher policy. To configure a publisher [...]

C# interview questions and answers(11-20)

How do you mark a method obsolete?
[Obsolete] public int Foo() {…}
or
[Obsolete(\"This is a message describing why this method is obsolete\")] public int Foo() {…}
Note: The O in Obsolete is always capitalized.
How do you implement thread synchronization (Object.Wait, Notify,and CriticalSection) in C#?
You want the lock statement, which is the same as Monitor Enter/Exit:
lock(obj) { // code [...]

Alter Technical - C & C++

Sample Test Paper :Alter Engineering
1.

int b=10;
int *p=&b;
*p++;
printf("%d",*p);

what is the output?
2. What is the difference between malloc, calloc and realloc?
3. What does malloc return in C and C++?
4.

main()
{
char *a="hello";
char *b="bye";
char *c="hai";
int x=10,y=100;
c=(x<y>)?a:b;
printf("%s",c);
}

whats the output?
5.

void main()
{
int a,b;
a=sumdig(123);
b=sumdig(123);
printf("%d %d",a,b);
}
int sumdig(int n)
{
static int sum;
int d;
[...]

Adobe Technical - C & C++

Adope placement paper
The test predominantly consists of algorithm questions and a lot of questions on trees.
Some questions are:
C test:
Q1) linked list using recursion.
Q2) Find if a number is divisible my 3, without using %,/ or *. You can use atoi().
Q3) 2 integers A and B are given, find the no of bits that need to [...]