Interview Questions and Answers
Freshers / Beginner level questions & answers
Ques 1. Name 10 C# keywords.
abstract, event, new, struct, explicit, null, base, extern, object, this
Save For Revision
Save For Revision
Bookmark this item, mark it difficult, or place it in a revision set.
Log in to save bookmarks, difficult questions, and revision sets.
Ques 2. What is public accessibility?
There are no access restrictions. All can access the public instance from anywhere.
Save For Revision
Save For Revision
Bookmark this item, mark it difficult, or place it in a revision set.
Log in to save bookmarks, difficult questions, and revision sets.
Ques 3. What is private accessibility?
Access is restricted to within the containing class.
Save For Revision
Save For Revision
Bookmark this item, mark it difficult, or place it in a revision set.
Log in to save bookmarks, difficult questions, and revision sets.
Ques 4. Class methods to should be marked with what keyword?
Static.
Save For Revision
Save For Revision
Bookmark this item, mark it difficult, or place it in a revision set.
Log in to save bookmarks, difficult questions, and revision sets.
Ques 5. Does an object need to be made to run main?
No
Save For Revision
Save For Revision
Bookmark this item, mark it difficult, or place it in a revision set.
Log in to save bookmarks, difficult questions, and revision sets.
Ques 6. Write a hello world console application.
using System;
namespace Console1
{
class Class1
{
[STAThread] // No longer needed
static void Main(string[] args)
{
Console.WriteLine("Hello world");
}
}
}
Save For Revision
Save For Revision
Bookmark this item, mark it difficult, or place it in a revision set.
Log in to save bookmarks, difficult questions, and revision sets.
Ques 7. What is recursion?
Recursion is when a method calls itself.
Save For Revision
Save For Revision
Bookmark this item, mark it difficult, or place it in a revision set.
Log in to save bookmarks, difficult questions, and revision sets.
Ques 8. What is a constructor?
A constructor performs initialisation for an object (including the struct type) or class.
Save For Revision
Save For Revision
Bookmark this item, mark it difficult, or place it in a revision set.
Log in to save bookmarks, difficult questions, and revision sets.
Ques 9. What is a destructor?
A C# destuctor is not like a C++ destructor. It is actually an override for Finalize(). This
is called when the garbage collector discovers that the object is unreachable. Finalize()
is called before any memory is reclaimed.
Save For Revision
Save For Revision
Bookmark this item, mark it difficult, or place it in a revision set.
Log in to save bookmarks, difficult questions, and revision sets.
Ques 10. Name 5 built in types.
Bool, char, int, byte, double
Save For Revision
Save For Revision
Bookmark this item, mark it difficult, or place it in a revision set.
Log in to save bookmarks, difficult questions, and revision sets.
Ques 11. Is string Unicode, ASCII, or something else?
Unicode
Save For Revision
Save For Revision
Bookmark this item, mark it difficult, or place it in a revision set.
Log in to save bookmarks, difficult questions, and revision sets.
Ques 12. Strings are immutable, what does this mean?
Any changes to that string are in fact copies.
Save For Revision
Save For Revision
Bookmark this item, mark it difficult, or place it in a revision set.
Log in to save bookmarks, difficult questions, and revision sets.
Ques 13. Name a few string properties.
trim, tolower, toupper, concat, copy, insert, equals, compare.
Save For Revision
Save For Revision
Bookmark this item, mark it difficult, or place it in a revision set.
Log in to save bookmarks, difficult questions, and revision sets.
Ques 14. What is boxing and unboxing?
Converting a value type (stack->heap) to a reference type (heap->stack), and viseversa.
Save For Revision
Save For Revision
Bookmark this item, mark it difficult, or place it in a revision set.
Log in to save bookmarks, difficult questions, and revision sets.
Ques 15. Write some code to box and unbox a value type.
// Boxing
int i = 4;
object o = i;
// Unboxing
i = (int) o;
Save For Revision
Save For Revision
Bookmark this item, mark it difficult, or place it in a revision set.
Log in to save bookmarks, difficult questions, and revision sets.
Ques 16. What is a heap and a stack?
There are 2 kinds of heap 1: a chunk of memory where data is stored and 2: a tree
based data structure. When we talk about the heap and the stack we mean the first kind
of heap. The stack is a LIFO data structure that stores variables and flow control
information. Typically each thread will have its own stack.
Save For Revision
Save For Revision
Bookmark this item, mark it difficult, or place it in a revision set.
Log in to save bookmarks, difficult questions, and revision sets.
Ques 17. What is a pointer?
A pointer is a reference to a memory address.
Save For Revision
Save For Revision
Bookmark this item, mark it difficult, or place it in a revision set.
Log in to save bookmarks, difficult questions, and revision sets.
Ques 18. What does new do in terms of objects?
Initializes an object.
Save For Revision
Save For Revision
Bookmark this item, mark it difficult, or place it in a revision set.
Log in to save bookmarks, difficult questions, and revision sets.
Ques 19. What is a struct?
Unlike in C++ a struct is not a class it is a value type with certain restrictions. It is
usually best to use a struct to represent simple entities with a few variables. Like a Point
for example which contains variables x and y.
Save For Revision
Save For Revision
Bookmark this item, mark it difficult, or place it in a revision set.
Log in to save bookmarks, difficult questions, and revision sets.
Ques 20. Describe 5 numeric value types ranges.
sbyte -128 to 127, byte 0 255, short -32,768 to 32,767, int -2,147,483,648 to
2,147,483,647, ulong 0 to 18,446,744,073,709,551,615
Save For Revision
Save For Revision
Bookmark this item, mark it difficult, or place it in a revision set.
Log in to save bookmarks, difficult questions, and revision sets.
Ques 21. Write code for a case statement.
switch (n)
{
case 1:
x=1;
break;
case 2:
x=2;
break;
default:
goto case 1;
}
Save For Revision
Save For Revision
Bookmark this item, mark it difficult, or place it in a revision set.
Log in to save bookmarks, difficult questions, and revision sets.
Most helpful rated by users:
- Name 10 C# keywords.
- What is public accessibility?
- .NET Stands for?
- What is private accessibility?
- What is protected accessibility?
Related interview subjects
| LINQ perguntas e respostas de entrevista - Total 20 questions |
| C# perguntas e respostas de entrevista - Total 41 questions |
| ASP .NET perguntas e respostas de entrevista - Total 31 questions |
| Microsoft .NET perguntas e respostas de entrevista - Total 60 questions |
| ASP perguntas e respostas de entrevista - Total 82 questions |