0% found this document useful (0 votes)
34 views

VISUAL PROGRAMMING MCQ

Multiple choice questions

Uploaded by

hananshafiya4904
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views

VISUAL PROGRAMMING MCQ

Multiple choice questions

Uploaded by

hananshafiya4904
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 21

VISUAL PROGRAMMING - MCQs

III B.COM CA
1. What is Visual Basic?
a) A hardware programming language
b) A high-level, event-driven programming language
c) A markup language
d) A database management system
Answer: b) A high-level, event-driven programming language

2. What does IDE stand for in Visual Basic?


a) Integrated Data Environment
b) Integrated Development Environment
c) Independent Data Editor
d) Intelligent Design Environment
Answer: b) Integrated Development Environment

3. Which of the following is the file extension for a Visual Basic project file?
a) .exe
b) .vbp
c) .vbscript
d) .dll
Answer: b) .vbp

4. Which of the following is a control used to display text in Visual Basic?


a) TextBox
b) Label
c) Button
d) ListBox
Answer: b) Label

5. What is the purpose of the MsgBox function in Visual Basic?


a) To display a message box to the user
b) To display a list of messages
c) To create a log file
d) To connect to a database
Answer: a) To display a message box to the user

6. Which of the following is the correct syntax for declaring a variable in Visual Basic?
a) int x = 10
b) Dim x As Integer
c) x: Integer = 10
d) Declare x Integer
Answer: b) Dim x As Integer
7. In Visual Basic, which of the following is used to add controls to a form?
a) Toolbox
b) Properties window
c) Solution Explorer
d) Code Editor
Answer: a) Toolbox
8. Which keyword is used to define a subroutine in Visual Basic?
a) Function
b) Sub
c) Void
d) Routine
Answer: b) Sub

9. What is the default data type in Visual Basic if not specified?


a) Integer
b) String
c) Variant
d) Object
Answer: c) Variant

10. Which event is triggered when a button is clicked in Visual Basic?


a) Load
b) Click
c) Activate
d) MouseDown
Answer: b) Click

11. Which of the following is a looping construct in Visual Basic?


a) If-Else
b) Do While
c) Case
d) Goto
Answer: b) Do While

12. What does the Option Explicit statement do in Visual Basic?


a) Prevents variable declaration
b) Forces explicit declaration of variables
c) Automatically initializes variables
d) Optimizes the code execution
Answer: b) Forces explicit declaration of variables

13. Which of the following is not a valid data type in Visual Basic?
a) Integer
b) Double
c) Character
d) Boolean
Answer: c) Character

14. What is the purpose of the End statement in Visual Basic?


a) To exit the application immediately
b) To terminate a loop
c) To close a subroutine
d) To end a conditional block
Answer: a) To exit the application immediately
15. What is the use of the Timer control in Visual Basic?
a) To handle date and time
b) To execute code at regular intervals
c) To display the system clock
d) To measure program execution time
Answer: b) To execute code at regular intervals
16. Which function is used to convert a string to an integer in Visual Basic?
a) Convert.ToInt
b) CInt
c) ToInteger
d) ParseInteger
Answer: b) CInt

17. In Visual Basic, what does the Me keyword refer to?


a) The user of the application
b) The current form or object
c) The main function
d) The parent object
Answer: b) The current form or object

18. Which control is used to allow the user to select only one option from a group?
a) CheckBox
b) ListBox
c) RadioButton
d) ComboBox
Answer: c) RadioButton

19. What is the purpose of the IsNumeric function in Visual Basic?


a) To check if a variable is of numeric type
b) To convert a value to numeric format
c) To round off a number
d) To perform arithmetic operations
Answer: a) To check if a variable is of numeric type
20. Which of the following is not an error type in Visual Basic?
a) Syntax error
b) Logical error
c) Runtime error
d) Interface error
Answer: d) Interface error

Visual Basic Variables MCQs


1. Which keyword is used to declare a variable in Visual Basic?
a) Declare
b) Dim
c) Variable
d) Define
Answer: b) Dim
2. What is the scope of a variable declared with the Private keyword?
a) Throughout the application
b) Within the module or class
c) Within a procedure only
d) Global scope
Answer: b) Within the module or class
3. Which of the following is not a valid data type in Visual Basic?
a) Integer
b) Boolean
c) Decimal
d) Currency
Answer: d) Currency
4. What is the default value of a Boolean variable in Visual Basic?
a) True
b) False
c) Null
d) Undefined
Answer: b) False

5. Which keyword is used to make a variable accessible from any module in the project?
a) Global
b) Public
c) Static
d) Shared
Answer: b) Public

6. What does the Static keyword do in variable declaration?


a) Prevents changes to the variable
b) Retains the value of the variable between procedure calls
c) Limits the scope of the variable
d) Initializes the variable to zero
Answer: b) Retains the value of the variable between procedure calls

7. Which function can convert a string to an integer in Visual Basic?


a) CInt
b) ToInteger
c) Convert.ToInt
d) Integer.Parse
Answer: a) CInt

8. What does the Const keyword do in Visual Basic?


a) Declares a read-only variable
b) Declares a variable with a fixed value
c) Declares a global variable
d) Declares a variable with no initialization
Answer: b) Declares a variable with a fixed value

9. What is the lifespan of a variable declared inside a procedure?


a) Until the application is closed
b) Until the procedure ends
c) Throughout the module
d) Throughout the application
Answer: b) Until the procedure ends

10. What is the purpose of the Option Explicit statement?


a) Forces explicit declaration of variables
b) Automatically initializes variables
c) Disables error checking
d) Optimizes variable usage
Answer: a) Forces explicit declaration of variables
Visual Basic Control Statements MCQs
1. Which of the following is a conditional control statement in Visual Basic?
a) For
b) If...Then...Else
c) Do While
d) Exit
Answer: b) If...Then...Else

2. What is the purpose of the Select Case statement in Visual Basic?


a) To execute a loop
b) To choose from multiple conditions
c) To declare a variable
d) To exit a loop
Answer: b) To choose from multiple conditions

3. Which of the following is the correct syntax for an If statement in Visual Basic?
a) If condition then {statement} End If
b) If condition: {statement}; End If
c) If condition Then
Statement
End If
d) If (condition) {statement} End
Answer: c) If condition Then
Statement
End If

4. Which loop executes at least once, regardless of the condition?


a) For
b) While
c) Do While
d) Do...Loop Until
Answer: d) Do...Loop Until

5. What is the purpose of the Exit statement in Visual Basic?


a) To terminate a procedure
b) To exit a loop or control structure prematurely
c) To close the application
d) To declare the end of a variable
Answer: b) To exit a loop or control structure prematurely

6. What is the default increment value in a For loop in Visual Basic?


a) 0
b) 1
c) -1
d) Undefined
Answer: b) 1

7. Which of the following is a valid syntax for a Do While loop?


a) Do While condition StatementLoop
b) Do Statement While condition
c) Both a and b
d) None of the above
Answer: c) Both a and b
8. Which keyword is used to skip the current iteration of a loop and proceed to the next
iteration?
a) Break
b) Exit
c) Continue
d) Skip
Answer: c) Continue

9. What does the For Each statement do in Visual Basic?


a) Iterates through each element in a collection or array
b) Executes a block of code a fixed number of times
c) Skips elements in a collection
d) Combines elements in a list
Answer: a) Iterates through each element in a collection or array

10. Which of the following is used to terminate a Select Case block?


a) End
b) Break
c) End Select
d) Exit Select
Answer: c) End Select

Visual Basic Standard Controls MCQs


1. Which control in Visual Basic is used to display text that cannot be edited by the user?
a) TextBox
b) Label
c) Command Button
d) ListBox
Answer: b) Label

2. Which control is used to accept user input in Visual Basic?


a) Label
b) TextBox
c) PictureBox
d) Command Button
Answer: b) TextBox

3. What is the primary purpose of the Command Button control in Visual Basic?
a) To display images
b) To execute an action when clicked
c) To display text
d) To create a dropdown list
Answer: b) To execute an action when clicked

4. Which property of a CheckBox control determines whether it is selected or not?


a) Checked
b) Enabled
c) Value
d) CheckedState
Answer: a) Checked
5. What does the ComboBox control allow the user to do?
a) Enter text or select an item from a list
b) Display images in a dropdown format
c) Perform a mathematical operation
d) Create a multiline text box
Answer: a) Enter text or select an item from a list

6. Which Visual Basic control is used to display a list of items to the user?
a) ListBox
b) ComboBox
c) Option Button
d) Label
Answer: a) ListBox

7. What is the purpose of the PictureBox control in Visual Basic?


a) To input text from the user
b) To display images
c) To display a list of options
d) To create a graphical user interface
Answer: b) To display images

8. Which property of the Timer control specifies the time interval in milliseconds?
a) Interval
b) Frequency
c) Duration
d) TimeOut
Answer: a) Interval

9. What is the difference between a RadioButton and a CheckBox in Visual Basic?


a) RadioButtons allow multiple selections; CheckBoxes do not
b) CheckBoxes allow multiple selections; RadioButtons are mutually exclusive within a group
c) Both allow multiple selections
d) Neither allows multiple selections
Answer: b) CheckBoxes allow multiple selections; RadioButtons are mutually exclusive within a
group

10. Which control in Visual Basic is used to create menus?


a) Menu Editor
b) MenuStrip
c) Command Button
d) ContextMenu
Answer: b) MenuStrip
11. Which property of the TextBox control allows the text to appear as a password?
a) Masked
b) PasswordChar
c) SecureText
d) HideText
Answer: b) PasswordChar
12. What is the TabIndex property of a control used for?
a) To align controls in a tabular format
b) To specify the order of focus when navigating with the Tab key
c) To indicate whether the control is visible or not
d) To set the title of the control
Answer: b) To specify the order of focus when navigating with the Tab key

13. Which event is triggered when the user changes the text in a TextBox?
a) KeyPress
b) Change
c) TextChanged
d) Modified
Answer: c) TextChanged

14. Which property of a ListBox control gets the currently selected item?
a) SelectedValue
b) SelectedItem
c) CurrentSelection
d) ItemIndex
Answer: b) SelectedItem
15. What is the default event for a Button control in Visual Basic?
a) Click
b) MouseEnter
c) KeyDown
d) Load
Answer: a) Click

16. Which property of the ProgressBar control determines the current progress value?
a) Position
b) Value
c) Progress
d) Increment
Answer: b) Value

17. What is the main purpose of the GroupBox control?


a) To display text
b) To group related controls together
c) To create a scrollable container
d) To handle form validation
Answer: b) To group related controls together

18. Which property of the Form control specifies the title displayed on the form's title bar?
a) Caption
b) Text
c) Title
d) Header
Answer: b) Text

19. What does the Enabled property of a control do?


a) Sets the visibility of the control
b) Determines whether the control can respond to user interaction
c) Specifies the control's position
d) Sets the background color of the control
Answer: b) Determines whether the control can respond to user interaction
20. Which event is triggered when a form is loaded into memory?
a) Initialize
b) Load
c) Activate
d) Start
Answer: b) Load

Visual Basic File System MCQs


1. Which statement is used in Visual Basic to open a file for reading or writing?
a) OpenFile
b) File.Open
c) Open
d) ReadFile
Answer: c) Open

2. Which mode is used to open a file for writing in Visual Basic?


a) Append
b) Write
c) Output
d) Create
Answer: c) Output

3. What does the FileSystem.FileExists method check in Visual Basic?


a) If a file can be opened
b) If a file exists in the specified path
c) If a file is in use
d) If a file is readable
Answer: b) If a file exists in the specified path

4. Which function in Visual Basic reads a single line from an open file?
a) ReadLine
b) LineInput
c) InputLine
d) GetLine
Answer: b) LineInput

5. What is the purpose of the FreeFile function in Visual Basic?


a) To close all open files
b) To determine the next available file number
c) To delete a file
d) To reset a file to its initial state
Answer: b) To determine the next available file number

6. Which file mode is used to add data to the end of a file without overwriting existing data?
a) Output
b) Append
c) Input
d) Overwrite
Answer: b) Append

7. Which method is used to delete a file in Visual Basic?


a) FileSystem.RemoveFile
b) File.Delete
c) Kill
d) Remove
Answer: c) Kill
8. What does the FileCopy function do in Visual Basic?
a) Copies text within a file
b) Copies one file to another location
c) Creates a backup of a file
d) Copies a file's metadata
Answer: b) Copies one file to another location

9. Which statement is used to close an open file in Visual Basic?


a) EndFile
b) CloseFile
c) End
d) Close
Answer: d) Close

10. What does the GetAttr function in Visual Basic return?


a) The size of the file
b) The attributes of a file or directory
c) The creation date of a file
d) The location of a file
Answer: b) The attributes of a file or directory

11. Which file access mode is used for both reading and writing in Visual Basic?
a) Binary
b) InputOutput
c) ReadWrite
d) Random
Answer: d) Random

12. What is the default method to create a directory in Visual Basic?


a) MkDir
b) CreateDirectory
c) MakeDir
d) NewFolder
Answer: a) MkDir

13. Which function retrieves the length of a file in bytes in Visual Basic?
a) FileLength
b) LOF
c) GetFileSize
d) FileSize
Answer: b) LOF

14. In a Random access file, which function is used to write a record to the file?
a) WriteLine
b) Put
c) Save
d) RecordWrite
Answer: b) Put
15. What does the FileOpen function do in Visual Basic?
a) Creates a new file
b) Opens a file for reading, writing, or appending
c) Deletes an existing file
d) Renames an open file
Answer: b) Opens a file for reading, writing, or appending
16. Which keyword is used to rename a file in Visual Basic?
a) RenameFile
b) Name
c) ChangeFileName
d) FileRename
Answer: b) Name

17. Which file mode is used to access files byte by byte in Visual Basic?
a) Random
b) Binary
c) Sequential
d) Text
Answer: b) Binary

18. Which function is used to retrieve the directory of the current application in Visual Basic?
a) App.Path
b) Directory.GetCurrentDirectory
c) GetDir
d) FileSystem.CurrentDirectory
Answer: a) App.Path

19. Which function writes a line of text to a file in Visual Basic?


a) WriteLine
b) Print
c) Write
d) AddText
Answer: c) Write

20. What happens if you try to open a non-existent file using the Input mode in Visual Basic?
a) The file is created
b) An error occurs
c) The file is opened in write mode
d) A blank file is opened
Answer: b) An error occurs

File System Control MCQs


1. Which control is used to display the structure of drives and folders in Visual Basic?
a) FileListBox
b) DirListBox
c) DriveListBox
d) TreeView
Answer: b) DirListBox

2. What does the DriveListBox control display?


a) Files in a directory
b) Available drives on the computer
c) Folders in a directory
d) Properties of a file
Answer: b) Available drives on the computer
3. Which control in Visual Basic is used to display files in a specific directory?
a) DirListBox
b) FileListBox
c) ListBox
d) ComboBox
Answer: b) FileListBox

4. Which event is triggered when the user selects a different drive in the DriveListBox?
a) Change
b) Click
c) SelectedIndexChanged
d) SelectionChange
Answer: a) Change

5. What property of the DirListBox control specifies the currently selected directory?
a) Directory
b) SelectedDirectory
c) Path
d) CurrentFolder
Answer: c) Path

6. Which method would you use to refresh the contents of a FileListBox?


a) Update
b) Refresh
c) Repaint
d) Reload
Answer: b) Refresh

7. What happens if you set the Pattern property of a FileListBox to *.txt?


a) It displays all files in the directory
b) It displays only text files with a .txt extension
c) It hides all files
d) It throws an error
Answer: b) It displays only text files with a .txt extension

8. Which control should you use to allow the user to browse for and select a file?
a) CommonDialog
b) DriveListBox
c) DirListBox
d) FileListBox
Answer: a) CommonDialog

9. Which event occurs when the user changes the directory in the DirListBox?
a) Change
b) DirectoryChanged
c) PathUpdated
d) FolderChange
Answer: a) Change
10. Which property of the DriveListBox specifies the selected drive?
a) CurrentDrive
b) DriveLetter
c) SelectedDrive
d) Drive
Answer: d) Drive

11. What must you do to synchronize a DriveListBox, DirListBox, and FileListBox in Visual
Basic?
a) Use the Path property to pass values between them
b) Use the SelectedDrive property to connect them
c) Handle the Change event for each control
d) Both a and c
Answer: d) Both a and c

12. Which file system control allows filtering files by extension?


a) DirListBox
b) FileListBox
c) DriveListBox
d) TextBox
Answer: b) FileListBox

13. The FileListBox control does not show: a) Hidden files


b) Read-only files
c) Files without extensions
d) System files
Answer: a) Hidden files

14. How can you limit the FileListBox to show only image files (e.g., .jpg, .png)?
a) Set the Filter property
b) Set the Pattern property to .jpg;.png
c) Use the Extension property
d) Modify the VisibleFiles property
Answer: b) Set the Pattern property to .jpg;.png

15. Which control allows users to navigate drives without typing the drive letter?
a) FileListBox
b) DirListBox
c) DriveListBox
d) ListBox
Answer: c) DriveListBox

16. What does the Pattern property of the FileListBox control do?
a) Filters files by their name or extension
b) Changes the layout of the list
c) Displays only hidden files
d) Specifies the file creation date
Answer: a) Filters files by their name or extension

17. What property of the DirListBox control updates automatically when a new drive is selected
in the DriveListBox?
a) Path
b) DrivePath
c) Folder
d) CurrentDirectory
Answer: a) Path
18. To programmatically select a specific folder in the DirListBox, you would set the:
a) Drive property
b) Directory property
c) Path property
d) CurrentFolder property
Answer: c) Path

19. Which control can be used to show a dialog for opening or saving files in Visual Basic?
a) OpenFileDialog
b) SaveFileDialog
c) Both a and b
d) FileListBox
Answer: c) Both a and b

20. Which control is NOT part of the file system controls in Visual Basic?
a) FileListBox
b) DirListBox
c) TreeView
d) DriveListBox
Answer: c) TreeView

NET Framework Basics MCQs


1. What is the primary purpose of the .NET Framework?
a) To manage operating systems
b) To provide an environment for developing and running applications
c) To optimize hardware performance
d) To provide cloud services
Answer: b) To provide an environment for developing and running applications

2. What is the name of the runtime environment of the .NET Framework?


a) Common Language Specification (CLS)
b) Common Runtime Environment (CRE)
c) Common Language Runtime (CLR)
d) Common Intermediate Language (CIL)
Answer: c) Common Language Runtime (CLR)

3. What does the term "Managed Code" in .NET refer to?


a) Code compiled directly to machine language
b) Code executed and managed by the CLR
c) Code written in assembly language
d) Code that runs outside the .NET Framework
Answer: b) Code executed and managed by the CLR

4. Which component of the .NET Framework provides language interoperability?


a) Common Language Specification (CLS)
b) Base Class Library (BCL)
c) Common Language Runtime (CLR)
d) Intermediate Language (IL)
Answer: a) Common Language Specification (CLS)
5. What does the Base Class Library (BCL) in .NET Framework provide?
a) Tools for debugging applications
b) A library of pre-written code for common functionalities
c) Interfaces for accessing hardware
d) Security features for applications
Answer: b) A library of pre-written code for common functionalities

6. Which of the following is a core component of the .NET Framework?


a) Base Class Library
b) Common Language Runtime
c) Framework Class Library
d) All of the above
Answer: d) All of the above

7. What is the default file extension for a compiled .NET application?


a) .dll
b) .exe
c) Both a and b
d) .net
Answer: c) Both a and b

8. What is the purpose of the Garbage Collector (GC) in the .NET Framework?
a) To compile managed code
b) To manage memory by releasing unused objects
c) To optimize CPU usage
d) To enhance network security
Answer: b) To manage memory by releasing unused objects

9. Which tool is used to compile .NET code?


a) CLR
b) IL Compiler
c) Just-In-Time Compiler (JIT)
d) MSIL Assembler
Answer: c) Just-In-Time Compiler (JIT)

10. What does the term "Common Intermediate Language (CIL)" refer to in .NET?
a) A low-level language used for hardware programming
b) The intermediate code to which .NET languages are compiled
c) A scripting language for the .NET environment
d) A library of classes for .NET developers
Answer: b) The intermediate code to which .NET languages are compiled

11. Which of the following is NOT a .NET-supported programming language?


a) C#
b) VB.NET
c) Java
d) F#
Answer: c) Java
12. Which part of the .NET Framework handles the execution of the program?
a) Base Class Library
b) Common Language Runtime
c) Framework Class Library
d) Metadata
Answer: b) Common Language Runtime

13. What is the purpose of the Just-In-Time (JIT) compiler in .NET?


a) To compile code at runtime into native machine code
b) To debug managed code
c) To compile source code into Intermediate Language
d) To optimize assembly loading
Answer: a) To compile code at runtime into native machine code

14. Which .NET component ensures type safety and memory access security?
a) Garbage Collector
b) Base Class Library
c) Common Type System (CTS)
d) Common Language Runtime
Answer: c) Common Type System (CTS)

15. What does the Global Assembly Cache (GAC) store?


a) Temporary files for .NET applications
b) Shared assemblies for .NET applications
c) User-defined classes for .NET
d) Intermediate Language files
Answer: b) Shared assemblies for .NET applications

16. Which version of .NET introduced cross-platform compatibility?


a) .NET Framework 4.5
b) .NET Core
c) .NET Standard
d) .NET 5
Answer: b) .NET Core

17. What is the primary purpose of the .NET Framework?


a) To manage operating systems
b) To provide an environment for developing and running applications
c) To optimize hardware performance
d) To provide cloud services
Answer: b) To provide an environment for developing and running applications

18. What is the name of the runtime environment of the .NET Framework?
a) Common Language Specification (CLS)
b) Common Runtime Environment (CRE)
c) Common Language Runtime (CLR)
d) Common Intermediate Language (CIL)
Answer: c) Common Language Runtime (CLR)

19. What does the term "Managed Code" in .NET refer to?
a) Code compiled directly to machine language
b) Code executed and managed by the CLR
c) Code written in assembly language
d) Code that runs outside the .NET Framework
Answer: b) Code executed and managed by the CLR
20. Which component of the .NET Framework provides language interoperability?
a) Common Language Specification (CLS)
b) Base Class Library (BCL)
c) Common Language Runtime (CLR)
d) Intermediate Language (IL)
Answer: a) Common Language Specification (CLS)

21. What does the Base Class Library (BCL) in .NET Framework provide?
a) Tools for debugging applications
b) A library of pre-written code for common functionalities
c) Interfaces for accessing hardware
d) Security features for applications
Answer: b) A library of pre-written code for common functionalities

22. Which of the following is a core component of the .NET Framework?


a) Base Class Library
b) Common Language Runtime
c) Framework Class Library
d) All of the above
Answer: d) All of the above

23. What is the default file extension for a compiled .NET application?
a) .dll
b) .exe
c) Both a and b
d) .net
Answer: c) Both a and b

24. What is the purpose of the Garbage Collector (GC) in the .NET Framework?
a) To compile managed code
b) To manage memory by releasing unused objects
c) To optimize CPU usage
d) To enhance network security
Answer: b) To manage memory by releasing unused objects

25. Which tool is used to compile .NET code?


a) CLR
b) IL Compiler
c) Just-In-Time Compiler (JIT)
d) MSIL Assembler
Answer: c) Just-In-Time Compiler (JIT)

26. What does the term "Common Intermediate Language (CIL)" refer to in .NET?
a) A low-level language used for hardware programming
b) The intermediate code to which .NET languages are compiled
c) A scripting language for the .NET environment
d) A library of classes for .NET developers
Answer: b) The intermediate code to which .NET languages are compiled
1. Which of the following is NOT a .NET-supported programming language?
a) C#
b) VB.NET
c) Java
d) F#
Answer: c) Java

2. Which part of the .NET Framework handles the execution of the program?
a) Base Class Library
b) Common Language Runtime
c) Framework Class Library
d) Metadata
Answer: b) Common Language Runtime

3. What is the purpose of the Just-In-Time (JIT) compiler in .NET?


a) To compile code at runtime into native machine code
b) To debug managed code
c) To compile source code into Intermediate Language
d) To optimize assembly loading
Answer: a) To compile code at runtime into native machine code

4. Which .NET component ensures type safety and memory access security?
a) Garbage Collector
b) Base Class Library
c) Common Type System (CTS)
d) Common Language Runtime
Answer: c) Common Type System (CTS)

5. What does the Global Assembly Cache (GAC) store?


a) Temporary files for .NET applications
b) Shared assemblies for .NET applications
c) User-defined classes for .NET
d) Intermediate Language files
Answer: b) Shared assemblies for .NET applications

6. Which version of .NET introduced cross-platform compatibility?


a) .NET Framework 4.5
b) .NET Core
c) .NET Standard
d) .NET 5
Answer: b) .NET Core

7. What is the primary purpose of the Common Language Specification (CLS)?


a) To define the rules for writing CLR-compliant code
b) To manage memory allocation in .NET
c) To allow unmanaged code execution
d) To compile source code into machine code
Answer: a) To define the rules for writing CLR-compliant code

8. Which namespace in .NET is commonly used for file and directory operations?
a) System.IO
b) System.Net
c) System.Text
d) System.Data
Answer: a) System.IO
9. What is the purpose of the app.config file in .NET applications?
a) To store application settings and configuration information
b) To compile the .NET application
c) To manage database connections
d) To debug applications
Answer: a) To store application settings and configuration information

10. Which of the following is a key feature of the .NET Framework?


a) Language Interoperability
b) Automatic Memory Management
c) Platform Independence (on Windows)
d) All of the above
Answer: d) All of the above

Database Basics MCQs


1. What does a database primarily store?
a) Raw files
b) Structured data
c) Applications
d) Network configurations
Answer: b) Structured data

2. Which of the following is an example of a database management system (DBMS)?


a) Microsoft Word
b) MySQL
c) Photoshop
d) Visual Studio
Answer: b) MySQL

3. Which language is used to interact with a database?


a) HTML
b) SQL
c) CSS
d) XML
Answer: b) SQL

4. What is the primary purpose of a primary key in a database table?


a) To allow duplicate data
b) To uniquely identify each record
c) To define relationships between tables
d) To store temporary data
Answer: b) To uniquely identify each record

5. What type of relationship exists when one table's primary key is used as a foreign key in
another table?
a) One-to-One
b) One-to-Many
c) Many-to-Many
d) None of the above
Answer: b) One-to-Many
6. Which of the following is a characteristic of a relational database?
a) It stores data in hierarchical form
b) It uses tables to store data
c) It does not support indexing
d) It cannot handle relationships
Answer: b) It uses tables to store data

7. Which SQL command is used to retrieve data from a database?


a) INSERT
b) SELECT
c) UPDATE
d) DELETE
Answer: b) SELECT

8. What does ACID stand for in database systems?


a) Atomicity, Consistency, Isolation, Durability
b) Accuracy, Control, Integrity, Data
c) Add, Commit, Iterate, Delete
d) Attribute, Consistency, Identity, Data
Answer: a) Atomicity, Consistency, Isolation, Durability

9. Which of the following is a NoSQL database?


a) Oracle
b) MongoDB
c) PostgreSQL
d) Microsoft SQL Server
Answer: b) MongoDB

10. In a relational database, what is a foreign key?


a) A unique identifier for the table
b) A key used to define a relationship between two tables
c) A temporary key used for sorting
d) A key used to store data temporarily
Answer: b) A key used to define a relationship between two tables

11. Which of the following is used to ensure data integrity in a database?


a) Index
b) Trigger
c) Constraint
d) View
Answer: c) Constraint

12. What is the purpose of the JOIN operation in SQL?


a) To delete data from multiple tables
b) To combine rows from two or more tables
c) To create a new table
d) To retrieve only unique records
Answer: b) To combine rows from two or more tables
13. Which command is used to remove a table from a database?
a) DROP
b) DELETE
c) TRUNCATE
d) REMOVE
Answer: a) DROP
14. What is the purpose of an index in a database?
a) To store data temporarily
b) To speed up data retrieval
c) To ensure data accuracy
d) To define relationships
Answer: b) To speed up data retrieval

15. Which of the following commands is used to modify the structure of a table?
a) INSERT
b) ALTER
c) UPDATE
d) MODIFY
Answer: b) ALTER

16. What does normalization in a database aim to achieve?


a) To remove redundancy and inconsistency in data
b) To create duplicate records
c) To optimize SQL queries
d) To increase storage requirements
Answer: a) To remove redundancy and inconsistency in data

17. Which SQL statement is used to add new rows to a table?


a) INSERT
b) ADD
c) UPDATE
d) CREATE
Answer: a) INSERT

18. What does the term "denormalization" in a database mean?


a) Splitting tables into smaller ones
b) Combining tables to improve query performance
c) Removing primary keys from tables
d) Deleting relationships between tables
Answer: b) Combining tables to improve query performance

19. What is the purpose of a database view?


a) To permanently store data
b) To provide a virtual table based on a query
c) To modify data directly in the database
d) To create indexes for faster retrieval
Answer: b) To provide a virtual table based on a query

20. Which command is used to grant permissions to a user in a database?


a) GRANT
b) GIVE
c) PERMIT
d) AUTHORIZE
Answer: a) GRANT

You might also like