FINAL Flashcards

1
Q

Which keyword is used to define a class in C#?
a) class
b) ClassName
c) void
d) public

A

a) class

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What characters can a class name include?
a) Letters and spaces
b) Letters, digits, and underscores
c) Only letters
d) Letters, digits, underscores, and special symbols

A

b) Letters, digits, and underscores

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

A variable declaration in C# must include:
a) Only the variable type
b) Only the variable name
c) Variable name and type
d) Variable name, type, and initial value

A

c) Variable name and type

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is the recommended naming convention for variables?
a) PascalCase
b) UPPERCASE
c) snake_case
d) lowerCamelCase

A

d) lowerCamelCase

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What type of method can be called without creating an object of the class?
a) Public
b) Static
c) Abstract
d) Void

A

b) Static

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is a Form in a Windows application?
a) A textual interface
b) A graphical element like a window or dialog
c) A type of database
d) A programming function

A

b) A graphical element like a window or dialog

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Which namespace contains the Control class?
a) System.Windows.Forms
b) System.Drawing
c) System.Control
d) System.IO

A

a) System.Windows.Forms

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is the purpose of an event handler?
a) To create graphical interfaces
b) To handle events triggered by user interactions
c) To generate SQL queries
d) To manage database connections

A

b) To handle events triggered by user interactions

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What are the two parameters of an event handler in C#?
a) sender and EventArgs
b) source and EventHandler
c) Button and Label
d) Component and Control

A

a) sender and EventArgs

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

How can you add a button to a Form in Visual Studio?
a) By writing the code manually
b) By dragging it from the Toolbox
c) By importing it from a library
d) By creating a new namespace

A

b) By dragging it from the Toolbox

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Which category of design patterns deals with object creation?
a) Behavioral patterns
b) Structural patterns
c) Creational patterns
d) Procedural patterns

A

c) Creational patterns

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What does the Adapter pattern do?
a) Converts one interface to another
b) Manages object creation
c) Defines a template for methods
d) Updates relational databases

A

a) Converts one interface to another

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

The Bridge pattern helps to:
a) Link two separate applications
b) Decouple abstraction from implementation
c) Create database connections
d) Synchronize data between tables

A

b) Decouple abstraction from implementation

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Which pattern notifies dependent objects of state changes?
a) Factory Method
b) Observer
c) Adapter
d) Singleton

A

b) Observer

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

The Factory Method pattern:
a) Creates an object without specifying the exact class
b) Updates existing objects
c) Directly accesses private attributes
d) Bridges two incompatible classes

A

a) Creates an object without specifying the exact class

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is an update anomaly?
a) When data is duplicated in a table
b) Inconsistent data after a partial update
c) Loss of data due to a deletion
d) Inability to add new data

A

b) Inconsistent data after a partial update

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

In which normal form must a table have no multi-valued columns?
a) 1NF
b) 2NF
c) 3NF
d) BCNF

A

a) 1NF

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

What is a transitive dependency?
a) When one column depends on another non-key column
b) When a column depends on the primary key
c) When a table has no foreign keys
d) When a table is in 1NF

A

a) When one column depends on another non-key column

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

What is the purpose of normalization?
a) To reduce data redundancy and improve integrity
b) To increase the size of databases
c) To create graphical interfaces
d) To manage database connections

A

a) To reduce data redundancy and improve integrity

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

Which type of anomaly occurs when you cannot add data to a table due to missing related data?
a) Update anomaly
b) Insert anomaly
c) Delete anomaly
d) Referential anomaly

A

b) Insert anomaly

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

Which SQL command is used to retrieve data?
a) SELECT
b) INSERT
c) UPDATE
d) DELETE

22
Q

What does the following SQL command do?
INSERT INTO Customers (Name, Country) VALUES (‘John’, ‘USA’);
a) Deletes a record from the Customers table
b) Updates a record in the Customers table
c) Adds a new record to the Customers table
d) Retrieves data from the Customers table

A

c) Adds a new record to the Customers table

23
Q

Which SQL command modifies existing records?
a) SELECT
b) INSERT
c) UPDATE
d) DELETE

24
Q

How do you remove a record in SQL?
a) SELECT * FROM table
b) DELETE FROM table
c) DROP table
d) REMOVE FROM table

A

b) DELETE FROM table

25
Q

What is a stored procedure?
a) A predefined SQL query stored in the database
b) A temporary table in the database
c) A graphical component in SQL Server
d) A runtime error handler

A

a) A predefined SQL query stored in the database

26
Q

What is the keyword void used for?
a) Declaring a class
b) Indicating no return value for a method
c) Creating variables
d) Handling exceptions

A

b) Indicating no return value for a method

27
Q

What is an event-driven program?
a) A program where events trigger specific actions
b) A program that runs without input
c) A program that generates reports
d) A program that creates GUIs automatically

A

a) A program where events trigger specific actions

28
Q

What is the difference between 2NF and 3NF?
a) 2NF eliminates multi-valued columns; 3NF eliminates transitive dependencies.
b) 2NF removes duplicates; 3NF removes foreign keys.
c) 2NF focuses on partial keys; 3NF focuses on normalization.
d) There is no difference.

A

a) 2NF eliminates multi-valued columns; 3NF eliminates transitive dependencies.

29
Q

Which of the following is a creational pattern?
a) Observer
b) Adapter
c) Factory Method
d) Bridge

A

c) Factory Method

30
Q

Which method executes when the application starts?
a) StaticMethod
b) Main
c) Execute
d) Start

31
Q

What is an abstraction in the Bridge pattern?
a) The interface seen by the client
b) The class implementing the interface
c) The database schema
d) The event handler

A

a) The interface seen by the client

32
Q

Why use design patterns?
a) To make code more reusable and flexible
b) To avoid using classes
c) To prevent application execution
d) To remove attributes from methods

A

a) To make code more reusable and flexible

33
Q

What does the Factory Method pattern enable?
a) Direct instantiation of objects
b) Subclasses to decide object creation
c) Singleton implementation
d) Access to private variables

A

b) Subclasses to decide object creation

34
Q

Which design pattern is used when a client needs to work with a legacy system?
a) Singleton
b) Observer
c) Adapter
d) Bridge

A

c) Adapter

35
Q

What is the role of the Adaptee in the Adapter pattern?
a) It converts the interface for the client.
b) It is the class being adapted.
c) It defines the new interface.
d) It handles event-driven programming.

A

b) It is the class being adapted.

36
Q

The Observer pattern involves which of the following components?
a) Singleton, Adapter, Bridge
b) Subject, Observer, ConcreteObserver
c) Factory, Adapter, Observer
d) Client, Factory, Object

A

b) Subject, Observer, ConcreteObserver

37
Q

In the Bridge pattern, what connects the abstraction to its implementation?
a) Event handler
b) Refined abstraction
c) Interface
d) Implementor

A

d) Implementor

38
Q

Which design pattern is ideal for ensuring that only one instance of a class exists?
a) Adapter
b) Factory Method
c) Singleton
d) Bridge

A

c) Singleton

39
Q

A behavioral design pattern primarily focuses on:
a) Object creation
b) Object structure
c) Object interactions
d) Object accessibility

A

c) Object interactions

40
Q

What is the purpose of the Singleton pattern?
a) To manage complex inheritance hierarchies
b) To create multiple objects simultaneously
c) To ensure a class has only one instance
d) To notify observers of state changes

A

c) To ensure a class has only one instance

41
Q

Which pattern is used to separate object creation from its usage?
a) Observer
b) Factory Method
c) Adapter
d) Bridge

A

b) Factory Method

42
Q

What is an example of the Strategy pattern in real life?
a) Choosing different payment methods (e.g., credit card, PayPal) at checkout
b) Converting one currency to another
c) Ensuring only one user can log in at a time
d) Providing a graphical interface for a database

A

a) Choosing different payment methods (e.g., credit card, PayPal) at checkout

43
Q

Which design pattern uses delegates to handle multiple events?
a) Observer
b) Factory Method
c) Adapter
d) Strategy

A

a) Observer

44
Q

What kind of methods does an abstract class contain in the Template Method pattern?
a) Only private methods
b) Only concrete methods
c) Both abstract and concrete methods
d) Only static methods

A

c) Both abstract and concrete methods

45
Q

The Adapter pattern works at which level?
a) Object level
b) Database level
c) Application level
d) Event level

A

a) Object level

46
Q

Which pattern is commonly used in GUIs to decouple user input from internal logic?
a) Adapter
b) Observer
c) Factory Method
d) Singleton

A

b) Observer

47
Q

What does a static method allow?
a) Methods to return values to other classes
b) The method to execute without creating an instance of the class
c) Access to private variables
d) Defining class-level variables

A

b) The method to execute without creating an instance of the class

48
Q

What is the correct SQL syntax to update a customer’s name?
a) sql\nDELETE FROM Customers WHERE Name = ‘John’;
b) sql\nSELECT Name FROM Customers WHERE Name = ‘John’;
c) sql\nUPDATE Customers SET Name = ‘Jane’ WHERE Name = ‘John’;
d) sql\nINSERT INTO Customers (Name) VALUES (‘Jane’);

A

c) sql\nUPDATE Customers SET Name = ‘Jane’ WHERE Name = ‘John’;

49
Q

Which SQL command creates a new table?
a) SELECT
b) CREATE TABLE
c) UPDATE
d) DROP TABLE

A

b) CREATE TABLE

50
Q

What is the purpose of transitive dependency elimination in normalization?
a) To increase redundancy
b) To ensure no non-key column depends on another non-key column
c) To reduce table size
d) To ensure primary keys are unique

A

b) To ensure no non-key column depends on another non-key column