wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

OOP C#

Total questions: 121

Worksheet time: 1hrs 19mins

Name
Class
Date
1.

What will be printed to the console when this code is executed?

a)

<(`^´)>

b)

true

c)

expr

d)

¯\_(ツ)_/¯

2.

What’s wrong with this code?

a)

There are no switch statements in C#

b)

There are not enough cases

c)

There are no break statements

d)

num should be type string

3.

What possible values can a bool variable take?

a)

on and off

b)

right and wrong

c)

"true" and "false"

d)

true and false

4.

What will happen when this code is executed?

a)

"x is greater than zero" is printed

b)

"x is equal to zero" is printed

c)

"x is less than zero" is printed

d)

There will be an error

5.

What will be printed to the console when this code is executed?

a)

x is less than zero

b)

Nothing will be printed

c)

x is greater than zero

d)

x is equal to zero

6.

Which of these is not one of the primary principles of object-oriented programming?

a)

Encapsulation

b)

Polymorphism

c)

Generalisation

d)

Inheritance

7.

Why are encapsulation and abstraction important?

a)

They allow you to reuse code

b)

Change implementation details without affecting other code that uses the class

c)

Create other classes that use the same properties and methods

d)

Reduce problems into more manageable parts

8.

How do properties enable a class to meet the goals of encapsulation?

a)

They provide a public way to access a private field

b)

They make all data private

c)

They make all data public

d)

They represent data associated with a class

9.

What type of inheritance does C# support?

a)

Single and Multiple Inheritance

b)

Multiple Inheritance

c)

Single Inheritance only

10.

What is polymorphism?

a)

Where information is hidden

b)

Where information is shared with other classes

c)

The capability of one type to be used like another type

d)

A new class that inherits properties and methods from its parent.

11.

What are the types of control flow statements available in C#?

a)

Sequence, Selection & Iteration

b)

Iteration, Sequence & Jump

c)

Jump, Selection & Sequence

d)

Selection, Iteration & Jump

12.

What is the difference between the while and do statements?

a)

While is bottom-tested do is top-tested

b)

While is top-tested, do is bottom-tested

c)

Do loops may never be executed

d)

While statements will always be executed at least once

13.

How many default cases can a switch statement have?

a)

One

b)

Two

c)

At least one

d)

As many as you need

14.

Which operator is used to concatenate strings?

a)

+

b)

-

c)

/

d)

%

15.

What does the StringBuilder class do?

a)

Makes all strings immutable

b)

Creates temporary strings

c)

Creates mutable strings

d)

Manipulates immutable strings

16.

Procedure oriented Programming is also known as modular programming.

a)

True

b)

False

17.

Which of the following is a limitation of procedure oriented programming paradigm.

a)

Data/variables can be declared as global.

b)

Data/variables can be declared as Local.

c)

Main Program can be divided into sub programs.

d)

Allow User defined functions.

18.

OOP allows decomposition of a problem into number of entities called

(a)  

19.

Which of the following is a part of Java Development Kit?

a)

Java runtime environment

b)

Java Development kit

c)

Java Virtual Machine

d)

All of them

20.

How many Bytes are reserved for "Char" data type in JAVA?

a)

1 Byte

b)

2 Bytes

c)

2 Bits

d)

14 Bits

21.

A Java file with extension .class contains

a)

Java source code

b)

HTML Tags

c)

Java Bytecodes

d)

A program file written in java programming language

22.

Which of the following is not a primitive data type of JAVA?

a)

int

b)

char

c)

String

d)

float

23.

Java is a platform independent programming language because

a)

It is written almost similar to English language

b)

Java compiler translates the source code directly to the machine level language.

c)

It follows the concept of “write once and compile everywhere”.

d)

It compiles to an intermediate code targeting a virtual machine, which can be interpreted by an interpreter for a given OS.

24.

So far the declaration of main() method is concerned, which of the following specification is not valid?

a)

void

b)

public

c)

private

d)

static

25.

Scanner inp= new Scanner(System.in);

What is System.in in this declaration?

a)

Any file storing data

b)

Reference to standard input device, that is, keyboard

c)

Reference to a scanner as an input device

d)

It is a mouse as an input device

26.

Which of the following features are not common in both java and c++?

a)

The class declaration

b)

The access modifiers

c)

The Encapsulation of data and methods

d)

multiple inheritance from class

27.

What is the output of following program?

class incr

{

public static void main(String args[])

{

int i=3;

System.out.println( ++i * 5);

}

}

(a)  

28.

Which of the following can not be used as correct variable name(identifier) in JAVA?

a)

malloc

b)

final

c)

calloc

d)

string

29.

A template used to create objects...

a)

Subroutine

b)

Function

c)

Class

30.

An instance of a class...

a)

Object

b)

Function

c)

Variable

31.

In C#, what are these lines of code called?

a)

Output

b)

Comments

c)

Inputs

d)

Commands

32.

What is the outcome of these lines of code?

a)

The text "Let's get started" is printed

b)

No text is printed until the user types into the console

c)

The text "Press Enter to begin..." and the computer waits for the user to press Enter

d)

The texts "Press Enter to begin..." and "Let's get started!" are printed

33.

What is the outcome of this line of code?

a)

The computer waits for the user to type something

b)

The computer outputs whatever the user last entered

c)

The computer outputs "Console.ReadLine()"

d)

The computer copies all of the text in the console

34.

What is the outcome of this line of code?

a)

The text WriteLine is printed

b)

The text Console.WriteLine("Open Sesame!") is printed

c)

The text "Open Sesame" is printed

d)

No text is printed

35.

What is NOT a good reason to use comments in your code?

a)

Ignore a line of code to see how a program will run without it

b)

Provide context why something is written the way it is

c)

Help other people reading the code to understand it faster

d)

To instruct a computer to execute a block of code

36.
The process by which one object can acquire the properties of another object?
a)
Encapsulation
b)
Inheritance
c)
Polymorphisim
d)
Abstraction
37.
What modifiers are allowed for methods in an Interface?
a)
Private
b)
Protected
c)
Abstract
38.
Information Hiding can also be termed as...?
a)
Inheritance
b)
Encapsulation
c)
Data Hiding
39.
When deriving from a private base class, the public, protected and private members of the base class become private members of the derived class.
a)
True
b)
False
40.
Static methods cannot be accessed directly from the class level.
a)
True
b)
False
41.
An object that has more than one form is referred to as...
a)
Inheritance
b)
Interface
c)
Abstract
d)
Polymorphism
42.
Main method can be overriden
a)
True
b)
False
43.
Which of the following is not a part of OOP?
a)
Multi-Tasking
b)
Type checking
c)
Polymorphism
d)
Information Hiding
44.
Sally is continuing work on her Object-Oriented Program and is writing code for a car, truck, and bus. These items under the class called vehicle are referred to as _____.
a)
Methods
b)
Attributes
c)
Objects
d)
Items
45.
Constructors are used to...?
a)
Initialize a newly created object.
b)
To build a user interface.
c)
To create a sub class
d)
Free memory.
46.
Abstraction in OOP means the following...?
a)
Emphasis on details so the developer gets a better understanding
b)
A developer hides all but the relevant data about an object
47.
Which of the following is/are advantage of using object oriented programming?
a)
Code Reusability
b)
Can create more than one instance of a class without interference
c)
Platform independent
d)
All of the mentioned
48.
The acronym OOP stands for _______.
a)
Object-Ordering Programming
b)
Other-Object Programming
c)
Object-Organised Programming
d)
Object-Oriented Programming
49.
A big advantage of OOP over traditional programming is _______
a)
The objects are all declared Public
b)
The convenience of giving all objects in a project the same name
c)
The ability to reuse classes
d)
None of the above
50.
In a multitier application, which tier contains the user interface?
a)
The Business tier
b)
The Class tier
c)
The Data tier
d)
The Presentation tier
51.
A class allows its properties to be retrieved through _______.
a)
A Let block
b)
A Get accessor method
c)
A Set accessor method
d)
The New keyword
52.
Property procedures are _______ by default
a)
Local
b)
Module-Level
c)
Private
d)
Public
53.
The Get accessor method _______.
a)
Retrieves the current value of a property
b)
Allows you to get items from a listbox
c)
Allows a class to set its properties
d)
Returns the hidden enumerator
54.
COBOL is and object orientated language?
a)
True
b)
False
55.
What year was the first OOP language called Simula released?
a)
1985
b)
1981
c)
1974
d)
1968
56.
CC++C#Java, and JavaScript are 3rd generation languages
a)
True
b)
False
57.
Which of the following programming paradigms is geared towards maths problems?
a)
Declarative
b)
Functional
c)
Object Orientated
d)
Procedural
58.
Which of the following is a feature of declarative programming?
a)
Close to design of a computer
b)
Assembly Language
c)
Step by step instructions to solve the problem
d)
State what to achieve without giving detailed steps.
59.
Which of the following is NOT a feature of low level language?
a)
Uses facts and rules
b)
Uses labels
c)
Machine-orientate language
d)
Used for tasks connected with running the computer
60.
_________ programs have clean, goto-free, nested control structures.
a)
Logic
b)
Event Driven
c)
Structured
d)
Imperative
61.

terminates the execution of the method and gives back the control to the calling method

a)

Return

b)

Parameter

c)

Procedure

d)

Property

62.

A function that does not return a value as a return type 

a)

If

b)

Void

c)

String

d)

Int

63.

values that have one of only two values: either true or false

a)

Int

b)

string

c)

double

d)

boolean

64.

specify what kind of data a valid C# variable can hold

a)

data holder

b)

datatype

c)

data

d)

data link

65.

An ______ is created from a class. We have already created the class named Car, so now we can use this to create objects.

To create an ______ of Car, specify the class name, followed by the object name, and use the keyword new

(a)  

66.

Choose the right form

a)

it is one to inherit possible fields and methods from class to another

b)

is it possible to inherit and methods fields from class one to another

c)

it is one possible to fields another and to inherit methods from class

d)

it is possible to inherit fields and methods from one class to another

67.

Data (a)   is the process of hiding certain details and showing only essential information to the user

68.

things that happen such as a user action with the mouse or keyboard

a)

Click

b)

Event

c)

Action

d)

Property

69.

used to iterate over the elements of the collection. A control structure that processes all of the elements in an array

a)

for loop

b)

while loop

c)

for each loop

d)

do while loop

70.

Choose the right form

a)

objects classes and the two main aspects are of programming object-oriented

b)

classes and objects are the two main aspects of object-oriented programming

c)

classes are objects and the two main aspects of programming object-oriented

d)

main classes and objects are two aspects of the object-oriented programming

71.

means that you can create a base class, such as a cube, and then derive another class, such as a Box, that gets all of the properties of a Cube, but it is extended to have additional properties, such as a lid

a)

Abstraction

b)

Exception

c)

inheritance

d)

Nested Loop

72.

required to extend or modify the abstract or virtual implementation of an inherited method, property, indexer, or event

a)

overall

b)

override

c)

inherit

d)

abstract

73.

Fill the gaps.

___Declaring an integer

and printing it___

int x = 42;

LblOutput.Text=Convert.ToString(x);

a)

//.........//

b)

/*............*/

c)

<----...................----->

d)

?-------------?

74.

Which operator is used to determine the remainder?

a)

*

b)

%

c)

+

d)

-

75.

What is the alternative for x = x + 5?

a)

x += 5;

b)

x -= 4;

c)

x = y + 5;

d)

x=+5

76.

Choose the right form

a)

the meaning of Encapsulation, is to make sure that "sensitive" data is hidden from users

b)

Encapsulation meaning the of , is sure to make that data "sensitive" is hidden from users

c)

the meaning of "sensitive" Encapsulation, is sure to make data that is hidden from users

d)

from users to Encapsulation the meaning data of , is make sure that "sensitive" is hidden

77.

A (a)   is like a combination of a variable and a method, and it has two methods: a get and a set method

78.

used to convert a string to a numeric format

a)

TryParse

b)

Convert.ToInt32

c)

Convert.ToDouble

d)

String.Format

79.

Most modern programming environments allow you to create the program, edit it and run it from one application

a)

Visual Studio Code

b)

IDE

c)

C#

d)

Windows Form

80.

placed on the form to create a GUI (graphical user interface). Some commonly used are buttons, text boxes, labels, scroll bars and checkboxes

a)

Controls

b)

Tools

c)

Graphical

81.

Composition is also known as

a)

Modularity

b)

Encapsulation

c)

Aggregation

d)

Instantiation

82.

Choose the FALSE statement about abstract class

a)

It is a superclass with generic behaviour

b)

Definition of abstract method is implemented in subclass

c)

Subclasses must implement all the abstract methods in the superclass

d)

Abstract class must have more than one abstract method

83.

Which are the key concepts of imperative programming?


I. Variables

II. Commands

III. Procedures

IV. Data abstraction

a)

I, II

b)

I, III

c)

I, II, III

d)

I, II, III, IV

84.

The real-world processes that inspect and update these variables define the key concept __________ in imperative programming.

a)

Variables

b)

Commands

c)

Procedures

d)

Data abstraction

85.

Overloading operator in object oriented programming is ____________

a)

Using same operator for different effect based on operands data type

b)

Replacing the meaning of an operator with a user defined operator

c)

Using the operator for more than one in a statement

d)

Operator that uses prefix notation

86.

C programming supports ______________ variables.


I. global

II. local

III. heap

a)

I and II

b)

I and III

c)

II and III

d)

I, II and III

87.

Which of the following is NOT a primitive data type?

a)

Enumeration types

b)

Boolean types

c)

Integer types

d)

Floating point types

88.

_______________ is a key concept, enabling an object of a subclass to be treated like an object of its superclass.

a)

Classes and subclasses

b)

Data abstraction

c)

Inclusion polymorphism

d)

Parametric polymorphism

89.

Which of the following is NOT a valid data type in C?

a)

float

b)

double

c)

char

d)

str

90.

The format identifier ‘%i’ is used for _____ data type?

a)

char

b)

int

c)

float

d)

boolean

91.

What is a pointer in C language?

a)

A variable used to store address of other variable

b)

A keyword to declare variables

c)

A variable used to store address of an instruction

d)

A variable used to store address of a structure

92.

Composite values in JAVA are _______________

a)

dictionaries

b)

objects

c)

tuples

d)

lists

93.

A/ An ________________is a blueprint that defines the variables and the methods common to all objects of a certain kind.

a)

class

b)

object

c)

abstraction

d)

encapsulation

94.

Which modifier allows subclass access to the superclass from different packages?

a)

private

b)

protected

c)

public

d)

default

95.

What is the similarity between a structure, union, and enumeration?

a)

All of them let you define new values

b)

All of them let you define new pointer

c)

All of them let you define new structures

d)

All of them let you define new data types

96.

Which Feature of OOP illustrated the code reusability?

a)

Polymorphism

b)

Abstraction

c)

Encapsulation

d)

Inheritance

97.

Choose the attributes of Class: time

a)

Hours

b)

second

c)

get Hour

d)

Print Time

98.

Choose the behaviour of Class: time

a)

Hour

b)

Second

c)

PrintTime

d)

getHour

99.

As a Vehicle user, we know how to use it but its internal working are not known. In OOPs Concept, this principle is known as

a)

Encapsulation

b)

Inheritance

c)

Abstraction

d)

Polymorphism

100.

Advantages of OOPs

a)

Code Reusability

b)

Modular Programming

c)

Easy Maintenance

d)

Security

101.

Apple is a derivation of the Fruit class?

a)

True

b)

False

102.

“Write once and use it multiple time” can be achieved by

a)

(A) redundancy

b)

(B) reusability

c)

(C) modification

d)

(D) composition

103.

Insulation of the data from direct access by the program is called as

a)

(A) Data hiding

b)

(B) Encapsulation

c)

(C) Polymorphism

d)

(D) Abstraction

104.

The ability of a message or function to be displayed in more than one form is ____

a)

Data Abstraction

b)

Inheritance

c)

encapsulation

d)

Polymorphism

105.

The Object Oriented Programing has been developed to overcome the drawbacks of _____ programming.

a)

Procedural

b)

Modular

c)

Functional

d)

both a and b

106.

Basically an object is created from a

a)

Behaviour

b)

Class

c)

Characteristics

d)

Module

107.

The technique of building new classes (derived class) from an existing class (Base class )is called _____

a)

Parent class

b)

Data hiding

c)

Inheritance

d)

Polymorphism

108.

The mechanism by which the data and functions are bound together into a single unit is known as

a)

Class

b)

Object

c)

ENCAPSULATION

d)

POLYMORPHISM

109.

The term is used to describe a programming approach based on classes and objects is

a)

(A) OOP

b)

(B) POP

c)

(C) ADT

d)

(D) SOP

110.

Which of the following is a user defined data type?

a)

int

b)

float

c)

class

d)

object

111.

A single object can also be referred to as an...

a)

Object

b)

Singular Object

c)

Instance

d)

Singular

112.

You can instantiate an object more than once?

a)

True

b)

False

113.
Which of the following concepts of OOPS means exposing only necessary information to client?
a)
Encapsulation
b)
Abstraction
c)
Data hiding
d)
Data binding
114.
What is the difference between a class and an object?
a)
A class is a blueprint to make an object
b)
An object is a blueprint to make a class
c)
A blueprint is an object to make a class
d)
Blueprint class is an object make a
115.
Which one is not the basic element of OOP?
a)
Class
b)
Abstraction
c)
BlueJ
d)
Polymorphism
116.
How many objects can be made from a class? 
a)
None, you make classes from objects
b)
one
c)
As many as you want
d)
All of the above
117.
An object is an instance of a:
a)
parameter
b)
method
c)
class
d)
application
118.
As a blueprint is a design for a house, a class is a design for a(n):
a)
object
b)
variable
c)
constant
d)
statement
119.
The process by which objects of one class acquire the properties of objects of another class is known as
a)
Polymorphism
b)
Inheritance
c)
Data Hiding
d)
None of the above.
120.
The wrapping up of data and functions into a single unit is called
a)
overloading
b)
class
c)
object
d)
encapsulation 
121.
Which of the following statements is incorrect?
a)
Class is an object factory
b)
Class is a composite type.
c)
Class is an instance of an object.
d)
Class is a user defined type.