Deck 3: C Programming: Collections, Delegates, and Object-Oriented Concepts

Full screen (f)
exit full mode
Question
Which of the following statements are correct about an ArrayList collection thatimplements the IEnumerable interface?1. The ArrayList class contains an inner class that implements the IEnumerator interface.2. An ArrayList Collection cannot be accessed simultaneously by different threads.3. The inner class of ArrayList can access ArrayList class's members.4. To access members of ArrayList from the inner class, it is necessary to pass ArrayList class's reference to it.5. Enumerator's of ArrayList Collection can manipulate the array.

A)1 and 2 only
B)1,3 and 4 only
C)2 and 5 only
D)None of the above
Use Space or
up arrow
down arrow
to flip the card.
Question
How many enumerators will exist if four threads are simultaneously working on an ArrayList object?

A)1
B)3
C)2
D)4
Question
In which of the following collections is the Input/Output index-based? 1. Stack 2. Queue 3. BitArray 4. ArrayList 5. HashTable

A)1 and 2 only
B)3 and 4 only
C)5 only
D)1, 2 and 5 only
Question
Which of the following statements are correct about the Stack collection?1. It can be used for evaluation of expressions.2. All elements in the Stack collection can be accessed using an enumerator.3. It is used to maintain a FIFO list.4. All elements stored in a Stack collection must be of similar type.5. Top-most element of the Stack collection can be accessed using the Peek() method.

A)1 and 2 only
B)3 and 4 only
C)1, 2 and 5 only
D)All of the above
Question
Which of the following is the correct way to access all elements of the Queue collection created using the C#.NET code snippet given below? Queue q = new Queue(); q.Enqueue("Sachin"); q.Enqueue('A'); q.Enqueue(false); q.Enqueue(38); q.Enqueue(5.4);

A)IEnumerator e; e = q.GetEnumerator(); while (e.MoveNext()) Console.WriteLine(e.Current);
B)IEnumerable e; e = q.GetEnumerator(); while (e.MoveNext()) Console.WriteLine(e.Current);
C)IEnumerator e; e = q.GetEnumerable(); while (e.MoveNext()) Console.WriteLine(e.Current);
D)IEnumerator e; e = Queue.GetEnumerator(); while (e.MoveNext()) Console.WriteLine(e.Current);
Question
Which of the following statements is incorrect about delegate?

A)Delegates are reference types.
B)Delegates are object oriented.
C)Delegates are type-safe.
D)Only one method can be called using a delegate.
Question
Which of the following statements are correct about the delegate declaration given below? delegate void del(int I);1. On declaring the delegate a class called del will get created.2. The signature of del need not be same as the signature of the method that we intend to call using it.3. The del class will be derived from the MulticastDelegate class.4. The method that can be called using del should not be a static method.5. The del class will contain a one-argument constructor and an lnvoke() method.

A)1, 2 and 3 only
B)1, 3 and 5 only
C)2 and 4 only
D)4 only
Question
Suppose a Generic class called SortObjects is to be made capable of sorting objects of any type (Integer, Single, Byte etc.). Which of the following programming constructs should be used to implement the comparison function?

A)Namespace
B)Interface
C)Encapsulation
D)Delegate
Question
What is a delegate?

A)A strongly typed function pointer.
B)A light weight thread or process that can call a single method.
C)A reference to an object in a different process.
D)An inter-process message channel.
Question
Which of the following is included in Visual Studio IDE?

A)Form Designer
B)Code Editor
C)Solution Explorer
D)All of the above
Question
Which of the following is true about dispose() method?

A)This method is protected.
B)Its return type is int.
C)It accepts a float parameter.
D)All of the above.
Question
Button class derives from

A)Checkbox
B)RadioButton
C)ButtonBase
D)None of the above
Question
Which namespace includes most of the Control classes for developing Windows applications?

A)System;
B)System.Windows.Controls
C)System.Windows.Components.Forms
D)System.Windows.Forms
Question
Which of the Control objects is viewed as a container that can hold other objects when you design a Windows application?

A)Control
B)Button
C)Window
D)Form
Question
When an instance method declaration includes the abstract modifier, the method is said to be an ______.

A)Abstract method
B)Instance method
C)Sealed method
D)Expression method
Question
The theory of _____ implies that user can control the access to a class, method, or variable.

A)Data hiding
B)Encapsulation
C)Information Hiding
D)Polymorphism
Question
Inheritance is ______ in nature.

A)Commutative
B)Associative
C)Transitive
D)Iterative
Question
The point at which an exception is thrown is called the _______.

A)Default point
B)Invoking point
C)Calling point
D)Throw point
Question
In C#, having unreachable code is always an _____.

A)Method
B)Function
C)Error
D)Iterative
Question
C# treats the multiple catch statements like cases in a _____________ statement.

A)If
B)Switch
C)For
D)While
Question
C# supports a technique known as________, which allows a method to specify explicitly the name of the interface it is implementing.

A)Method Implementation
B)Implicit Interface Implementation
C)Explicit Interface Implementation
D)Iterative Interface Implementation
Question
The reason that C# does not support multiple inheritances is because of ______.

A)Method collision
B)Name collision
C)Function collision
D)Interface collision
Question
_______ is a set of devices through which a user communicates with a system using interactive set of commands.

A)Console
B)System
C)Keyboard
D)Monitor
Question
Exponential formatting character ('E' or 'e') converts a given value to string in the form of _______.

A)m.dddd
B)E+xxx
C)m.dddd,
D)E+xxx,
Question
The ______ are the Graphical User Interface (GUI) components created for web based interactions..

A)Web forms
B)Window Forms
C)Application Forms
D)None of the above
Question
In Microsoft Visual Studio, ______ technology and a programming language such as C# is used to create a Web based application.

A)JAVA
B)J#
C)VB.NET
D)ASP.NET
Question
The controls available in the tool box of the ______ are used to create the user interface of a web based application.

A)Microsoft visual studio IDE
B)Application window
C)Web forms
D)None of the above
Question
Web Forms consists of a _______ and a _________ .

A)Template, Component
B)CLR, CTS
C)HTML Forms, Web services
D)Windows, desktop
Question
The ______ parentheses that follow _____ indicate that no information is passed to Main().

A)Empty, class
B)Empty, submain
C)Empty, Main
D)Empty, Namespace
Question
The scope of a variable depends on the ____________ and _________.

A)Main method, place of its declaration
B)Type of the variable, console
C)compiler, main
D)Type of the variable, place of its declaration
Question
Which of the following statements is correct about the C#.NET code snippet given below?class Student s1, s2; // Here 'Student' is a user-definedclass. s1 = new Student();s2 = new Student();

A)Contents of s1 and s2 will be exactly same.
B)The two objects will get created on the stack.
C)Contents of the two objects created will be exactly same.
D)The two objects will always be created in adjacent memory locations.
Question
Which of the following can be facilitated by the Inheritance mechanism?1 Use the existing functionality of base class.2 Overrride the existing functionality of base class.3 Implement new functionality in the derived class.4 Implement polymorphic behaviour.5 Implement containership.

A)1, 2, 3
B)3, 4
C)2, 4, 5
D)3, 5
Question
Which of the following should be used to implement a 'Has a' relationship between two entities?

A)Polymorphism
B)Templates
C)Containership
D)Encapsulation
Question
Which of the following should be used to implement a 'Like a' or a 'Kind of' relationship between two entities?

A)Polymorphism
B)Containership
C)Templates
D)Inheritance
Question
How can you prevent inheritance from a class in C#.NET ?

A)Declare the class as shadows.
B)Declare the class as overloads.
C)Declare the class as seal
Question
A class implements two interfaces each containing three methods. The class contains no instance data. Which of the following correctly indicate the size of the object created from this class?

A)12 bytes
B)24 bytes
C)0 byte
D)8 bytes
Question
Which of the following statements is correct about Interfaces used in C#.NET?

A)All interfaces are derived from an Object class.
B)Interfaces can be inherited.
C)All interfaces are derived from an Object interface.
D)Interfaces can contain only method declaration.
Question
Which of the following statements is correct about an interface used in C#.NET?

A)If a class implements an interface partially, then it should be an abstract class.
B)Class cannot implement an interface partially.
C)An interface can contain static methods.
D)An interface can contain static data.
Question
Which of the following statements is correct about an interface?

A)One interface can be implemented in another interface.
B)An interface can be implemented by multiple classes in the same program.
C)A class that implements an interface can explicitly implement members of that interface.
D)The functions declared in an interface have a body.
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/39
auto play flashcards
Play
simple tutorial
Full screen (f)
exit full mode
Deck 3: C Programming: Collections, Delegates, and Object-Oriented Concepts
1
Which of the following statements are correct about an ArrayList collection thatimplements the IEnumerable interface?1. The ArrayList class contains an inner class that implements the IEnumerator interface.2. An ArrayList Collection cannot be accessed simultaneously by different threads.3. The inner class of ArrayList can access ArrayList class's members.4. To access members of ArrayList from the inner class, it is necessary to pass ArrayList class's reference to it.5. Enumerator's of ArrayList Collection can manipulate the array.

A)1 and 2 only
B)1,3 and 4 only
C)2 and 5 only
D)None of the above
1,3 and 4 only
2
How many enumerators will exist if four threads are simultaneously working on an ArrayList object?

A)1
B)3
C)2
D)4
4
3
In which of the following collections is the Input/Output index-based? 1. Stack 2. Queue 3. BitArray 4. ArrayList 5. HashTable

A)1 and 2 only
B)3 and 4 only
C)5 only
D)1, 2 and 5 only
3 and 4 only
4
Which of the following statements are correct about the Stack collection?1. It can be used for evaluation of expressions.2. All elements in the Stack collection can be accessed using an enumerator.3. It is used to maintain a FIFO list.4. All elements stored in a Stack collection must be of similar type.5. Top-most element of the Stack collection can be accessed using the Peek() method.

A)1 and 2 only
B)3 and 4 only
C)1, 2 and 5 only
D)All of the above
Unlock Deck
Unlock for access to all 39 flashcards in this deck.
Unlock Deck
k this deck
5
Which of the following is the correct way to access all elements of the Queue collection created using the C#.NET code snippet given below? Queue q = new Queue(); q.Enqueue("Sachin"); q.Enqueue('A'); q.Enqueue(false); q.Enqueue(38); q.Enqueue(5.4);

A)IEnumerator e; e = q.GetEnumerator(); while (e.MoveNext()) Console.WriteLine(e.Current);
B)IEnumerable e; e = q.GetEnumerator(); while (e.MoveNext()) Console.WriteLine(e.Current);
C)IEnumerator e; e = q.GetEnumerable(); while (e.MoveNext()) Console.WriteLine(e.Current);
D)IEnumerator e; e = Queue.GetEnumerator(); while (e.MoveNext()) Console.WriteLine(e.Current);
Unlock Deck
Unlock for access to all 39 flashcards in this deck.
Unlock Deck
k this deck
6
Which of the following statements is incorrect about delegate?

A)Delegates are reference types.
B)Delegates are object oriented.
C)Delegates are type-safe.
D)Only one method can be called using a delegate.
Unlock Deck
Unlock for access to all 39 flashcards in this deck.
Unlock Deck
k this deck
7
Which of the following statements are correct about the delegate declaration given below? delegate void del(int I);1. On declaring the delegate a class called del will get created.2. The signature of del need not be same as the signature of the method that we intend to call using it.3. The del class will be derived from the MulticastDelegate class.4. The method that can be called using del should not be a static method.5. The del class will contain a one-argument constructor and an lnvoke() method.

A)1, 2 and 3 only
B)1, 3 and 5 only
C)2 and 4 only
D)4 only
Unlock Deck
Unlock for access to all 39 flashcards in this deck.
Unlock Deck
k this deck
8
Suppose a Generic class called SortObjects is to be made capable of sorting objects of any type (Integer, Single, Byte etc.). Which of the following programming constructs should be used to implement the comparison function?

A)Namespace
B)Interface
C)Encapsulation
D)Delegate
Unlock Deck
Unlock for access to all 39 flashcards in this deck.
Unlock Deck
k this deck
9
What is a delegate?

A)A strongly typed function pointer.
B)A light weight thread or process that can call a single method.
C)A reference to an object in a different process.
D)An inter-process message channel.
Unlock Deck
Unlock for access to all 39 flashcards in this deck.
Unlock Deck
k this deck
10
Which of the following is included in Visual Studio IDE?

A)Form Designer
B)Code Editor
C)Solution Explorer
D)All of the above
Unlock Deck
Unlock for access to all 39 flashcards in this deck.
Unlock Deck
k this deck
11
Which of the following is true about dispose() method?

A)This method is protected.
B)Its return type is int.
C)It accepts a float parameter.
D)All of the above.
Unlock Deck
Unlock for access to all 39 flashcards in this deck.
Unlock Deck
k this deck
12
Button class derives from

A)Checkbox
B)RadioButton
C)ButtonBase
D)None of the above
Unlock Deck
Unlock for access to all 39 flashcards in this deck.
Unlock Deck
k this deck
13
Which namespace includes most of the Control classes for developing Windows applications?

A)System;
B)System.Windows.Controls
C)System.Windows.Components.Forms
D)System.Windows.Forms
Unlock Deck
Unlock for access to all 39 flashcards in this deck.
Unlock Deck
k this deck
14
Which of the Control objects is viewed as a container that can hold other objects when you design a Windows application?

A)Control
B)Button
C)Window
D)Form
Unlock Deck
Unlock for access to all 39 flashcards in this deck.
Unlock Deck
k this deck
15
When an instance method declaration includes the abstract modifier, the method is said to be an ______.

A)Abstract method
B)Instance method
C)Sealed method
D)Expression method
Unlock Deck
Unlock for access to all 39 flashcards in this deck.
Unlock Deck
k this deck
16
The theory of _____ implies that user can control the access to a class, method, or variable.

A)Data hiding
B)Encapsulation
C)Information Hiding
D)Polymorphism
Unlock Deck
Unlock for access to all 39 flashcards in this deck.
Unlock Deck
k this deck
17
Inheritance is ______ in nature.

A)Commutative
B)Associative
C)Transitive
D)Iterative
Unlock Deck
Unlock for access to all 39 flashcards in this deck.
Unlock Deck
k this deck
18
The point at which an exception is thrown is called the _______.

A)Default point
B)Invoking point
C)Calling point
D)Throw point
Unlock Deck
Unlock for access to all 39 flashcards in this deck.
Unlock Deck
k this deck
19
In C#, having unreachable code is always an _____.

A)Method
B)Function
C)Error
D)Iterative
Unlock Deck
Unlock for access to all 39 flashcards in this deck.
Unlock Deck
k this deck
20
C# treats the multiple catch statements like cases in a _____________ statement.

A)If
B)Switch
C)For
D)While
Unlock Deck
Unlock for access to all 39 flashcards in this deck.
Unlock Deck
k this deck
21
C# supports a technique known as________, which allows a method to specify explicitly the name of the interface it is implementing.

A)Method Implementation
B)Implicit Interface Implementation
C)Explicit Interface Implementation
D)Iterative Interface Implementation
Unlock Deck
Unlock for access to all 39 flashcards in this deck.
Unlock Deck
k this deck
22
The reason that C# does not support multiple inheritances is because of ______.

A)Method collision
B)Name collision
C)Function collision
D)Interface collision
Unlock Deck
Unlock for access to all 39 flashcards in this deck.
Unlock Deck
k this deck
23
_______ is a set of devices through which a user communicates with a system using interactive set of commands.

A)Console
B)System
C)Keyboard
D)Monitor
Unlock Deck
Unlock for access to all 39 flashcards in this deck.
Unlock Deck
k this deck
24
Exponential formatting character ('E' or 'e') converts a given value to string in the form of _______.

A)m.dddd
B)E+xxx
C)m.dddd,
D)E+xxx,
Unlock Deck
Unlock for access to all 39 flashcards in this deck.
Unlock Deck
k this deck
25
The ______ are the Graphical User Interface (GUI) components created for web based interactions..

A)Web forms
B)Window Forms
C)Application Forms
D)None of the above
Unlock Deck
Unlock for access to all 39 flashcards in this deck.
Unlock Deck
k this deck
26
In Microsoft Visual Studio, ______ technology and a programming language such as C# is used to create a Web based application.

A)JAVA
B)J#
C)VB.NET
D)ASP.NET
Unlock Deck
Unlock for access to all 39 flashcards in this deck.
Unlock Deck
k this deck
27
The controls available in the tool box of the ______ are used to create the user interface of a web based application.

A)Microsoft visual studio IDE
B)Application window
C)Web forms
D)None of the above
Unlock Deck
Unlock for access to all 39 flashcards in this deck.
Unlock Deck
k this deck
28
Web Forms consists of a _______ and a _________ .

A)Template, Component
B)CLR, CTS
C)HTML Forms, Web services
D)Windows, desktop
Unlock Deck
Unlock for access to all 39 flashcards in this deck.
Unlock Deck
k this deck
29
The ______ parentheses that follow _____ indicate that no information is passed to Main().

A)Empty, class
B)Empty, submain
C)Empty, Main
D)Empty, Namespace
Unlock Deck
Unlock for access to all 39 flashcards in this deck.
Unlock Deck
k this deck
30
The scope of a variable depends on the ____________ and _________.

A)Main method, place of its declaration
B)Type of the variable, console
C)compiler, main
D)Type of the variable, place of its declaration
Unlock Deck
Unlock for access to all 39 flashcards in this deck.
Unlock Deck
k this deck
31
Which of the following statements is correct about the C#.NET code snippet given below?class Student s1, s2; // Here 'Student' is a user-definedclass. s1 = new Student();s2 = new Student();

A)Contents of s1 and s2 will be exactly same.
B)The two objects will get created on the stack.
C)Contents of the two objects created will be exactly same.
D)The two objects will always be created in adjacent memory locations.
Unlock Deck
Unlock for access to all 39 flashcards in this deck.
Unlock Deck
k this deck
32
Which of the following can be facilitated by the Inheritance mechanism?1 Use the existing functionality of base class.2 Overrride the existing functionality of base class.3 Implement new functionality in the derived class.4 Implement polymorphic behaviour.5 Implement containership.

A)1, 2, 3
B)3, 4
C)2, 4, 5
D)3, 5
Unlock Deck
Unlock for access to all 39 flashcards in this deck.
Unlock Deck
k this deck
33
Which of the following should be used to implement a 'Has a' relationship between two entities?

A)Polymorphism
B)Templates
C)Containership
D)Encapsulation
Unlock Deck
Unlock for access to all 39 flashcards in this deck.
Unlock Deck
k this deck
34
Which of the following should be used to implement a 'Like a' or a 'Kind of' relationship between two entities?

A)Polymorphism
B)Containership
C)Templates
D)Inheritance
Unlock Deck
Unlock for access to all 39 flashcards in this deck.
Unlock Deck
k this deck
35
How can you prevent inheritance from a class in C#.NET ?

A)Declare the class as shadows.
B)Declare the class as overloads.
C)Declare the class as seal
Unlock Deck
Unlock for access to all 39 flashcards in this deck.
Unlock Deck
k this deck
36
A class implements two interfaces each containing three methods. The class contains no instance data. Which of the following correctly indicate the size of the object created from this class?

A)12 bytes
B)24 bytes
C)0 byte
D)8 bytes
Unlock Deck
Unlock for access to all 39 flashcards in this deck.
Unlock Deck
k this deck
37
Which of the following statements is correct about Interfaces used in C#.NET?

A)All interfaces are derived from an Object class.
B)Interfaces can be inherited.
C)All interfaces are derived from an Object interface.
D)Interfaces can contain only method declaration.
Unlock Deck
Unlock for access to all 39 flashcards in this deck.
Unlock Deck
k this deck
38
Which of the following statements is correct about an interface used in C#.NET?

A)If a class implements an interface partially, then it should be an abstract class.
B)Class cannot implement an interface partially.
C)An interface can contain static methods.
D)An interface can contain static data.
Unlock Deck
Unlock for access to all 39 flashcards in this deck.
Unlock Deck
k this deck
39
Which of the following statements is correct about an interface?

A)One interface can be implemented in another interface.
B)An interface can be implemented by multiple classes in the same program.
C)A class that implements an interface can explicitly implement members of that interface.
D)The functions declared in an interface have a body.
Unlock Deck
Unlock for access to all 39 flashcards in this deck.
Unlock Deck
k this deck
locked card icon
Unlock Deck
Unlock for access to all 39 flashcards in this deck.