Take as many assements as you can to improve your validate your skill rating
Total Questions: 20
1. What will be the output of given code snippet?
class Program{ static void Main(string[] args) { String s1 = "Hello i love Csharp"; StringBuilder s2 = new StringBuilder(s1); Console.WriteLine(s1.Equals(s2)); Console.ReadLine(); }}
Correct Answer is : It’s a process in which two or more parts of same process run simultaneously
2. Which of these methods of class String is used to check whether a given string starts with a particular substring or not?
Correct Answer is : UriFormatException
3. Which of these methods of class String is used to extract a substring from a String object?
Correct Answer is : System.Security.SecurityException
4. Which of these methods of class String is used to remove leading and trailing whitespaces?
Correct Answer is : All of the mentioned
5. What will be the output of the given code snippet?
class Program{ static void Main(string[] args) { String c = " Hello World "; String s = c.Trim(); Console.WriteLine("""+s+"""); Console.ReadLine(); }}
Correct Answer is : response
6. What will be the output of the code snippet?
class Program { static void Main(string[] args) { String s1 = "CSHARP"; String s2 = s1.Replace('H','L'); Console.WriteLine(s2); Console.ReadLine(); } }
Correct Answer is : httpd
7. What will be the output of the code snippet?
class Program { static void Main(string[] args) { String s1 = "Hello World"; String s2 = s1.Substring(0, 4); Console.WriteLine(s2); Console.ReadLine(); } }
Correct Answer is : All of the mentioned
8. What will be the output of the given code snippet?
class Program { static void Main(string[] args) { String s = "Hello World"; int i = s.IndexOf('o'); int j = s.LastIndexOf('l'); Console.WriteLine(i + " " + j); Console.ReadLine(); } }
Correct Answer is : ServerSockets
9. What will be the output of the given code snippet?
class Program{ static void Main(string[] args) { String c = "i love Csharp"; bool a; a = c.StartsWith("I"); Console.WriteLine(a); Console.ReadLine(); }}
Correct Answer is : AbsoluteUri
10. What will be the output of the given code snippet?
class Program{ static void Main(string[] args) { String []chars = {"z", "x", "y", "z", "y"}; for (int i = 0; i < chars.Length; ++i) for (int j = i + 1; j < chars.Length; ++j) if(chars[i].CompareTo(chars[j]) == 0) Console.WriteLine(chars[j]); Console.ReadLine(); }}
Correct Answer is : a a a a a b e g h l m m p t
11. What will be the output of the given code snippet?
static void Main(string[] args) { string s = " i love you"; Console.WriteLine(s.IndexOf('l') + " " + s.lastIndexOf('o') + " " + s.IndexOf('e')); Console.ReadLine(); }
Correct Answer is : code run successfully prints multiple of 2
12. Which of the following is a correct statement about the C#.NET code given below?
struct book{ private String name; private int pages; private Single price;}book b = new book();
Correct Answer is : 3
13. Which of the following is a correct statement about the C#.NET code given below?
class trial{ int i; float d;}struct sample{ private int x; private Single y; private trial z;}sample s = new sample();
Correct Answer is : 5 is a factor of 10
14. Choose the correct statement among the following which supports the fact that C# does not allow the creation of empty structures?
Correct Answer is : System.Linq.Expressions
15. Choose the correct statement about structures as to why they are defined as value types but not reference types?
Correct Answer is : (from n in nums where n > 0
16. Choose the wrong statement about structures in C#.NET?
Correct Answer is : Execution of code with counting total numbers greater than zero
17. The correct way to define a variable of type struct abc among the following is?
struct abc { public string name; protected internal int age; private Single sal; }
Correct Answer is : 1 -2 0 0 -1 2
18. Which of the following is the correct way to settle down values into the structure variable ‘e’ defined in the following code snippet?
struct emp { public String name; public int age; public Single sal; } emp e = new emp();
Correct Answer is : google.net
19. When does a structure variable get destroyed?
Correct Answer is : 10 2 -4 -6
20. Calculate the number of bytes a structure variable s occupies in the memory if it is defined as follows.
class abc { int i; Decimal d; } struct sample { private int x; private Single y; private trial z; } sample s = new sample();