TATA ELXSI Previous Years Solved Sample Placement Papers
-
What is the output of the expression true || false?
a) true
b) false
c) null
d) 0
Ans: a) true -
Which of the following is not a primitive data type in Java?
a) byte
b) String
c) double
d) short
Ans: b) String -
What is the default value of the int data type?
a) 0
b) 1
c) null
d) Undefined
Ans: a) 0 -
Which of the following data types can store a floating-point number?
a) int
b) byte
c) double
d) char
Ans: c) double -
Which data type can store a single character?
a) String
b) byte
c) char
d) int
Ans: c) char -
How many bits does the long data type use?
a) 8
b) 16
c) 32
d) 64
Ans: d) 64 -
What's the main difference between int and Integer in Java?
a) No difference
b) Integer can store larger values than int
c) int is a primitive data type, while Integer is a class
d) int can be null, while Integer cannot
Ans: c) int is a primitive data type, while Integer is a class -
Which loop construct in Java is best suited when the number of iterations is known?
a) for loop
b) while loop
c) do-while loop
d) break statement
Ans: a) for loop -
Which is the C# class from which the UInt data type is derived?
A: System.Int16
B: System.Int32
C: System.UInt16
D: System.UInt32
Ans: DExplanation:
The UInt data type is derived from the
System.UInt32
class. -
Which is the first line of a C# program?
A: using System;
B: using system;
C: using Namespace;
D: namespace MyApplication
Ans: AExplanation:
The first line of a C# program is:
using System;
-
Which keyword is used to declare an interface in C#?
A: interface
B: Interface
C: implement
D: Implement
Ans: AExplanation:
In C#, an interface can be declared using the
interface
keyword. An interface can contain declarations of methods, properties, indexers, and events. -
In C#, by default, the default interface methods are ___.
A: virtual
B: sealed
C: private
D: public
Ans: AExplanation:
In C#, by default, the default interface methods are virtual unless the
sealed
orprivate
modifier is used.