You are on page 1of 6

Student Declaration

I Registration No.____20-arid-251______, hereby declare that by attempting the paper for

the course __Modern Programming Languages___,I will not be involved in any kind of

cheating/copying/plagiarizing in solving the short questions based paper of Mid Term

Examination Spring2021. I take full responsibility of my conduct. If I found involved in any

kind of such activity of cheating/copying/plagiarizing, then Institute reserves the right to take

any disciplinary action against me.

Student Signature
Mid Exam / Spring 2021 (Paper Duration 24 hours)
(Online Assignment Based Question Paper)

Course No.: CS-793 Course Title: Modern Programming Languages


Total Marks: 12 Date of Exams: 4/26/2021
Degree: MCS Semester: 3 Section: A
Marks
Q.No. 1 2 3 4 5 6 7 8 9 10 Obtained/
TotalMarks
Marks /12
Obtaine
d
Obtained Marks in Words:
Name of the Teacher: Tayyaba Tariq
Who taught the course:Signature of Teacher / Examiner:

To be filled by Student

Registration No.: 20-ARID-251 Name: Bakhat Bhary

(THEORETICAL EXAMINATION)

Answer the following questions


Q.No.1.How JDBD connectivity model is different from all other models? Justify your answer
with a programming example.
(Marks 06)
Answer:
Database:
Database is the collection of related data that is stored in an compact manner .The data is stored in
such a way that the user can use this data easily .
Database is actually a place where related piece of information is stored and various operations can be
performed on it.
Different types of database:
 Hierarchical database
 Network database
 Relational database
 Object-oriented database
 Graph database
 ER model database
 NoSQL database
For example if a database is created for a student it will contain data about the student such as roll
number , name etc.
By using database user can search the required data quickly and the data is stored data-occupies as
little space as possible in computer.
Tables are used in database to store data table is a collection of rows and columns.
Examples of Databases:
 Phone directory:
Phone directory is the simple example of database. In phone directory we store number of different
persons .Searching of phone number is very easy as data is stored in a organized way.
 Account:
A database is used to control account system of different organization .The accounts database store all
the record of funcational transactions of the organization. It can perform different calculations very
easily as data is stored in a proper way.
Also:
In connevtivity moddels the key differences between JDBC and ODBC is:

1. The most fundamental difference between JDBC and ODBC is that JDBC is a language and it
depends on the platform. ODBC, on the other hand, has an independent language and platform.
2. Java Database Connectivity is an JDBC adjective, and on the other hand, Open Database
Connectivity is an ODBC adjective.
3. The ODBC code is complex and difficult to read. However, JDBC code is simple and easy to use.
4. Both JDBC and ODBC are used from the client side application to access different types of
information on the server side.
Q.No.2.What is the basic concept of JDBC? Explain with different programming examples.
(Marks 06)
Answer:
JDBC:
Java database connectivity is a java API to connect and perform operation ( insert, delete,
update, select, etc ) with the database. It provides classes and interface to connect or communicate
java application with database. It is used to communicate java application to database. It is both
platform and database independent. JDBC is implemented in java without points.

JDBC Architecture :

Application

JDBC API

JDBC Manger

JDBC Drivers

SQL Oracl source


server e DB

Steps to connect to database in java :

 Register driver class


 Create connection object
 Create statement object
 Execute the query
 Close the connection object
Programming examples :

Program 1 Program 2

#include <iostream>
#include <iostream> using namespace std;
using namespace std;
int main()
int main() {
int rows;
{

int space, rows; cout << "Enter number of rows: ";


cin >> rows;
cout <<"Enter number of rows: ";
for(int i = 1; i <= rows; ++i)
cin >> rows;
{
for(int i = 1, k = 0; i <= rows; ++i, k = 0) for(int j = 1; j <= i; ++j)
{
{ cout << j << " ";
}
for(space = 1; space <= rows-i; ++space)
cout << "\n";
{ }
return 0;
cout <<" "; }
}

while(k != 2*i-1)

cout << "* ";

++k

cout << endl;

}
OUTPUT:
return 0;

}
OUTPUT:

You might also like