Motorola Previous Years Solved Sample Placement Papers
-
Which symbols are used to mark the beginning and end of a code block?
A: Square brackets []
B: Curly braces {}
C: Round brackets ()
D: Double-quotes ""
Ans: BExplanation:
C# code block begins and ends by the Curly braces {}.
-
Every C# statement is terminated by ___.
A: Colon (:)
B: Semicolon (;)
C: Comma (,)
D: Dot (.)
Ans: BExplanation:
Every C# statement is terminated by a semicolon (;).
-
Is C# programming language case-sensitive?
A: Yes
B: No
Ans: AExplanation:
Yes, C# programming language is case-sensitive.
-
In C#, a single-line comment starts with ___.
A: Two forward slashes (//)
B: Two backward slashes (\\)
C: A hash character (#)
D: A dollar character ($)
Ans: AExplanation:
In C#, a single-line comment starts with two forward slashes (//).
-
In C#, the multi-line comments are placed within the ___.
A: // and //
B: \\ and //
C:
D: /* and */
Ans: DExplanation:
In C#, the multi-line comments are placed within the /* and */.
-
What is the correct syntax to declare a variable in C#?
A: type variableName = value;
B: type variableName;
C: variableName as type = value;
D: Both A and B
Ans: DExplanation:
Both of the above syntaxes can be used to declare a variable:
type variableName = value;
- It defines the type and assigns the valuetype variableName;
- It defines the type only
-
Which data type is used to store text value in C#?
A: text
B: txt
C: string
D: str
Ans: CExplanation:
The string data type is used to store text values in C#.
-
Which C# keyword is used to define a constant?
A: define
B: fixed
C: constant
D: const
Ans: DExplanation:
The
const
keyword is used to define a constant in C#. -
What is the correct syntax to define a C# constant?
A: const type constant_name;
B: const type constant_name = value;
C: const constant_name as type;
D: const constant_name as type = value;
Ans: BExplanation:
The correct syntax to define a C# constant is:
const type constant_name = value;
Note: A const field requires a value to be provided.
-
Which is not a valid C# data type?
A: long
B: int
C: float
D: complex
Ans: DExplanation:
There is no
complex
data type in C#. -
Which is the correct order for implicit type conversion to convert a smaller to a larger type in C#?
A: char -> int -> long -> float -> double
B: bool -> char -> int -> long -> float -> double
C: char -> int -> float -> long -> double
D: bool -> char -> int -> long -> double -> float
Ans: AExplanation:
The implicit type conversion is done in the following order:
char -> int -> long -> float -> double
. -
Which is the correct order for explicit type conversion to convert a larger to a smaller type in C#?
A: double -> float -> long -> int -> char -> bool
B: double -> float -> long -> int -> char
C: float -> double -> long -> int -> char
D: float -> double -> long -> int -> char -> bool
Ans: BExplanation:
The explicit type conversion is done in the following order:
double -> float -> long -> int -> char
. -
Which is the correct C# statement to convert a float value to int explicitly?
A: int_variable = (int) float_variable;
B: int_variable = float_variable;
C: int_variable = (int) (float_variable);
D: int_variable = int *float_variable);
Ans: AExplanation:
The following syntax is used to convert a float value to int explicitly:
int_variable = (int) float_variable;