Search Placementyogi.com
 

C# Strings - Basic Objective Questions

1

Which of the following statements is correct about String in C#?

A.

A String is created on the stack.

B.

A String is created on the heap.

C.

A String is a primitive type.

D.

Keyword new is used to create a String.

See Answer & Explanation Lets Discuss
Correct answer is : B
Explanation

No explanation available. Let's Discuss

 
2

Which of the following statement is correct about String in C#?

A.

Methods of the String class cannot be used to operate the string.

B.

A String is mutable because it can be modified once it has been created.

C.

A String has a zero-based index.

D.

A numeric value cannot be represented in the form of a String.

See Answer & Explanation Lets Discuss
Correct answer is : C
Explanation

No explanation available. Let's Discuss

 
3

string in C# is a Reference Type.

A. True
B. False
See Answer & Explanation Lets Discuss
Correct answer is : A
Explanation

string and object are of Reference Type in C#.

 
4

What is the output of the following C# program?

using System;
namespace PlacementYogi
{
    class Strings
    {
        public static void Main(String[] args) 
        {
            String s1 = "THAT_DOG_COLOUR_IS_BROWN";
            String s2;
            s2 = s1.Substring(9, 6);
            Console.WriteLine(s2);
        }
    }
}
A.

_COLOU

B.

COLOUR

C.

OLOUR_

D.

None of these

See Answer & Explanation Lets Discuss
Correct answer is : B
Explanation

Syntax of Substring is : Substring(int startIndex, int length)

A String has a zero-based index so index 9 will point to C and taking 6 characters starting from C will yield COLOUR

 
5

Consider the following C# program:

using System;
namespace PlacementYogi
{
    class Strings
    {
        public static void Main(String[] args) 
        {
            String s1 = "THAT_DOG_COLOUR_IS_BROWN";
            Console.WriteLine(s1.Length);
        }
    }
}

Do you agree that output of this program will yield correct length of string s1 which is 24?

A. Yes
B. No
See Answer & Explanation Lets Discuss
Correct answer is : A
Explanation

String class has a property called Length which gets the number of characters in the current String object.

Here s1 is the current object.

 
 

Banner to LogicGuns.com

Hide Page Information

C# Strings - Basic Objective Questions and Answers with Explanation

Here you can find basic level C# strings interview questions with answers and explanation.

Why Strings in C#?

In this section you can learn and practice different types of basic level questions with answers on strings to improve your skills in order to face the interviews, competitive examinations and various entrance tests (CAT, GATE, GRE, MAT, Bank Exam etc.) with full confidence.

Where can I get C# Strings Basic Questions and Answers with Explanation?

PlacementYogi provides you lots of fully solved basic level strings questions and answers with explanation. Fully solved examples with detailed answer description, explanation are given and it would be easy to understand. All students, freshers can download Operators quiz questions with answers as PDF files and eBooks.

Where can I get Basic Level C# Strings Interview Questions and Answers (objective type, multiple choice)?

Here you can find objective type basic strings questions and answers for interview and entrance examination. Multiple choice and TRUE or FALSE type and YES or NO type questions are also provided.