Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Important questions for Visual Basic Question no Write a program that asks the u

ID: 3876891 • Letter: I

Question

Important questions for Visual Basic Question no Write a program that asks the user to enter 20 numbers from a user and stores these number into array. your program should perform the following task. Write a function that counts the positive number in array uestion no Write a program that asks the user to enter 20 numbers from a user and stores these number into array. your program should perform the following task Write a function that counts the even numbers that in arrav . Question no Write a program that asks the user to enter 20 numbers from a user and stores these number into array . your program should perform the following task. Write a function that calculate the average of the number in a the array Question No An array of size N contains N positive integer 0-9construct an algorithm to determine if word is palindrome (mom,4994) Question no write the program to read a positive integer N whether or not N is prime number Question No what is event driven programming ?differentiate between event driven pro gramming and visual programming Question no Write a VB program that takes n numbers as input .it outputs the frequency of positive and negative numbers. A sample input and out put as follows:-. Input N = 12 The 12 numbers are as under: 40,0,-1,59, -37,283,61,387,-91,-103,341,523 Question NO Write a VB program that reads n values in a list and print the product of the value and position at which it resides in the list.product-L[1] , product-L.[2] * 2 and so on Note the list does not change:- Example:- position:-1 2 3 45 Value 21 4 Outpu5 Question no What is meant by structure programming? Describes event procedures, function procedures and modules. also given one coding for each type of the procedure 20 Question no . write a VB program that takes N numbers as input it print the maximum number and its frequency (number of occurrence)

Explanation / Answer

Q)Answer:

Event-driven programming:

Event-driven programming is a computer programming paradigm in which control flow of the program is determined by the occurrence of events. These events are monitored by code known as an event listener that, if it detects that its assigned event has occurred, runs an event "handler", typically a callback function or method. This handler deals with the event by responding to it with program code.

In theory, all programming languages support the event-driven style of programming, although some language features, such as closures, make it easier to implement. Other programming environments, such as Adobe Flash, are specifically tailored for triggering program code by events.

An event-driven program is one that largely responds to user events or other similar input. The concept of event-driven programming is an important one in application development and other kinds of programming, and has spawned the emergence of event handlers and other resources.

The idea in event-driven programming is that the program is designed to react.

It reacts to specific kinds of input from users, whether it's a click on a command button, a choice from a drop-down list, an entry into a text box, or other kinds of user events.

Other programming languages may feature user events that are largely delivered through a command-line interface or some other type of user interface. The opposite of event-driven programming would be programming that is written to act regardless of user input.

For example, display apps such as those for weather updates or sports scores may feature less of the event-driven programming that is inherent in other kinds of programs. However, nearly all software relies on user events for functionality, and it would be easy to argue that event-driven programming is the default for nearly all kinds of projects.

That's because, in general, applications and code modules are written to respond to human actions, which is part of the core concept of how humans work with machines. However, identifying event-driven aspects of programs can be helpful in design analysis.

difference between event driven programming and visual programming:

Event driven programming:

-> program control flow is determined by events, such as sensor inputs or user actions (mouse clicks, key presses) or messages from other programs or threads.

->Control flow is determined mainly by events, such as mouse clicks or interrupts including timer

->Main loop, event handlers, asynchronous processes

->Procedural, dataflow

->JavaScript, ActionScript, Visual Basic, Elm

Visual programming:

->Visual programming language (VPL) is a programming language that uses graphical elements and figures to develop a program.

->VPL employs techniques to design a software program in two or more dimensions, and includes graphical elements, text, symbols and icons within its programming context.

->Visual programming language is also known as executable graphics language.

->Visual programming language enables the development of software programs by eliminating textual software code with a series of visual graphics elements. VPL incorporates these graphical elements as the primary context of the language arranged in a systematic order. The graphics or icons included within a visual program serve as input, activities, connections and/or output of the program

->Visual language has a few types, such as icon-based languages, diagramming languages and form-based language.

->Visual languages should not be confused with GUI-based programming language as they only provide graphical program authoring services. However, their code/context is completely textual.

->Kodu, Blockly and executable UML are popular examples of visual programming languages.

Q)Answer:

Structured programming:

Structured programming is a logical programming method that is considered a precursor to object-oriented programming (OOP). Structured programming facilitates program understanding and modification and has a top-down design approach, where a system is divided into compositional subsystems.

Structured programming is a procedural programming subset that reduces the need for goto statements. In many ways, OOP is considered a type of structured programming that deploys structured programming techniques. Certain languages – like Pascal, Algorithmic Language (ALGOL) and Ada – are designed to enforce structured programming.

The structured programming concept was formalized in 1966 by Corrado Böhm and Giuseppe Jacopini, who demonstrated theoretical computer program design through loops, sequences and decisions. In the late 1960s-early 1970s, Edsger W.Dijkstra developed structural programming functionality as a widely used method, in which a program is divided into multiple sections with multiple exits and one access point.

Modular programming is another example of structural programming, where a program is divided into interactive modules.

Event procedures:

he code that performs actions in response to events is written in event procedures. Each event procedure contains the statements that execute when a particular event occurs on a particular object. Event procedure names have the form objectName_event, where objectName is the name of the object on which the event occurred and event is the type of the event. For example, an event procedure named cmdClear_Click will be executed when the user clicks on the button named cmdClear.

The event procedures are written in the code window. To open the code window, double click on the control for which you want to write the event procedure. The code window will open and it will contain the shell of the event procedure for that object:

A Sample Event Procedure:

Function procedure:

A Function procedure is a series of Visual Basic statements enclosed by the Function and End Function statements. The Function procedure performs a task and then returns control to the calling code. When it returns control, it also returns a value to the calling code.

Each time the procedure is called, its statements run, starting with the first executable statement after the Function statement and ending with the first End Function, Exit Function, or Return statement encountered.

You can define a Function procedure in a module, class, or structure. It is Public by default, which means you can call it from anywhere in your application that has access to the module, class, or structure in which you defined it.

A Function procedure can take arguments, such as constants, variables, or expressions, which are passed to it by the calling code.

Declaration Syntax

The syntax for declaring a Function procedure is as follows:

VBCopy

Modules:

A module is a file that holds code or pieces of code that belong either to a form, a report, or is simply considered as an independent unit of code. This independence means that a unit may also not belong to a particular form or report. Each form or report has a (separate) module. To access the module of a form or report, you can open the object in Design View and click the Code button.If you initiate the coding of an event of a form (or report) or of a control that is positioned on a form (or report), this would open the Code Editor window and display the module that belongs to the form (or report). If no code has been written for the form or report, its module would be empty:

Creating a Module:

esides the modules that belong to forms (or reports), you can create your own module(s) that is(are) not related to a particular form (or report). There are three main ways you can create an independent module:

The names of modules are cumulative. This means that the first module would be called Module1; the second would be Module2, etc. It is a good idea to have names that are explicit especially if your application ends up with various modules. To use a custom name for a module, you must save it. This would prompt you to name the module. You can accept the suggested name or type your own and press Enter.