AmbitionBox
Discover Best Places to work in India
Discover best places to work
Compare & find best workplace
Bring your workplace to life
Highlight your company's perks
Read reviews for 6L+ companies
Rate your former or current company
Discover salaries for 8L+ companies
Calculate your take home salary
Check your market value
Help other jobseekers
Read interviews for 90K+ companies
Interviews questions for 1K+ colleges
Contribute your interview questions
C# Programming
Which of the following statements are correct?
String is value type
String literals can contain any character literal including escape sequences
The equality operators are defined to compare values of string objects as well as references
All of the mentioned
Answer: Option (B)
Which of these operators can be used to concatenate two or more String objects?
+
+=
&
||
string s1 = “Hello”+ ” I ” + “Love” + ” ComputerScience “; Console.WriteLine(s1); Hello I Love ComputerScience.
The Method use to remove white space from string?
Split()
Substring()
Trim()
TrimStart()
Perfectly removes a whitespace from string whereas TrimStart() removes a string of characters from the end of the string.
Which of these will happen if recursive method does not have a base case?
infinite loop condition occurrence
System gets hanged
After 10000 executions program will be automatically stopped.
None of the mentioned
If a recursive method does not have a base case which is necessary to meet the end of condition then an infinite loop occurs which results in stackoverflow exception error.
What is Recursion in CSharp defined as?
Recursion is another form of class
Recursion is another process of defining a method that calls other methods repeatedly
Recursion is a process of defining a method that calls itself repeatedly
Recursion is a process of defining a method that calls other methods which in turn calls this method
Recursion is the process of defining something in terms of itself. It allows us to define method that calls itself repeatedly until it meets some base case condition.
Which of these is not a correct statement?
A recursive method must have a base case
Recursion always uses stack
Recursion is always managed by C# Runtime environment
Recursive methods are faster that programmer written loop to call the function repeatedly using a stack
No matter whatever is the programming language recursion is always managed by operating system.
Which of these data types is used by operating system to manage the Recursion in Csharp?
Array
Queue
Tree
Stack
Answer: Option (D)
Which of these methods is an alternative to getChars() that stores the characters in an array of bytes?
getBytes()
GetByte()
giveByte()
Give Bytes()
getBytes() stores the character in an array of bytes. It uses default character to byte conversions.
What will be the output of the given code snippet?
staticvoid main(String args[])
{
char chars[]={'x', 'y', 'z'};
String s =newString(chars);
Console.WriteLine(s);
}
x
xy
z
xyz
String(chars) is a constructor of class string, it initializes string s with the values stored in character array chars, therefore s contains “xyz”. Output :xyz
Which of these methods can be used to convert all characters in a String into a character array?
CharAt()
getChars()
TocharArray()
Answer: Option (C)
Join India’s largest community to research company culture
Are you a student or working professional?
Student/Never worked
I am a student/I have never worked
Working Professional
I am working/I have worked before
What are your preferred job locations?
Popular Cities
Other Cities
Follow your preferred designations/job profiles
Suggestions based on your job profile
vs
Similar Companies