Midterm 26 March 2015 (4:30-5:30 pm) – Rm5620 Closed book exam MC Questions only x25 Up to L(7) Methods Scope: video lectures (+Lab), forum discussions,

Slides:



Advertisements
Similar presentations
Practical Programming COMP153-08S Lecture: Repetition Continued.
Advertisements

Lecture Roger Sutton CO331 Visual Programming 12: One-dimensional Arrays 1.
Control structures Part 2 iteration control To enable repetition of a statement block.
Two dimensional arrays. A two dim array is doubly subscripted… It has rows and columns Tables of data are examples of two-dim arrays. As with one-dim.
Coding ADO.NET Objects: Connection, Command, DataReader.
More on lists, exceptions, loops and validation. You can use the exception to indicate the error that occurred Private Sub btnCheck_Click(ByVal sender.
IS437: Fall 2004 Instructor: Dr. Boris Jukic Data Types, Constants, Variables, Scope, Conversion.
A short ppt Importing images Changing fonts. Getting images.
VB – Core III Functions Sub-routines Parameter passing Modules Scope Lifetime.
5.05 Apply Looping Structures
Visual Basic Fundamental Concepts. Integrated Development Enviroment Generates startup form for new project on which to place controls. Features toolbox.
3-1 Chapter 3 Variables, Assignment Statements, and Arithmetic.
COMPUTER PROGRAMMING I Objective 7.04 Apply Built-in String Functions (3%)
1 Visual Basic for Applications (VBA) for Excel Prof. Yitzchak Rosenthal.
1 Κατανεμημένες Διαδικτυακές Εφαρμογές Πολυμέσων Γιάννης Πετράκης.
Structural Pattern: Decorator There are times when the use of subclasses to modify the behavior of individual objects is problematic. C h a p t e r 4.
Chapter 9: Getting Comfortable with Object- Oriented Programming.
Lecture 8 Visual Basic (2).
COMPUTER PROGRAMMING I Objective 7.03 Apply Built-in Math Class Functions.
6.1 Introduction Divide and Conquer –The best way to develop and maintain a large program is to construct it from small, manageable pieces. BZUPAGES.COM.
Visual Basic.NET Comprehensive Concepts and Techniques Chapter 4 Working with Variables, Constants, Data Types, and Expressions.
1 CC111 Lec9 : Visual Basic Visual Basic (3) Lecture 9.
 2002 Prentice Hall. All rights reserved. 1 Chapter 5 – Control Structures: Part 2 Outline 5.1Introduction 5.2 Essentials of Counter-Controlled Repetition.
Chapter 9: Writing Procedures Visual Basic.NET Programming: From Problem Analysis to Program Design.
MS Visual Basic Applications Walter Milner. Event-driven programming Standard approach for GUIs Contrast with old character interfaces – program determines.
COMPUTER PROGRAMMING I 5.05 Apply Looping Structures.
Synthesis ENGR 1181 MATLAB 11. Topics  No new material  Covers topics that will be on the Midterm 2 Exam MATLAB 01 – Program Design MATLAB 02 – Introduction.
CS0004: Introduction to Programming Project 1 – Lessons Learned.
6c – Function Procedures Lingma Acheson Department of Computer and Information Science, IUPUI CSCI N331 VB.NET Programming.
Clearly Visual Basic: Programming with Visual Basic 2008 Chapter 8 What’s Wrong with It?
Practical Programming COMP153-08S Week 5 Lecture 1: Screen Design Subroutines and Functions.
1 Advanced Computer Programming Lab Calculator Project.
ME 142 Engineering Computation I Using Subroutines Effectively.
PSU CS 106 Computing Fundamentals II VB Declarations HM 5/4/2008.
Problem Solving with Decisions
Created by Alia Al-Abdulkarim 2008 Visual Basic Vs. Java.
Week Procedures And Functions 7 A procedure is a collection of statements that performs a task.
110 E-1 Variables, Constants and Calculations(2) Chapter 3: Operations on variables, scope of a variable, formatting data Doing Arithmetic.
Using ADO.Net to Build a Login System Dr. Ron Eaglin.
1 Microsoft® Visual Basic®.NET Language # 2. 2 Flow-Control Statements If … End If Select Case … End Select For… Next Do … Loop Exit.
Lab 10 Slides.
© 2006 ITT Educational Services Inc. Introduction to Computer Programming: Unit 3: Chapter 3: Slide 1 Unit 3 Formatting Chapter 3 Input, Variables, Constants,
Chapter 6- Procedures. 6.1Introduction 6.2 Modules, Classes and Procedures 6.3 Sub Procedures 6.4 Function Procedures 6.5 Methods 6.6 Argument Promotion.
Practical Programming COMP153-08S Lecture: Repetition.
Subs and Functions Ch 6. Introduction VB.NET Procedures Sub Procedures Function Procedures Outline.
CIS 338: VB Variables Dr. Ralph D. Westfall April, 2011.
Ch. 101 DataTable (Continue) Lab sheet 10.3: Form Display Cities table along with percentage growth.
1 Computer Programming Andres, Wen-Yuan Liao Department of Computer Science and Engineering De Lin Institute of Technology
Visual Basic Declaring Variables Dim x as Integer = 0 In the statement above, x is being declared as an Integer (whole number) and is initialised.
Directory and File. Access Files in a Directory Name space: System.IO The Directory and File classes contain only shared methods that set or return information.
Data Types. Visual Basic provides data type Single for storing single-precision floating-point numbers. Data type Double requires more memory to store.
Processing multiple files
Introduction to Programming Lecture 3 Msury Mahunnah, Department of Informatics, Tallinn University of Technology.
Use TryParse to Validate User Input
Visual Basic Fundamental Concepts
Objective 7.03 Apply Built-in Math Class Functions
Data Types, Arithmetic Operations
Use TryParse to Validate User Input
Introduction to VB programming
Chapter 5 – Control Structures: Part 2
للمزيد زورونا على موقعنا الإلكتروني:
Visual Basic..
Boolean Expressions and If statements
1.الدوال Function 2.الاجراءاتSub Procedure 3.وحده نمطيه Add Module
Visual Basic 6 Programming.
String Variable, Methods and Properties
String Variable, Methods and Properties
Methods.
String Variable, Methods and Properties
String Variable, Methods and Properties
Presentation transcript:

Midterm 26 March 2015 (4:30-5:30 pm) – Rm5620 Closed book exam MC Questions only x25 Up to L(7) Methods Scope: video lectures (+Lab), forum discussions, lecture reviews and in-class exercises Cheat Sheet (already given TODAY. Will NOT provide on 26 March.) Typical questions: Output, Error, Syntax, Logic, Flow etc. Remark: Time, Cheat Sheet+Pencil+Eraser+Stud ID ONLY, Explicit and Strict options

ISOM3230 Business Applications Programming Methods Common Questions

Return Value Return Value Caller subroutine Caller subroutine Program Flow Program Flow Data Type Data Type Option Strict Option Strict

Return Value Q 1:What is the return value? Q 1:What is the return value? Public Function MCQ() As String MCQ = "A" MCQ = "A" MCQ = "B" MCQ = "B" Return "C" Return "C" Return "D" Return "D" End Function

Return Value Q :What is the return value? Q :What is the return value? Public Function MCQ() As String MCQ = "A" MCQ = "A" MCQ = "B" MCQ = "B" End Function The return value is ???

Return Value Q :What is the return value? Q :What is the return value? Public Function MCQ() As String Return "C" Return "C" Return "D" Return "D" End Function The return value is ???

Return Value Q :What is the return value? Q :What is the return value? Public Function MCQ() As String MCQ = "A" MCQ = "A" MCQ = "B" MCQ = "B" Return "C" Return "C" Return "D" Return "D" End Function The return value is ???

Caller subroutine Q2: Write a subroutine to call MCQ() Public Function MCQ() As String MCQ = "A" MCQ = "A" MCQ = "B" MCQ = "B" Return "C" Return "C" Return "D" Return "D" End Function Public Sub Caller Public Sub Caller End Sub Answer = MCQ() Dim Answer As String

Caller subroutine (Student) Q: Write a subroutine to call MCQ() Public Function MCQ() As String MCQ = "A" MCQ = "A" MCQ = "B" MCQ = "B" Return "C" Return "C" Return "D" Return "D" End Function Public Sub Caller Public Sub Caller End Sub caller = MCQ() Dim caller As String MCQ()

Caller subroutine (Shorter=Better) Q: Write a subroutine to call MCQ() Public Function MCQ() As String MCQ = "A" MCQ = "A" MCQ = "B" MCQ = "B" Return "C" Return "C" Return "D" Return "D" End Function Public Sub Caller Public Sub Caller End Sub Dim Answer As String = MCQ()

Program Flow Q3: Which method is going to be executed first? Public Sub Sub1() Dim i As Integer = 0 Dim i As Integer = 0 Do While i <= 8 Do While i <= 8 i += 4 i += 4 If i 6 Then Sub2() If i 6 Then Sub2() If i <= 7 Then Sub3() If i <= 7 Then Sub3() Loop Loop End Sub Public Sub Sub2() Debug.Print("IS") Debug.Print("IS") End Sub Public Sub Sub3() Debug.Print("3230") Debug.Print("3230") End Sub Private Sub Form1_Load(ByVal sender As System.Object, _ ByVal e As System.EventArgs) _ ByVal e As System.EventArgs) _ Handles MyBase.Load Handles MyBase.Load Sub1() Sub1() End Sub RAM i 04 "IS" "3230" 8 "IS" 12 "IS" IS 3230 IS

Data Type Option Strict ON Public Class Form1 Public Function MyFun() As _____(a)_________ Dim s As String = "0." Dim s As String = "0." For i As Integer = 3 To 1 Step -1 For i As Integer = 3 To 1 Step -1 s &= i s &= i Next Next Return CInt(s) Return CInt(s) End Function Private Sub Form1_Load(ByVal sender As System.Object, _ ByVal e As System.EventArgs) _ ByVal e As System.EventArgs) _ Handles MyBase.Load Handles MyBase.Load MessageBox.Show( _______(b)__________) MessageBox.Show( _______(b)__________) End Sub End Class Q4: Fill in the blanks. integer MyFun() MyFun() CStr( )

Strict Option Option Strict ON Public Class Form1 Public Function MyFun1() As Double Return 2.2 Return 2.2 End Function Public Function MyFun2() As Double Dim i as Integer = 1 Return i Return i End Function End Class Strict ON disallows implicit narrowing conversions E.g., Integer -> Double OK Double -> Integer NOT OK Error