VB Viva'
VB Viva'
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]
● 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.
---
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.
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.
---
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.
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.
---
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.
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.
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.
---
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.
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.
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