InterviewSolution
This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.
| 1. |
Which of these methods of class String is used to extract a substring from a String object?(a) substring()(b) Substring()(c) SubString()(d) None of the mentionedThis question was posed to me in quiz.This interesting question is from String Formatting in section Miscellaneous topics of C# |
|
Answer» CORRECT choice is (B) Substring() The BEST explanation: NONE. |
|
| 2. |
Which of these methods of class String is used to remove leading and trailing whitespaces?(a) startsWith()(b) TrimEnd()(c) Trim()(d) TrimStart()The question was posed to me during an internship interview.The query is from String Formatting in division Miscellaneous topics of C# |
|
Answer» The correct OPTION is (c) Trim() |
|
| 3. |
What is the value returned by the function CompareTo() if the invoking string is less than the string compared?(a) zero(b) value less than zero(c) value greater than zero(d) none of the mentionedI got this question in a job interview.My question comes from String Formatting in division Miscellaneous topics of C# |
|
Answer» Correct choice is (B) value less than zero |
|
| 4. |
Choose the base class for string() method.(a) System.Array(b) System.char(c) System.String(d) None of the mentionedThe question was posed to me during a job interview.My doubt is from String Formatting topic in portion Miscellaneous topics of C# |
|
Answer» The correct option is (c) System.String |
|
| 5. |
Choose the base class for string() method.(a) System.Array(b) System.char(c) System.String(d) None of the mentionedThe question was asked in class test.I need to ask this question from Introduction of String Formatting in section Miscellaneous topics of C# |
|
Answer» Right ANSWER is (c) System.String |
|
| 6. |
Which of these operators can be used to concatenate two or more String objects?(a) +(b) +=(c) &(d) ||This question was addressed to me in my homework.The query is from Introduction of String Formatting in portion Miscellaneous topics of C# |
|
Answer» Right choice is (a) + |
|
| 7. |
Select the operators used for checking the equality in strings:(a) !=(b) >(c) =The question was posed to me in exam.Question is from Introduction of String Formatting in portion Miscellaneous topics of C# |
|
Answer» RIGHT OPTION is (a) != BEST EXPLANATION: NONE. |
|
| 8. |
Choose the constructor type used to build strings from character array.(a) public String(value)(b) public String(char[ ] value, int startIndex, int length)(c) public String(char[ ])(d) all of the mentionedThis question was posed to me at a job interview.My question is from Introduction of String Formatting topic in section Miscellaneous topics of C# |
|
Answer» The CORRECT option is (b) PUBLIC String(char[ ] VALUE, int startIndex, int length) |
|
| 9. |
Select the interfaces defined by the string class?(a) IComparable(b) IComparable(c) ICloneable(d) All of the mentionedThis question was addressed to me in unit test.The doubt is from Introduction of String Formatting topic in division Miscellaneous topics of C# |
|
Answer» CORRECT ANSWER is (d) All of the mentioned To explain I WOULD say: NONE. |
|
| 10. |
Select the namespace in which string class is built?(a) System.Text(b) System.Net(c) System.IO(d) None of the mentionedThis question was posed to me in an interview for job.This question is from Introduction of String Formatting in division Miscellaneous topics of C# |
|
Answer» The CORRECT ANSWER is (a) System.Text |
|
| 11. |
What are strings in C#?(a) a sequence of characters(b) array of characters(c) objects of built-in data type(d) a reference typeI got this question in an international level competition.I'm obligated to ask this question of Introduction of String Formatting in portion Miscellaneous topics of C# |
|
Answer» Correct choice is (c) objects of built-in DATA type |
|
| 12. |
Accessibility modifiers defined in a class are?(a) public, private, protected(b) public, internal, protected internal(c) public, private, internal, protected internal(d) public, private, protected, internal, protected internalThe question was posed to me in a job interview.My doubt stems from Accessor controls of class in chapter Miscellaneous topics of C# |
|
Answer» Right CHOICE is (d) public, private, protected, INTERNAL, protected internal |
|
| 13. |
Which of the following statements are incorrect?(a) public members of class can be accessed by any code in the program(b) private members of class can only be accessed by other members of the class(c) private members of class can be inherited by a subclass, and become protected members in subclass(d) protected members of a class can be inherited by a subclass, and become private members of the subclassThe question was asked in class test.Asked question is from Accessor controls of class in portion Miscellaneous topics of C# |
|
Answer» The correct option is (c) private members of CLASS can be inherited by a subclass, and become protected members in subclass |
|
| 14. |
Which of these access specifiers must be used for class so that it can be inherited by another subclass?(a) public(b) private(c) both public & private(d) none of the mentionedThis question was addressed to me during an online exam.Origin of the question is Accessor controls of class topic in division Miscellaneous topics of C# |
|
Answer» The CORRECT CHOICE is (a) public |
|
| 15. |
Which of these base class are accessible to the derived class members?(a) static(b) protected(c) private(d) sharedI got this question in unit test.I'd like to ask this question from Accessor controls of class in division Miscellaneous topics of C# |
|
Answer» The CORRECT ANSWER is (B) protected |
|
| 16. |
What is the process by which we can control what parts of a program can access the members of a class?(a) Polymorphism(b) Abstraction(c) Encapsulation(d) RecursionThe question was posed to me during an online exam.This interesting question is from Accessor controls of class topic in portion Miscellaneous topics of C# |
|
Answer» CORRECT CHOICE is (C) Encapsulation To EXPLAIN: NONE. |
|
| 17. |
Which of these is used as default for a member of a class if no access specifier is used for it?(a) private(b) public(c) protected internal(d) protectedThis question was posed to me during an online interview.Query is from Accessor controls of class topic in division Miscellaneous topics of C# |
|
Answer» CORRECT CHOICE is (a) private The EXPLANATION: NONE. |
|
| 18. |
Which among these access specifiers should be used for main() method?(a) private(b) public(c) protected(d) none of the mentionedThe question was asked in class test.My enquiry is from Accessor controls of class in portion Miscellaneous topics of C# |
|
Answer» Correct choice is (b) public |
|
| 19. |
Which operator is commonly used to find the size of the type of C#?(a) size()(b) sizeof(type)(c) both size() & sizeof(type)(d) none of the mentionedThe question was asked during an interview.My question comes from Pointers Operation topic in portion Miscellaneous topics of C# |
|
Answer» CORRECT answer is (b) SIZEOF(TYPE) To EXPLAIN I would say: None. |
|
| 20. |
Choose the statement which defines the Nullable type Correctly:(a) A special version of a value type that is represented by a structure(b) A nullable type can also store the value null(c) Nullable types are objects of System.Nullable, where T must be a non nullable value type(d) All of the mentionedThe question was posed to me in an interview.The above asked question is from Pointers Operation in chapter Miscellaneous topics of C# |
|
Answer» The correct answer is (d) All of the mentioned |
|
| 21. |
A structure pointer points to __________(a) first member of structure(b) first two members of structure(c) whole structure(d) only to the last member of structureThis question was posed to me in unit test.The doubt is from Pointers Operation topic in section Miscellaneous topics of C# |
|
Answer» The CORRECT answer is (c) whole structure |
|
| 22. |
Among the given pointers which of the following cannot be incremented?(a) int(b) char(c) float(d) voidI got this question in exam.The question is from Pointers Operation in chapter Miscellaneous topics of C# |
|
Answer» The CORRECT ANSWER is (d) void |
|
| 23. |
Consider an integer pointer . *a.++*a will increment ___________ while *a++ will increment __________(a) value at a,address contained in a(b) value at a,value at a(c) address contained in a, address contained in a(d) address contained in a, value at aThis question was posed to me during an interview.I want to ask this question from Unsafe code & Pointers Basics topic in portion Miscellaneous topics of C# |
|
Answer» CORRECT option is (a) value at a,ADDRESS CONTAINED in a The BEST explanation: None. |
|
| 24. |
How many values can be returned from a function simultaneously using pointers?(a) 1(b) 2(c) 3(d) as many as user wantsThe question was posed to me during an interview for a job.My question is taken from Unsafe code & Pointers Basics topic in portion Miscellaneous topics of C# |
|
Answer» Correct ANSWER is (d) as many as USER wants |
|
| 25. |
Among the given pointer which of the following cannot be incremented?(a) int(b) char(c) float(d) voidI had been asked this question in homework.Origin of the question is Unsafe code & Pointers Basics in chapter Miscellaneous topics of C# |
|
Answer» RIGHT ANSWER is (d) void Easiest EXPLANATION - NONE. |
|
| 26. |
Which among the following is referred as an array of pointers?(a) int *p;(b) int (*)p;(c) int p[4];(d) int*[4] p;The question was asked in an interview.This interesting question is from Unsafe code & Pointers Basics in section Miscellaneous topics of C# |
|
Answer» CORRECT option is (d) INT*[4] P; For EXPLANATION: None. |
|
| 27. |
Which of the following job is done by the instruction ++*p for an integer pointer p?(a) increment value contained at address p(b) increment address contained in p(c) Both increment value contained at address p and increment address contained in p(d) neither increment value contained at address p nor increment address contained in pThis question was addressed to me by my school teacher while I was bunking the class.This is a very interesting question from Unsafe code & Pointers Basics topic in section Miscellaneous topics of C# |
|
Answer» RIGHT choice is (a) increment value contained at ADDRESS p To explain:class UnsafeCode { UNSAFE static VOID MAIN() { int n = 10; int* p = &n; Console.WriteLine(*p); } } Output : 10 +1 = 11. |
|
| 28. |
After incrementing a float pointer ptr by 1 it would be incremented by __________(a) 1 byte(b) 2 bytes(c) 3 bytes(d) 4 bytesThe question was asked in an interview for internship.Origin of the question is Unsafe code & Pointers Basics topic in section Miscellaneous topics of C# |
|
Answer» The CORRECT OPTION is (d) 4 bytes |
|
| 29. |
What is the size of a char pointer?(a) 1 byte(b) 2 byte(c) 3 byte(d) 4 byteThis question was posed to me in an interview for job.Asked question is from Unsafe code & Pointers Basics topic in chapter Miscellaneous topics of C# |
|
Answer» Correct answer is (B) 2 byte |
|
| 30. |
Choose the correct statement among the given statements?(a) Use of return statement is necessary in every function(b) Return statement may not be followed by a parenthesis(c) A program may contain more than one return statement(d) Return statement may not return a valueI had been asked this question in unit test.Origin of the question is Unsafe code & Pointers Basics topic in chapter Miscellaneous topics of C# |
|
Answer» Correct OPTION is (a) USE of RETURN STATEMENT is necessary in every function |
|
| 31. |
Which among the given operators is referred to as ‘address of’ operator?(a) *(b) ^(c) &(d) ~This question was posed to me in class test.Asked question is from Unsafe code & Pointers Basics topic in portion Miscellaneous topics of C# |
|
Answer» The correct choice is (c) & |
|
| 32. |
Pointer variable is used to hold the _________ of the variable.(a) Value(b) Address(c) Value and Address(d) Name of the variableThis question was posed to me in an international level competition.My question is taken from Unsafe code & Pointers Basics topic in chapter Miscellaneous topics of C# |
|
Answer» RIGHT answer is (B) Address To explain I would SAY: By DEFINITION. |
|