Which of the following
properties related to the network errors is generated by Webexception?
Answer
Answer
- Get
- Send
- Response
- Status
How can you code to
display “This is XML” in XML?
Answer
Answer
- <pages xmlns= “” “”>
<TextBlock>
This is XML
</TextBlock>
</Pages> - <page xmlns= “” “”>
<Text>
This is XML
</Text>
</Page> - <page xmlns= “”
“”>
<TextBlock>
This is XML
</TextBlock>
</Page>
Which of the following
is neccessary condition for implementing delegates?
Answer
Answer
- class declaration
- inheritance
- run time polymorphism
- exception
C# has support for
strongly-typed function pointers via the keyword?
Answer
Answer
- delegate
- variable
- class
- methods
The expression of a lock
statemenet must denote a value of a type known to be a?
Answer
Answer
- reference type
- value-type
- None of the above
Which statement is
correct about the C#. NET code snippet given below?
Stack st = new Stack();
st. Push(“Csharp”);
st.Push(7.3);
st.Push(8);
st.Push(‘b’);
st. push(true);
Answer
Stack st = new Stack();
st. Push(“Csharp”);
st.Push(7.3);
st.Push(8);
st.Push(‘b’);
st. push(true);
Answer
- Unsimilar elements like “Csharp”, 7.3,8 cannot be
stored in the same stack collection.
- Boolean values can never be stored in Stack collection
- Perfectly worable code
- All of the mentioned
Which statemenet about a
string is correct?
Answer
Answer
- A String is created on the stack
- Whether a String is created on the stack or the heap
depends on the length of the string
- A String is create on
the heap
- A String can be created by using the statemenet String
s1 = new string
What is the output when
following code is executed?
static void Main(stirng[] args){
int[] array = new int[] {4, 8, 12, 16, 20};
for(int value = 0; value < array.length; value += 2){
array[value] = array[value] * array[value];
console.Write(array[value] + ” “);
Answer
static void Main(stirng[] args){
int[] array = new int[] {4, 8, 12, 16, 20};
for(int value = 0; value < array.length; value += 2){
array[value] = array[value] * array[value];
console.Write(array[value] + ” “);
Answer
- 16 156 372
- 32 172 420
- 16 144 400
- 46 256 432
Which statemenet is
correct about an Exception?
Answer
Answer
- It occurs during compilation
- It occurs during linking
- It occurs at run time
- It occurs during Just-In-Time compilation
- It occurs during loading of the program
Chosse the correct
statemenets about the LINQ? (Check all that apply)
Note: There may be more than one right answer
Answer
Note: There may be more than one right answer
Answer
- The main concept behind the linq query
- Linq makes use of for each loop to execute the query
- It is not required that
linq should make use of IEnumerable Interface
- None of the mentioned
Chosse the method
defined by MemberInfo:
Answer
Answer
- GetCustomAttributes()
- IsDefined()
- GetCustomerAttributesData()
- All of the above
Which of the following
C# code snippets correctly copies the contents of one string into another?
Answer
Answer
- String s1 = “Upwork”;
String s2;
s2 = s1; - String s1 = “Upwork” ;
String s2;
s2 = String.Concat(s1, s2); - String s1 = “Upwork”;
String s2;
s2 = String.Copy(s1); - String s1 = “Upwork”;
String s2;
s2 = s1.Replace(); - String s1 = “Upwork”;
String s2;
s2 = s2.StringCopy(s1);
Which of the following
benifits do we get on running managed code under CLR
1. Type safety of the code running under CLR is assured
2. It is ensured that an application would not access the memory that is not authorized to access
3. It launches seprate process for every application runing under it.
4. The resources are Garbage collected
Answer
1. Type safety of the code running under CLR is assured
2. It is ensured that an application would not access the memory that is not authorized to access
3. It launches seprate process for every application runing under it.
4. The resources are Garbage collected
Answer
- Only 1 and 2
- Only 2, 3 and 4
- Only 1, 2 and 4
- 4 Only
- All of the above
Assume 2 column are
named Product and Category. How can they be stored based on first by category
and then by product name
Answer
Answer
- var sortedProds = _db.Products.Orderby(c =>
c.Category)
- var sortedProds = _db.Products.Orderby(c =>
c.Category + ThenBy(n => n.Name))
- var sortedProds =
_db.Products.Orderby(c => c.Category . ThenBy(n => n.Name))
- All of the mentioned
Which of the following
statements about delegate are UNTRUE?
Note: There may be more than one answer
Answer
Note: There may be more than one answer
Answer
- Delegates are not
type-safe
- Delegate is a user-defined type
- Only one method can be
bound with one delegate object
- Delegates can be used to implement callback
notificattion
- Delegates permit execution of a method on a secondary
thread in an ansynchronous manner
The ‘ref’ keyword can be
used as: (Check all that apply)
Note: There may be more than one right answer.
Answer
Note: There may be more than one right answer.
Answer
- Static
fucntion/subroutine
- Static data
- Instance fucntion/subroutine
- Instance data
Which among the
following is the odered collection class? (check all that apply)
Answer
Answer
- BitArray
- Queue
- HashTable
- Stack
String built using the
String class are immutable, whereas those built using the StringBuilder class
are mutable?
Answer
Answer
- True
- False
- will depend on the content
Among the given
collection which one is I/O index based? (Choose all that apply)
Note: There may be more than on right answer.
Answer
Note: There may be more than on right answer.
Answer
- ArrayList
- BitArray
- Stack
- Queue
Which of the following
is not a relational operator in C#?
Answer
Answer
- <<
- <=
- >=
- <
Which of the following
keywards is used to declare an anonymous type in C#?
Answer
Answer
- var
- new
- dynamic
- None of the above
Which of the following
is NOT a .NET Exception class?
Answer
Answer
- Exception
- StackMemoryException
- DividedByZeroException
- OutOfMemoryException
- InvalidOperationException
Which of the following
code snippets are correct way to convert a single into a string C#? (Chose all
that apply.)
Note: There may be more than one right answer.
Answer
Note: There may be more than one right answer.
Answer
- Single f = 7.5f;
String s;
s = (String) (f); - Single f =
7.5f;
String s;
s = Convert.ToString(f);
! - Single f =
7.5f;
String s;
s = f.ToString(); - Single f = 7.5f;
String s;
s = Clnt(f); - Single f = 7.5f;
String s;
s = CString(f);
Choose the class from
which the namespace ‘System.Type’ is derived:
Answer
Answer
- System.Reflection
- System.Reflection.MemberInfo!
- Both a & b
- None of the mentioned
Which of the following
are true about the following C#.NET code?
String s1, s2;
s1 = “UpWork”;
s2 = “UpWork”;
Note: There may be more than one right answer.
Answer
String s1, s2;
s1 = “UpWork”;
s2 = “UpWork”;
Note: There may be more than one right answer.
Answer
- Cretaing String objects cannot be created without using
new
- Only one object will get
created
- s1 and s2 both will
refer to the same object
- Two objects will get created, one pointed to by s1 and
another pointed to by s2
- s1 and s2 are references
to the same object
Which of the following
keywords is used to manually throw an exception?
- try
- finally
- throw
- catch
Which String method is
used to compare two string?
Answer
Answer
- Compare_To
- Compare()
- Copy()
- CoCat()
In C#.NET, if we do not
catch the exception thrown at runtime then which of the following will catch
it?
Answer
Answer
- Compiler
- CLR
- Linker
- Loader
- Operating system
Choose the incorrect
statement among the following about the delegate?
Answer
Answer
- Delegates are reference types
- Delegates are object oriented
- Delegates are type-safe
- None of the above
Which of the following
statemenet are correct about delegate?
Note: There may be more than one right answer
Answer
Note: There may be more than one right answer
Answer
- Delegates are reference
types
- Delegates are object
oriented
- Delegates are type-safe
- Delegates serve the same purpose as function pointers
in C and pointers to member function operators in C++!
- Only one method can be called using a delegate
- Delegate are secure
Which of the following
are not ordered collection classes? (choose all that apply.)
Note: There may more than one right answer
Answer
Note: There may more than one right answer
Answer
- Map
- Stack
- Queue
- BitArray
- HashTable
What does the following
code block define? check all that apply.
class Gen {
T ob;
}
Note: There may be more than one right answer.
Answer
class Gen {
T ob;
}
Note: There may be more than one right answer.
Answer
- Generics class decleration
- Decleration of variable
- Generic constructor
decleration
- All of the mentioned
Which of the following
is correct way to convert a string to an int in C#?
Note: There may be more than one right answer.
Answer
Note: There may be more than one right answer.
Answer
- String s =
“456”;
int i;
i = (int)s; - String s = “456”;
int i;
i = int.Parse(s); - String s = “456”;
int i;
i = int32.Parse(s); - String s =
“456”;
int i;
i = Convert.ToInt32(s); - String s =
“456”;
int i;
i = CInt(s);
What is true about a
sealed class in C#?
Answer
Answer
- A sealed
class cannot be inherited by any other class and sealed classes are
primaily used to prevent derivation
- The source code of sealed class cannot be decompiled
from the assembly
- A sealed class does not have any public methods and its
operation are sealed
- None of the above
Which of the following
statement are correct about an ArrayList collection that implement the
IEnumerable interface?
Answer
Answer
- The ArrayList class contains an inner class that
implements the IEnumerator interface
- The inner class of ArrayList can access ArrayList
class’s members
- The access members of ArrayList from the inner class,
it is necessary to pass ArrayList class’s reference to it
- All of the above
Choose the correct
statement about system.Type namespace.
Answer
Answer
- Core of the reflection subsystem as it encapsulates a
type
- Consists of many methods and properties that can be
used to obtain information about a type at runtime
- Both a & b
- None of the above
Which feature allows you
to obtain information about the use and capabilities of type runtime?
Answer
Answer
- Runtime type ID
- Reflection
- Attributes
- None of the mentioned
verbatim string literal
is better used for?
Answer
Answer
- Convenience and better readability of string text
consist of backlash characters
- Used to initialize multi line strings
- To embed a quotation mark by using double quotation
marks inside a verbatim string
- All of the
above
Which of the following
components of the .Net framework provide an extensible set of classes that can
be used by any .Net compliant programing language?
Answer
Answer
- NET class libraries
- Common Language Runtime
- Common Language Infrastructure
- Component Object Model
- Common Type System
Conside the following C#
code. What would be the value of d?
int? a = 10;
int? b = 11;
int? c = 12;
a = null;
int? d = a ?? b ?? c;
Answer
int? a = 10;
int? b = 11;
int? c = 12;
a = null;
int? d = a ?? b ?? c;
Answer
- 10
- 11
- 12
- None of the above