0% found this document useful (0 votes)
11 views7 pages

VB Viva'

The document outlines potential questions and answers for a Visual Basic viva at Kurukshetra University, covering fundamental concepts, controls, event handling, data manipulation, and database access. It includes detailed explanations of various topics such as collections, forms, menus, file handling, and graphics, along with practical examples. The content serves as a comprehensive guide for students preparing for their viva examination.

Uploaded by

techiepro143
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views7 pages

VB Viva'

The document outlines potential questions and answers for a Visual Basic viva at Kurukshetra University, covering fundamental concepts, controls, event handling, data manipulation, and database access. It includes detailed explanations of various topics such as collections, forms, menus, file handling, and graphics, along with practical examples. The content serves as a comprehensive guide for students preparing for their viva examination.

Uploaded by

techiepro143
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

In a Visual Basic viva for a BCA at Kurukshetra University (KUK), expect questions about

the programming language, its features, and how it's used in developing applications.
The questions might range from fundamental concepts to more specific aspects like
controls, events, and data manipulation. [1, 2, 3]

Here's a more detailed breakdown of potential questions and answers:

I. Fundamentals of Visual Basic [1, 1, 4, 4]


● Question: What is Visual Basic, and what are its key features?
○ Answer: Visual Basic (VB) is a programming language from Microsoft, known for its
ease of use and graphical user interface (GUI) development. It allows developers to
create applications with a visual interface by dragging and dropping objects and
setting their properties. Key features include event-driven programming, GUI
development, and database access.

● Question: What is an event in Visual Basic?


○ Answer: In VB, an event is a response to a user action, such as clicking a button or
typing in a text box. It triggers a specific code block to execute when the event
occurs. [1, 1, 4, 4, 5, 5, 6, 7]

II. Controls and User Interface [1, 1]


● Question: What are the different types of controls available in Visual Basic? [1, 1]
○ Answer: Visual Basic provides various controls, categorized as: [1, 1]
■ Intrinsic controls: Basic controls like buttons, text boxes, list boxes, etc.,
always found on the toolbox. [1, 1, 8]
■ ActiveX controls: Interactive objects that can be added to forms, supporting
OCX (OLE control). [1, 1]
■ Insertable Objects: Other objects, like Microsoft Excel, that can be added to
the toolbox. [1, 1]

● Question: Describe the purpose of a TextBox control. [3, 3]


○ Answer: A TextBox control is used to allow users to enter and display text
data. [3, 3]

● Question: How do you add an image to a PictureBox control? [3, 3]


○ Answer: The Picture property of the PictureBox control is used to load and display
an image. [3, 3]

III. Event Handling and Programming [1, 1, 4]


● Question: How do you handle an event in Visual Basic? [1, 1]
○ Answer: Event handling involves defining code blocks (procedures) that execute
when a specific event occurs. For example, a click event of a button will execute
code when the user clicks that button. [1, 1, 9, 10]
● Question: Explain the concept of a ReDim statement in Visual Basic. [11, 11]
○ Answer: The ReDim statement is used to dynamically change the size of an array.
It allows you to resize an array after it has been declared, according to Simplilearn.
[11, 11]

IV. Data Manipulation and Database Access [5, 5]


● Question: How can you access a database in Visual Basic?
○ Answer: Visual Basic offers various methods for database access, including ADO
(ActiveX Data Objects) and other database libraries.

● Question: What is an ADO recordset?


○ Answer: An ADO recordset is a collection of records (rows) retrieved from a
database table. [5, 5, 12]

V. General Programming Concepts [13]


● Question: What is the purpose of an Integrated Development Environment (IDE)?
○ Answer: An IDE (Integrated Development Environment) provides a comprehensive
environment for coding, debugging, and testing applications. It includes features
like a code editor, debugger, and build tools.

● Question: What are the different data types available in Visual Basic?
○ Answer: Visual Basic supports various data types like Integer, Long, Single,
Double, Boolean, String, Date, and Currency. [13, 13, 14]

]
Here are 40 viva questions and answers, each with at least two lines of explanation,
covering key concepts from the specified units.

---

### UNIT – I: Collections and Forms

1. **Q: What is a Collection in VB, and how is it used?**


**A:** A Collection in Visual Basic is an object that groups related items, allowing for efficient
management and manipulation of these items. It provides methods to add, remove, and iterate
through its elements easily.

2. **Q: How do you add an item to a Collection?**


**A:** You can add an item to a Collection using the `.Add` method, where you specify the
item and an optional key. This allows you to reference the item later using its key instead of its
index.

3. **Q: What method would you use to remove an item from a Collection?**
**A:** Use the `.Remove` method to delete an item from a Collection by specifying its key.
This allows for straightforward management of the items stored in the Collection.

4. **Q: How can you count items in a Collection?**


**A:** The number of items in a Collection can be obtained using the `.Count` property. This is
useful for checking if the Collection is empty or determining how many items you are working
with.

5. **Q: Describe how to create a form in a VB project.**


**A:** A form can be created by selecting "Add New Form" from the Project menu in the
Visual Basic IDE. Once the form is created, you can design its layout by dragging and dropping
controls from the toolbox.

6. **Q: What does the Load statement do in relation to forms?**


**A:** The Load statement initializes and displays a form when the application starts or when
it is called. This is important for setting up controls and preparing the user interface before user
interaction.

7. **Q: How do you show and hide forms at runtime?**


**A:** To show a form at runtime, use the `.Show` method, making the form visible to users.
Conversely, the `.Hide` method can be used to conceal the form when it is no longer needed,
maintaining a clean interface.

8. **Q: What is the Form-load event, and why is it useful?**


**A:** The Form-load event is triggered when a form is loaded into memory, enabling you to
run initialization code. This is critical for setting default values and loading any necessary data
into controls before the form becomes visible.

9. **Q: Explain the purpose of the Activate and Deactivate events for forms.**
**A:** The Activate event occurs when a form gains focus, while the Deactivate event fires
when it loses focus. These events are useful for managing user interactions and updating the
interface based on which form is currently active.
10. **Q: Give an example use case for Forms in VB.**
**A:** Forms can be used to create user-friendly interfaces for applications like a customer
relationship management (CRM) system, enabling users to enter, modify, and view customer
data interactively and intuitively.

---

### UNIT – II: Menus and Advanced Controls

11. **Q: What is the function of the Menu Editor in VB?**


**A:** The Menu Editor is a tool in Visual Basic that allows developers to create and arrange
menus and submenus visually. This tool enhances the usability of applications by providing
easy navigation to various functionalities.

12. **Q: How can you add shortcut keys to menu items?**
**A:** Shortcut keys can be assigned to menu items by setting the `Shortcut` property within
the Menu Editor. This feature fosters efficiency by allowing users to perform operations quickly
using the keyboard.

13. **Q: Explain how to modify an existing menu item.**


**A:** To modify a menu item, select it in the Menu Editor and adjust its properties, such as
its caption or event handler. This allows you to update its functionality or appearance based on
your application’s needs.

14. **Q: What are common dialog boxes, and how are they used with menus?**
**A:** Common dialog boxes provide standard windows for operations like file selection, color
picking, or printing. They can be linked to menu items to streamline user tasks within the
application by offering familiar UI interactions.

15. **Q: Describe how to create submenus in VB.**


**A:** Submenus are created by nesting menu items under a parent item in the Menu Editor.
This hierarchical organization helps categorize related commands and enhances user
navigation through the application.

16. **Q: What is a ListView control?**


**A:** A ListView control displays a list of items in various formats, such as detailed view or
icon view. It is ideal for presenting large datasets in a structured way, allowing for easy sorting
and displaying of information.

17. **Q: How does a TreeView control work?**


**A:** A TreeView control organizes data in a hierarchical format using expandable nodes.
This control is effective for displaying relationships among data items, such as folders and files,
in a clear and logical manner.

18. **Q: Describe the purpose of the Status Bar control.**


**A:** The Status Bar control is used to display information about the application's current
status at the bottom of a form. It improves user experience by providing context-sensitive
messages and feedback about ongoing operations.

19. **Q: What is the use of a Progress Bar in VB?**


**A:** A Progress Bar visually represents the progress of a lengthy operation, like copying
files or loading data. By showing the completion percentage, it keeps users informed and
engaged during potentially time-consuming tasks.

20. **Q: How do you handle events for menu items?**


**A:** Event handling for menu items is done by creating event procedures that respond to
user actions, such as clicking a menu item. These procedures define what happens when a
user selects an item, enhancing the application's interactivity.

---

### UNIT – III: File Handling and Graphics

21. **Q: What are the steps to open a sequential file in VB?**
**A:** To open a sequential file, use the `Open` statement, specifying the file name and mode
(Input, Output, Append). This allows your application to read from or write to that file depending
on the mode set.

22. **Q: How do you write data to a sequential file?**


**A:** You can write data to a sequential file using either the `Print` statement for formatted
output or the `Write` statement for unformatted output. You must provide the file number
associated with the opened file to direct the output correctly.

23. **Q: How can you read data from a sequential file?**
**A:** To read data from a sequential file, use the `Input` statement, which retrieves data line
by line. This allows you to process each piece of information as needed, ensuring efficient
handling of file content.

24. **Q: Explain how to find the end of a data file.**


**A:** The `EOF` (End of File) function checks if the end of the file has been reached while
reading it. This is especially useful in loops to prevent reading past the end and resulting in
errors.

25. **Q: What is a Random File, and how is it accessed?**


**A:** A Random File allows direct access to records based on their position rather than
sequentially. You can read and write records using commands like `Get` and `Put`, which
improve efficiency when dealing with large datasets.

26. **Q: What graphical operations can you perform with VB drawing methods?**
**A:** VB provides a range of graphical operations, including drawing shapes like lines and
circles, filling them with colors, and manipulating graphical elements on forms. These methods
help create visually engaging applications with custom designs.

27. **Q: How do you handle the Paint event?**


**A:** The Paint event handles custom drawing on a form or control when it is refreshed or
needs to be redrawn. Using this event, you can execute drawing commands to ensure graphic
elements appear correctly in the interface.

28. **Q: Describe how to create a graphic object in VB.**


**A:** To create a graphic object, you would utilize the `Graphics` class associated with a
form or control. This allows you to perform various drawing operations and create custom
visuals within your application.

---

### UNIT – IV: Accessing Databases

29. **Q: What is the purpose of Data Controls in VB?**


**A:** Data Controls facilitate the connection between a VB application and a database,
enabling operations like viewing, adding, and updating records. They simplify data management
and allow developers to focus on the application's user interface.

30. **Q: Explain the difference between DAO, RDO, and ADO.**
**A:** DAO (Data Access Objects) is used for databases like Microsoft Access, RDO
(Remote Data Objects) is targeted at remote databases such as SQL Server, while ADO
(ActiveX Data Objects) is designed for flexible data connectivity across multiple data sources.

31. **Q: What is the purpose of a DataSet in ADO.NET?**


**A:** A DataSet is an in-memory representation of data that can hold multiple tables and
their relationships. It allows for disconnected data operations, making it suitable for applications
that require offline data manipulation.

32. **Q: How do you connect to a database using ADO?**


**A:** To connect to a database using ADO, you create an instance of the `Connection`
object and set its connection string to specify the database provider, server name, and
authentication details. This establishes a link between your application and the database.

33. **Q: What is a Command object in ADO?**


**A:** A Command object is used to execute SQL statements or stored procedures against a
database. It encapsulates the command and its parameters, enabling effective execution of
queries and retrieval of results.

34. **Q: How do you retrieve data from a database using ADO?**
**A:** Data can be retrieved using a Command object with a SQL query that is executed
using the `ExecuteReader` method, returning a `DataReader` object that provides forward-only
access to the result set.

35. **Q: What are data-bound controls, and how are they used?**
**A:** Data-bound controls are user interface elements linked to a specific data source,
allowing them to display and edit data automatically. This simplifies the process of populating
controls with database content, such as text boxes or grids.

36. **Q: How can you update records in a database using ADO?**
**A:** Records can be updated by using an `UPDATE` SQL command through a Command
object. Once the command is executed, the changes are committed to the database, ensuring
data integrity.

37. **Q: What is the difference between a DataReader and a DataAdapter?**


**A:** A DataReader provides a fast, forward-only stream of data from the database, best for
read operations. In contrast, a DataAdapter allows for loading data into a DataSet and handling
operations like insert, update, and delete.
38. **Q: Explain how to delete records from a database.**
**A:** To delete records, you would use a `DELETE` SQL command executed through a
Command object. By specifying the condition for which records to remove, the database is
updated accordingly.

39. **Q: What is normalization in database design?**


**A:** Normalization is the process of organizing a database to minimize redundancy and
dependency by dividing large tables into smaller, related ones. This improves data integrity and
reduces the likelihood of anomalies during data operations.

40. **Q: How do you handle errors while accessing a database in ADO?**
**A:** Error handling in ADO can be managed using structured error handling techniques
such as `Try...Catch` statements. This allows you to capture and respond to exceptions that
occur during database operations, ensuring robust application behavior.

---

Feel free to ask if you need further customization or if there's a specific area you'd like to
explore more!re

You might also like