0% found this document useful (0 votes)
150 views32 pages

Visual Programming Assignment No1

This document provides instructions for Assignment 1 of the Visual Programming CS-692 course. It states that only handwritten assignments will be accepted, no late submissions are allowed, and cheating is not permitted. Students must install Visual Studio 2015 or later and submit the assignment before or on the date of the midterm exam. Theoretical questions are provided to be answered, covering topics like the .NET Framework, Common Language Specification, differences between Java and C#, and qualities of a good project. Questions also address console applications, MSIL, and differences between various console output methods.

Uploaded by

Natasha Mallik
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
Download as docx, pdf, or txt
0% found this document useful (0 votes)
150 views32 pages

Visual Programming Assignment No1

This document provides instructions for Assignment 1 of the Visual Programming CS-692 course. It states that only handwritten assignments will be accepted, no late submissions are allowed, and cheating is not permitted. Students must install Visual Studio 2015 or later and submit the assignment before or on the date of the midterm exam. Theoretical questions are provided to be answered, covering topics like the .NET Framework, Common Language Specification, differences between Java and C#, and qualities of a good project. Questions also address console applications, MSIL, and differences between various console output methods.

Uploaded by

Natasha Mallik
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1/ 32

Visual Programming

CS-692

Assignment

No. 1
Instructions:

 Only Hand Written Assignment is accepted, Printed Copy is not allowed

 No late submission is allowed

 Cheating is not allowed

 Install Visual Studio 2015 or Later Version on Your PCs to run the Code

 Last Date is: Before or on the Day of Mid Visual Programming Paper
Theoretical Questions
Answer the following Questions.
Question# 1 Define the following terms

a. .Net Framework

.NET is a developer platform made up of tools, programming languages, and libraries for
building many different types of applications.

There are various implementations of .NET. Each implementation allows .NET code to execute
in different places—Linux, macOS, Windows, iOS, Android, and many more.

1. .NET Framework is the original implementation of .NET. It supports running websites, services,
desktop apps, and more on Windows.

b. Framework Class Library

NET Framework Class Library is the collection of classes, namespaces, interfaces and value
types that are used for .NET applications.

It contains thousands of classes that supports the following functions.

 Base and user-defined data types


 Support for exceptions handling
 input/output and stream operations
 Communications with the underlying system
 Access to data
 Ability to create Windows-based GUI applications
 Ability to create web-client and server applications
 Support for creating web services

c. .Net Common Language Runtime


d. namespaces in .Net
Namespaces are the way to organize .NET Framework Class Library into a
logical grouping according to their functionality, usability as well as
category they should belong to, or we can say Namespaces are logical
grouping of types for the purpose of identification.
e. Assembly

An assembly language is a low-level programming language designed for a


specific type of processor. It may be produced by compiling source code
from a high-level programming language (such as C/C++) but can also be
written from scratch. Assembly code can be converted to machine code
using an assembler

f. Common Language Specification

g. A Common Language Specification (CLS) is a document that says how


computer programs can be turned into Common Intermediate Language
(CIL) code. ... Microsoft has defined CLS which are nothing but
guidelines for languages to follow so that it can communicate with
other . NET languages in a seamless manner.``1

h. Visual Programming

n computing, a visual programming language (VPL) is any programming


language that lets users create programs by manipulating program
elements graphically rather than by specifying them textually.
i. Use of keyword “new” in C-Sharp

Use the new keyword to create an instance of the array −

int [] a = new int[5];


The new operator is used to create an object or instantiate an object

j. Structured Programming, Object Oriented Programming, Procedural Programming,


Visual Programming, Event Driven Programming Languages

Structured programming is a programming paradigm aimed at improving the


clarity, quality, and development time of a computer program by making
extensive use of the structured control flow constructs of selection and
repetition, block structures, and subroutine

Object-oriented programming (OOP) is a computer programming model that


organizes software design around data, or objects, rather than functions
and logic. An object can be defined as a data field that has unique
attributes and behavior.

The focus of procedural programming is to break down a programming task


into a collection of variables, data structures, and subroutines,
whereas in object-oriented programming it is to break down a
programming task into objects that expose behavior (methods) and data
(members or attributes) using interfaces

event-driven programming is when a program is designed to respond to


user engagement in various forms. It is known as a programming paradigm
in which the flow of program execution is determined by “events.”
Events are any user interaction, such as a click or key press, in
response to prompt from the system.
k. List down five languages in each of the language categories given in Q#1 Part-j.
l. Why static is used with Main() method in Program.cs file?
A main method is static because it is available to run when your program
starts and as it is the entry point of the program it runs without
creating an instance of the class

m. How C# differs from Java

Java is a class-based Object Oriented language whereas C# is Object-


Oriented, functional, strong typing, component-oriented. Java doesn't
support for operator overloading whereas C# provides operator
overloading for multiple operators. Java does not support pointers while
C# supports pointer only in an unsafe mode.

n. tnWhen was .Net Framework first launched?


The first version of . NET Framework was released on 13 February 2002,
bringing managed code to Windows NT 4.0, 98, 2000, ME and XP. Since the
first version, Microsoft has released nine more upgrades for . NET
Framework, seven of which have been released along with a new version of
Visual Studio

o. Pl----ll-l--pWhat .Net Framework is currently in the Market?


p. List Down all the .Net Framework available or developed so far?
q. What is event?
r. What is property?
s. Why namespace is used in C#?
t. Why the System Class library is used in C#

Question# 2 why the following files are used in .Net applications (window and web application)
a. app.config
b. web.config
c. Program.cs

Also, discuss the contents which can be added to each of these files.

Question# 3 What are the difference between Windows and Web applications?

It is installed in the windows


Web application is installed on
1. platform using Windows operating
web server.
system.

It can be accessed from


It is accessible only from system
2. anywhere around world using
in which it is installed.
internet.

This application can be directly IIS aka internet information


3. executed using operating system on services server is needed to
system. run web applications.

It can run on a variety of


It Can Run only on Windows
4. platforms including is Mac,
platform.
Linux, Solaris, Android etc.

It is specific to bit. If it is
The web application is
5. designed for 32-bit OS, it will not
independent of type of system.
work for 64-bit operating system.

Examples: Adobe Photoshop, Adobe


Examples: Chrome, Internet
6. ImageReady, Adobe Photoshop, MS
Explorer, Firefox
Excel, Ms Word, MS Powerpoint

Question# 4 What are the differences between JAVA and C-Sharp language?

Java vs C#
Last Updated: 18-05-2020
C# is a general-purpose, modern and object-oriented programming language pronounced as “C
sharp”. It was developed by Microsoft led by Anders Hejlsberg and his team.

Java is a general-purpose computer programming language that is concurrent, class-based,


object-oriented etc. Java applications are typically compiled to bytecode that can run on any Java
virtual machine (JVM) regardless of computer architecture.

Question# 5 What are the qualities of good project (Window or Web based)?

 Well Designed and Functional. Your site reflects your company, your products, your services and
ultimately your brand. ...
 Easy to Use. ...
 Optimized for Mobile. ...
 Fresh, Quality Content. ...
 Readily accessible contact and location. ...
 Clear calls to action. ...
 Optimized for Search and the Social Web.

Question# 6 What is the function of using MSIL.

The Microsoft Intermediate Language (MSIL), also known as the Common


Intermediate Language (CIL) is a set of instructions that are platform
independent and are generated by the language-specific compiler from the
source code

Question# 7 What is a Console Application?

A Console Application, in the context of C#, is an application that takes


inputs and displays output at a command-line console with access to three
basic streams: standard input, standard output, and standard erro

Question# 8 Differentiate between Console.Read() and Console.ReadLine()


The only difference between the Read() and ReadLine() is that Console. Read is
used to read only single character from the standard output device, while
Console. ReadLine is used to read a line or string from the standard output
device.May

Question# 9 Differentiate between Console.Write() and Console.WriteLine()

The difference between Write() and WriteLine() method is based on new line
character. Write() method displays the output but do not provide a new line
gtfcharacter. WriteLine() method displays the output and also provides a new
line character it the end of the string, This would set a new line for the
next output.

Question# 10 Differentiate between Double and double; String and string, int, Int16, Int32 and
Int64.

Double is an object and double is a primitive data type. ... The Double class
wraps a value of the primitive type double in an object. An object of type
Double contains a single field whose type is double

Essentially, there is no difference between string and String (capital S) in C#.

String (capital S) is a class in the .NET framework in the System namespace. The fully qualified
name is System.String. Whereas, the lower case string is an alias of System.String.

Int16: This Struct is used to represents 16-bit signed integer. The Int16 can
store both types of values including negative and positive between the ranges
of -32768 to +32767

Int32: This Struct is used to represents 32-bit signed integer. The Int32 can
store both types of values including negative and positive between the ranges
of -2147483648 to +2147483647

Int64: This Struct is used to represents 64-bit signed integer. The Int64 can store both types of
values including negative and positive between the ranges of -9,223,372,036,854,775,808 to +9,
223,372,036,854,775,807
Question# 11 Define the syntax of using

a. if statement

The syntax for if statement is as follows: if (condition) instruction;


The condition evaluates to either true or false. True is always a non-
zero value, and false is a value that contains zero.
b. nested if-statement

c. if-else statement
d. nested if-else statement
e. switch statement
f. for loop
g. while loop
h. do-while loop
i. Give programming example of break and conditional operators in C-Sharp
j. declaring and initializing one dimensional array
k. declaring and initializing two dimensional array
Question# 12 What are command line arguments? How command line arguments are used

Properties of Command Line Arguments:

They are passed to main() function. They are parameters/arguments supplied to


the program when it is invoked. They are used to control program from outside
instead of hard coding those values inside the code. argv[argc] is a NULL
pointer.

Question# 13 What are Strings? How String Variables are declared in C-Sharp.

In C#, you can use strings as array of characters, However, more common
practice is to use the string keyword to declare a string variable. The string
keyword is an alias for the System. String class

Question# 14 How String array is declared? Declare an Array of size 50.

Question# 15

1. what is class?

Everything in C# is associated with classes and objects, along with its


attributes and methods. For example: in real life, a car is an object.
The car has attributes, such as weight and color, and methods, such as
drive and brake. A Class is like an object constructor, or a "blueprint"
for creating objects.
2. How class is declared in C-Sharp?
The name of the class follows the class keyword. The name of the class
must be a valid C# identifier name. The remainder of the definition is
the class body, where the behavior and data are defined. Fields,
properties, methods, and events on a class are collectively referred to
as class member
3. How methods are overloaded in C-Sharp?
Overloading happens when you have two methods with the same name but
different signatures (or arguments). In a class we can implement two or
more methods with the same name. Overloaded methods are differentiated
based on the number and type of parameter passed as arguments to the
methods.

4. Design a class for Patient with Patient_Number, Patient_Name, Disease_Type instance


variables. Add methods for reading, displaying and searching data. Finally, instantiate the
class and test the class methods.

Question# 16

1. what is inheritance in C-Sharp?


Inheritance is a feature of object-oriented programming languages that
allows you to define a base class that provides specific functionality
(data and behavior) and to define derived classes that either inherit or
override that functionality
2. Define the base and sub class?
A base class is also called parent class or superclass. Derived Class: A
class that is created from an existing class. ... A Derived class is
also called a child class or subclass.

3. How Inheritance is done in C#


In C#, it is possible to inherit fields and methods from one class to
another. We group the "inheritance concept" into two categories: Derived
Class (child) - the class that inherits from another class. Base Class
(parent) - the class being inherited from

4. Differentiate between Single and Multilevel Inheritance?


Single inheritance is one in which the derived class inherits the single
base class. Whereas multiple inheritance is one in which the derived
class acquires two or more base classes. ... While in multiple
inheritance, the derived class uses the joint features of the inherited
base classes

5. Does C-Sharp support Multiple Inheritance?


Multiple Inheritance isn't supported in C#. To implement multiple
inheritances, use Interfaces
6. Design the classes to show the concepts of Single, Multilevel and Multiple Inheritance in
C-Sharp?

Question# 17 define the following terms with suitable programming examples

i. private, protected and public


ii. finalize
iii. partial class
iv. foreach loop in c-sharp
v. while and do-while loop

Question# 18 Explore the differences between .Net Framework 2.0, .Net Framework 2.5, .Net
Framework 3.0, .Net Framework 4.0 and .Net Framework 4.5.

Question# 19 what are Collection? Define ArrayList? What are various methods available for
ArrayList in C#.

Question# 20 How many programming languages are supported in .Net framework. List down
any 10 programming languages supported by .Net Framework

Question# 21Why the following Windows are used in Visual Studio

a. ToolBox Window
b. Solution Explorer
c. Property Windows
d. Output Window
e. Error List
f. Server Explorer
Question# 22 what is Visual Programming? List down any five Visual Programming Languages

visual programming language (VPL) is any programming language that lets users
create programs by manipulating program elements graphically rather than by
specifying them textually.

Examples of visual programming languages include: Alice, GameMaker, Kodu, Lego


Mindstorms, MIT App Inventor, Scratch (Build Your Own Blocks and Snap)

Question# 23 List down ten control names from ToolBox and their important properties from

Question# 24 Find the short cut keys for

a. Opening Solution Explorer


Ctrl+Shift+O
b. ToolBox
Ctrl+Alt+X
c. Running a form
d. Opening the Error List
e. Opening the Server Explorer
f. Property Window

Question# 25 why the following controls are used? Define important properties of each of the
following controls

a. ToolTip
b. ProgressBar
c. NumericUpDown
d. LinkLabel
e. Timer
f. Color Dialog
g. VScrollBar
h. HScrollBar

Question# 26 Why message box is used in C#? Display Aslamo Alaikum in the Message Box?
Question# 27 Why the Form1_Load() event is used? When it is called? Which type of code is
usually given in the Form_Load() event

Question# 28 Design a Scientific Calculator in C# Windows application having basic arithmetic


as well as scientific operations like Sin, Cos, Tan, Log, Factorial etc.

Question# 29 Design a NotePad application in C# windows form, with the basic functionality of
Notepad that comes with Microsoft Windows

Question# 30 Why web browser control from ToolBox is used? Discuss its important properties
and Events?

Question# 31Differentitate between ListBox and ComboBox Controls. Write down their
important properties and Events.

Question# 32 Differentiate between MonthCalander and DateTimePicker Controls. Write down


their important properties and Events.

Question# 33 Differentiate between CheckBox and RadioButton Controls. Write down their
important properties and Events.

Question# 34 why the following C# controls are used, discuss their properties

a. Panel
b. FlowLayoutPanel
c. GroupBox
d. SplitPanel
e. TabControl
f. TableLayoutPanel

Question# 35 Discuss the following in C#

a. Delegates in C#
b. Interfaces in C#
c. Enum in C#
d. Stacks and Queue Collections in C#
e. Locking of Controls on Form1 Control
f. Which control is used for creating Menus in C#
g. Why MDI Parent form is used

Question # 36 Define/Describe each of the followings

a. DBMS and Type of DBMS

b. Differentiate between Tables and Views

c. Differentiate between Stored Procedures and Views

d. Differentiate between Primary Key and Foreign Key

e. Console Vs Window Application

f. Why Program.CS file is used in Window Application

g. Write the Connection of a Database EShopping (suppose this database is on your own

PC)

h. Why we use the following Controls in Window Applications. Define each control and

give programming examples

1. Button Control

2. Textbox Control

3. Label Control

4. Picture Box

5. Date Time Picker

6. Data Gridview

7. CheckBox

8. Masked Textbox

9. Numeric Updown
10. ToolTip

11. Check Box

12. Progress Bar

i. Which properties of are used To

1. Copy the Text from TextBox to string Variable

2. Know which Radio button has been clicked from a list of three Radio buttons

3. Change the name of the TextBox1 to txtStudentName

4. Change the Label Text at Run Time

j. How to open FORM2 when you click the button on FORM1. Write the syntax to open a

Form from other Form.

k. Define and Explain the purpose of each of the followings

1. SQLConneciton Class, Discuss each method of SQLConnection Class

2. SQLCommand Class, Discuss each method of SQLCommand Class

3. SQLDataAdapter Class, Discuss each method of SQLDataAdapter Class

4. SQLDataReader Class, Discuss each method of SQLDataAdapter Class

5. Dataset Class, Discuss each method of DatasetCass

6. Differentiate between Dataset and DataTable

7. Differentiate between Dataset and DataReader


Programming Questions
Question No. 1 Read the name of all your class fellows in this array. Then using the built-in
String class function. Write the C-Sharp code to

a. Display all the names of the students which starts with letter S
b. Count all those names in the array which contains Khan in their name
c. Display all those Student Names which are having Rehman in their names
d. Find how many words are there in each name of the student

Question# 2 Design a class in C#, named ArrayHandlingInCSharp. Add the following


methods in the class and uses one dimensional Array:

a. readArrayItems() ------------------To read Values in the Array

b. showArrayItems() -------------------To display the Values stored in the Array

c. sortArrayItems() -------------------To sort the contents of Array using Bubble Sort

d. findMaximuminArray() ------------------To find maximum in Array

e. returnArrayItemsSum() ------------------To find and return the sum of Array Contents which
are Odd indexed

Overload the constructors in the above class. Finally, instantiate the class in Main () and
test the newly created class.
Question# 3 Design a windows form which input First Name and Last name in two text
boxes and then full name should be displayed in third text box

Q# 4 Design the following simple Calculator in C# and write the code against each of the
buttons
Q# 5 Design the following form using ListBox, TextBox , Label and a Button. When you press
the Add Country Name Button then the Country Name user entered in the TexBox must be
added to the ListBox as shown. It must also be checked that non-empty country name should be
added and the name should be repeated as well.
Q# 6 Design the following form using ComboBox, TextBox , Label and a Button. When you
press the Add Country Name Button then the Country Name user entered in the TexBox must be
added to the ListBox as shown. It must also be checked that non-empty country name should be
added and the name should be repeated as well.
Q# 7 Differentiate between ListBox and ComboBox

Q# 8 Design the following form using Radio Buttons, TextBox , Label and a Button. When you
press the Show Details Button then the User Name user entered in the TexBox must be displayed
in Message Box with the Gender selected……………… Ensure at a time only Male or Female
option is available.
Q# 9 Design the following form using CheckBoxes, TextBox , Label and a Button. When you
press the Show Details Button then the User Name user entered in the TexBox must be displayed
in Message Box with the hobbies selected by the user………………
Q# 10 Design the following form using DateTimePicker, TextBox , Label and a Button. When
you press the Age (In Years Months and Days) Button then age is displayed in the Textboxes
in Years Months and Days

Q# 11 Create a Digital Clock in C# as shown


Q# 12 Create a Splash Screen in C# using ProgressBar Control and Timer Control

Q# 13 Design a form Such that it look like this and perform the Calculator Operations according

to button being clicked

This is a sample scientific calculator. Code the form and copied all the code in word file.

Q# 14 Design a form as shown here and perform the String Operations as labelled on each

Buttons
You can user TextBox1 or TextBox2 Separately or combined where needed. The result of String

Operation should be displayed in TextBox3. E.g. in the output, user has entered the Saif Ur

Rehman Text in textbox1 and then he has pressed the Length button. So, operation performed

behind Length button was to count the Total Characters in the TextBox1 and result has been

displayed in TextBox3. Similarly, perform String Operation according to each button labelled in

the above Output Screen.

Q# 15 Design a Search form for the Table

tblCustomer(CustomerSID, CustomerName, CustomerCell#, CustomerEmailId,

CustomerRegistraitonDate, Gender, CustomerAddress, CustomerPhoneNo, Status (Data type of

Status us Bit) )

The search criteria should be


Now, based on the Entries you have to Query database Table and fill in the Grid View. Note,

a. If user provide no Search Criteria, i.e. if all fields left empty and user click the Search

Button then all Record of Customer should be displayed in Grid View

b. If user enter just Name then your Query Where Clause should be executed for Name

based search only

c. When user enter From Date and To Date value, then all Customers should be filled in

Grid which have been registered between these two Dates.

d. You have to ensure that To Date is greater than the From Date

Q# 16 Design the Login form and Authenticate the user using Stored Procedure, if User exists in
database then show Message in MessageBox that you have been logged in to System
successfully.

Q # 17 Design a table named

tblCustomer(CustomerSID, CustomerName, CustomerCell#, CustomerEmailId,

CustomerRegistraitonDate, Gender, CustomerAddress, CustomerPhoneNo, Status (Data type of

Status us Bit) )

in database.
Then design a Form, to add following controls to it.

a. TextBox

b. Labels

c. Add five Buttons (Save, Update, Delete, New, Cancel)\

d. Radio Buttons for Status and Gender

Then, create Stored Procedures for

1. Insert Record to Database

2. Delete a Record from Database

3. Fill the data Grid view placed on Form using SELECT statement

4. Update an Existing Customer Record using SQL Update Statement

Finally, code behind the SAVE, Update, Delete, Search buttons on the C# window form to call

each stored procedure.

Q# 18 Design a form to show the use of the following Controls

a. TextBox1, but only Numeric Data can be entered to TextBox1

b. TextBox2, but only Capital Alphabet can be entered to TextBox2

c. TextBox3, but only Small Alphabet can be entered to TextBox3

d. Date in DataTimePicker1 should not be choosen less than your PC Date

Q # 19 Answer the followings;

l. Suppose we have filled a Dataset from a Database Table tblEmp(EID,Ename,ECNIC).

You are required to write the code which tells how much records are there in Dataset
m. Explain MessageBox in C#. How you will know which Button has been clicked in

MessageBox

a. SQLConneciton Class, Discuss each method of SQLConnection Class

n. Write one line code to find the length of the Text Entered in a TextBox named txtCNIC

o. Write one line code to check whether TextBox named txtCNIC has text or it is empty

p. What are the advantages of using MDIParent in the Window Applicaitons

q. Write one line code to make an Array of TextBox of size 20.

r. Differentiate between Convert.ToInt32 and Convert.ToInt16

Q# 20 Your University want to manage student records, and you need to save these records in
database. You have a database named “StudentManagementSystem”, following attributes of a
student must be stored in database. (StudentId, StudentName, FatherName, DateOfBirth,
Address).

A. Write Code to Create Stored Procedure in database for Insertion of records.


B. Write C# code to insert records using Stored Procedure. (Write all steps in detail)
C. You must ensure that Student Name and Father Name must not be NULL and must be at
least 10 characters each. Finally, Date of Birth should be less than today’s date and not
later than 1990.

Q# 21 Write a code to create Rich Text Editor using filing I/O Your application support txt, doc
files and open these files in your editor after that these files save in dynamic location using
different dialog box. Your application is able to cut copy bold functions if you open new editor
all data will be removed
Q # 22 In UIIT Online Job Portals applied many candidates and these records are save in
Database, Using Layered Programming and Stored Procedures Write a code only show those
records those have BSCS degrees, after that more filtration filter those records thy CGPA above
2.50and status is “Not Verified” these records show in another Data grid view

Q# 23 UIIT online admission form for New students apply online. Here following create new
user account form. The form is designed in Windows application you are not write any code
accordingly design
(A)
1) Write code when combo box is open get
data from Database .and bind this data in
combo box
2) At a time only one radio button box
selected. When cheek any radio button first
radio button unchecked
3) To Handle Server Side Validation Insert
data in Database using Stored Procedures
(B)
1) When data inserted conformation message
show “DATA INSERTED”, if click reset the
all field empty

Compiled and Prepared By

Dr. Saif Ur Rehman, Assistant Professor

University Institute of Information Technology

PMAS Arid Agriculture University, Murree Road Rawalpindi

More Lectures in PDF/Video can be downloaded on

www.aspuiit.blogspot.com

You might also like