## Aptitude Questions - for Placements

1.If 2x-y=4 then 6x-3y=?
(a)15
(b)12
(c)18
(d)10

Ans. (b)
2.If x=y=2z and xyz=256 then what is the value of x?

(a)12
(b)8
(c)16
(d)6

Ans. (b)

3. (1/10)18 - (1/10)20 = ?
(a) 99/1020
(b) 99/10
(c) 0.9
(d) none of these
Ans. (a)

4.Pipe A can fill in 20 minutes and Pipe B in 30 mins
and Pipe C can
empty the same in 40 mins.If all of them work
together, find the time
taken to fill the tank
(a) 17 1/7 mins
(b) 20 mins
(c) 8 mins
(d) none of these
Ans. (a)

5. Thirty men take 20 days to complete a job working 9
hours a day.How
many hour a day should 40 men work to complete the
job?
(a) 8 hrs
(b) 7 1/2 hrs
(c) 7 hrs
(d) 9 hrs
Ans. (b)
6. Find the smallest number in a GP whose sum is 38
and product 1728
(a) 12
(b) 20
(c) 8
(d) none of these
Ans. (c)

7. A boat travels 20 kms upstream in 6 hrs and 18 kms
downstream in 4
hrs.Find the speed of the boat in still water and the
speed of the
water current?
(a) 1/2 kmph
(b) 7/12 kmph
(c) 5 kmph
(d) none of these
Ans. (b)

8. A goat is tied to one corner of a square plot of
side 12m by a rope
7m long.Find the area it can graze?
(a) 38.5 sq.m
(b) 155 sq.m
(c) 144 sq.m
(d) 19.25 sq.m
Ans. (a)

9. Mr. Shah decided to walk down the escalator of a
tube station. He
found that if he walks down 26 steps, he requires 30
seconds to
reach the bottom. However, if he steps down 34 stairs
he would only
require 18 seconds to get to the bottom. If the time
is measured from
the moment the top step begins to descend to the
time he steps off
the last step at the bottom, find out the height of
the stair way in
steps?
Ans.46 steps.

10. The average age of 10 members of a committee is
the same as it was
4 years ago, because an old member has been replaced
by a young
member. Find how much younger is the new member ?
Ans.40 years.

## What is Virtual Functions in C++

What is a virtual function?
One of the most talked about feature of object oriented programming. We have two types of polymorphism in C++. One is compile-time and the other is Run-time.
• Virtual function is a use to achieve run-time polymorphism.
• Refers to performing the same operation in a hierarchy of classes. Typically used in scenarios where the base class pointer is used to hold derived class objects and perform the same operation. See the example below.
• When a virtual functions is called on a base class pointer the compiler decides to defer the decision on which function to call until the program is running thereby doing late binding.
• The actual function called at run-time depends on the contents of the pointer and not the type.
• Internally the compiler creates a Vtable for each class which has virtual functions or derived from base class.
• Addresses of virtual functions are placed in the Vtable . If a virtual function is not redefined in the derived class, the base class function address is used in Vtable .
• When objects are created compiler also places a VPTR pointing to starting address of Vtable using which the correct function is invoked.
EXAMPLE: Demonstrate the late binding using virtual functions
```#include<iostream.h>

using namespace std;

// Base class with virtual function
class Base {
int data1;
public:
Base ( int d1) { data1 = d1; }
virtual void print() { cout << "Base" << endl; }
};

// Derived class 1
class Derived1 : public Base {
int data2;
public:
Derived1(int d1, int d2) : Base (d1) { data2 = d2; }
void print() { cout << "Derived1" << endl; }
};

// Derived class 2
class Derived2 : public Base {
public:
Derived2(int d1) : Base (d1) { }
void print()
{ cout << "Derived2" << endl;
}
};
int main()
{ Base b(40);
Derived1 d1(10, 20);
Derived2 d2(30);
Base* ptr;
ptr=&d1;
ptr->print();
ptr=&d2;
ptr->print();
return 0;
}
```
OUTPUT:
Derived1
Derived2

## MCA Sem - 2 Results are out Mumbai University

MCA Sem 2 Results Are Out on 15th March 2012

Go here to check it out.. http://mu.ac.in/res_mcatech.html

Or

http://results.mu.ac.in/choose_nob.php?exam_id=2604&exam_year=2011&exam_month=NOV

## MCA SEM 1 Results are out - Mumbai University

MCA Sem 1 Results are out today evening

Go here to see your result : mu.ac.in/res_mcatech.html

or http://results.mu.ac.in/choose_nob.php?exam_id=2603&exam_year=2011&exam_month=NOV

## MCA SEM-4 Exam Time Table - Mumbai University

The written examination will be conducted in the following order :

Days and Dates Time Paper
------Wednesday, May 16, 2012
03:00 p.m. to 06:00 p.m.

Software Project Management.

------Friday, May 18, 2012
03:00 p.m. to 06:00 p.m.

Java Programming

-------Monday, May 21, 2012
03:00 p.m. to 06:00 p.m.

Network Security

------Wednesday, May 23, 2012
03:00 p.m. to 06:00 p.m.

Object Oriented Modeling & Design Using U M L

------Friday, May 25, 2012
03:00 p.m. to 06:00 p.m.

------Monday, May 28, 2012
03:00 p.m. to 06:00 p.m.

Elective I :Embedded Systems
Elective I : Geographic Information System
Elective I : Customer Relationship Management
Elective I : Artificial Intelligence
Elective I : E-Bussiness

## Type Declaration Instruction:

This instruction is used to declare the type of variables being used in the program. A variable is a location in RAM (main memory) for temporary storage of intermediate data.
Any variable used in the program must be declared before using it in any statement. The type declaration statement is written at the beginning of main() function.

Ex:       int bas;
float  rs, grosssal;
char  name, code;

These are several subtle variations of the type declaration instruction.

i) While declaring the type of variable we can also initialize it as shown below:

int i=10, j=25;
float a=1.5, b= 1.99+2.4 * 1.45 ;
ii)  The order in which we define the variables is sometimes important sometimes not.
For exa:

int i=10,j=20;

is same as
int j=20, i=10;

However,

float a =1.2, b=a+3.1;
is alright, but

float b=a+3.1, a=1.2;

is not.this is because here we are trying to use a even before defining it.

iii) Similarly
int a,b,c,d;
a=b=c=10;
is O.K. but

int a=b=c=d=10;

will not work.( find out why ???)

## The layout of C Programs

The general form of a C program is as follows:

`pre-processor directives`
`global declarations`
`main()`
`{`
`   local variables to function main ;`
`   statements associated with function main ;`
`}`
`f1()`
`{`
`   local variables to function 1 ;`
`   statements associated with function 1 ;`
`}`
`f2()`
`{`
`   local variables to function f2 ;`
`   statements associated with function 2 ;`
`}`
`.`
`.`
`.`
`etc`

Note the use of the bracket set () and {}. () are used in conjunction with function names whereas {} are used as to delimit the C statements that are associated with that function. Also note the semicolon - yes it is there, but you might have missed it! a semicolon (;) is used to terminate C statements. C is a free format language and long statements can be continued, without truncation, onto the next line. The semicolon informs the C compiler that the end of the statement has been reached. Free format also means that you can add as many spaces as you like to improve the look of your programs.

## Fundamental Building Blocks of Programs

There are two basic aspects of programming: data and instructions. To work with data, you need to understand variables and types; to work with instructions, you need to understand control structures and subroutines. You'll spend a large part of the course becoming familiar with these concepts.
A variable is just a memory location (or several locations treated as a unit) that has been given a name so that it can be easily referred to and used in a program. The programmer only has to worry about the name; it is the compiler's responsibility to keep track of the memory location. The programmer does need to keep in mind that the name refers to a kind of "box" in memory that can hold data, even if the programmer doesn't have to know where in memory that box is located.
In Java and in many other programming languages, a variable has a type that indicates what sort of data it can hold. One type of variable might hold integers -- whole numbers such as 3, -7, and 0 -- while another holds floating point numbers -- numbers with decimal points such as 3.14, -2.7, or 17.0. (Yes, the computer does make a distinction between the integer 17 and the floating-point number 17.0; they actually look quite different inside the computer.) There could also be types for individual characters ('A', ';', etc.), strings ("Hello", "A string can include many characters", etc.), and less common types such as dates, colors, sounds, or any other kind of data that a program might need to store.
Programming languages always have commands for getting data into and out of variables and for doing computations with data. For example, the following "assignment statement," which might appear in a Java program, tells the computer to take the number stored in the variable named "principal", multiply that number by 0.07, and then store the result in the variable named "interest":
`interest = principal * 0.07;`
There are also "input commands" for getting data from the user or from files on the computer's disks and "output commands" for sending data in the other direction.
These basic commands -- for moving data from place to place and for performing computations -- are the building blocks for all programs. These building blocks are combined into complex programs using control structures and subroutines.

A program is a sequence of instructions. In the ordinary "flow of control," the computer executes the instructions in the sequence in which they appear, one after the other. However, this is obviously very limited: the computer would soon run out of instructions to execute. Control structures are special instructions that can change the flow of control. There are two basic types of control structure: loops, which allow a sequence of instructions to be repeated over and over, and branches, which allow the computer to decide between two or more different courses of action by testing conditions that occur as the program is running.
For example, it might be that if the value of the variable "principal" is greater than 10000, then the "interest" should be computed by multiplying the principal by 0.05; if not, then the interest should be computed by multiplying the principal by 0.04. A program needs some way of expressing this type of decision. In Java, it could be expressed using the following "if statement":
```if (principal > 10000)
interest = principal * 0.05;
else
interest = principal * 0.04;```
(Don't worry about the details for now. Just remember that the computer can test a condition and decide what to do next on the basis of that test.)
Loops are used when the same task has to be performed more than once. For example, if you want to print out a mailing label for each name on a mailing list, you might say, "Get the first name and address and print the label; get the second name and address and print the label; get the third name and address and print the label..." But this quickly becomes ridiculous -- and might not work at all if you don't know in advance how many names there are. What you would like to say is something like "While there are more names to process, get the next name and address, and print the label." A loop can be used in a program to express such repetition.

Large programs are so complex that it would be almost impossible to write them if there were not some way to break them up into manageable "chunks." Subroutines provide one way to do this. A subroutine consists of the instructions for performing some task, grouped together as a unit and given a name. That name can then be used as a substitute for the whole set of instructions. For example, suppose that one of the tasks that your program needs to perform is to draw a house on the screen. You can take the necessary instructions, make them into a subroutine, and give that subroutine some appropriate name -- say, "drawHouse()". Then anyplace in your program where you need to draw a house, you can do so with the single command:
`drawHouse();`
This will have the same effect as repeating all the house-drawing instructions in each place.
The advantage here is not just that you save typing. Organizing your program into subroutines also helps you organize your thinking and your program design effort. While writing the house-drawing subroutine, you can concentrate on the problem of drawing a house without worrying for the moment about the rest of the program. And once the subroutine is written, you can forget about the details of drawing houses -- that problem is solved, since you have a subroutine to do it for you. A subroutine becomes just like a built-in part of the language which you can use without thinking about the details of what goes on "inside" the subroutine.

Variables, types, loops, branches, and subroutines are the basis of what might be called "traditional programming." However, as programs become larger, additional structure is needed to help deal with their complexity. One of the most effective tools that has been found is object-oriented programming, which is discussed in the next section.

## Factorial of Number - Java

import java.io.*;
class Factorial
{
public static void main(String [] args)
{
try
{
int num,i;
System.out.println("Enter the Number to Calculate the Factorial");
int factorial=1;
System.out.println("The FACTORIAL OF Number"+num+"is:");
for(i=1;i<=num;i++)
{
factorial=factorial*i;
}
System.out.println("The FACTORIAL is"+factorial);
}
catch(Exception e)
{
}
}
}

## Swapping Two Numbers in Java

class Swapper
{
int a=23, b=32, temp;
void before()
{
System.out.println("The values of a and b Before swapping are");
System.out.println("A="+a+"B="+b);
}

void swapping()
{
temp=a;
a=b;
b=temp;
}

void after()
{
System.out.println("The values of a and b After swapping are");
System.out.println("A="+a+"B="+b);
}
}

class Swapp
{
public static void main(String [] arg)
{
Swapper s1= new Swapper();
s1.before();
s1.swapping();
s1.after();
}
}

## Hello World - Your First Program (C# Programming Guide)

### To create and run a console application

1. Start Visual Studio.
2. On the File menu, point to New, and then click Project.
3. In the Templates Categories pane, expand Visual C#, and then click Windows.
4. In the Templates pane, click Console Application.
5. Type a name for your project in the Name field.
6. Click OK.
The new project appears in Solution Explorer.
7. If Program.cs is not open in the Code Editor, right-click Program.cs in Solution Explorer and then click View Code.
8. Replace the contents of Program.cs with the following code.
```// A Hello World! program in C#.
using System;
namespace HelloWorld
{
class Hello
{
static void Main()
{
Console.WriteLine("Hello World!");

// Keep the console window open in debug mode.
Console.WriteLine("Press any key to exit.");
}
}
}

```
9. Press F5 to run the project. A Command Prompt window appears that contains the line Hello World!

```// A Hello World! program in C#.

```
You can also comment out a block of text by enclosing it between the /* and */ characters. This is shown in the following example.
```/* A "Hello World!" program in C#.
This program displays the string "Hello World!" on the screen. */

```

## Variables in PHP - Create, Assign, Display

A variable is used in PHP scripts to represent a value. As the name variable suggests, the value of a variable can change (or vary) throughout the program. Variables are one of the features that distinguish a programming language like PHP from markup languages such as HTML.
Variables allow you write your code in a generic manner. To highlight this, consider a web form which asks users to input their name and favorite color.

Every time the form is completed, the data will be different. One user may say his name is John and his favorite color is blue. Another may say her name is Susan and her favorite color is yellow. We need a way of working with the values a user enters. The way to do this is by using variables.
There are a few standard variables that PHP creates automatically, but most of the time variables are created (or declared) by you, the programmer. By creating two variables called `\$name` and `\$color`, you could create generic code which can handle any input values. For John, this code:
 `1` `
 `2` `echo` `"Hello, \$name. Your favorite color is \$color."``;`
would display:
`Hello, John. Your favorite color is blue.`
On the other hand, Susan would see:
`Hello, Susan. Your favorite color is yellow.`
We will look into variable names and displaying the value of variables in the rest of this article, but the important point now is to understand how the use of generic variables can make processing data easy.

## Creating Variables

In PHP, simply writing the name of a variable for the first time in a script will create it. There’s nothing extra you need to do. The variable name has to follow some standard rules, though:
1. The name starts with a `\$` sign
2. The first character after the `\$` must be a letter or underscore
3. All subsequent characters can be a combination of letters, numbers and underscores
`\$customerName` is a valid variable name because it observes all three rules above.
`\$123customer` is not valid because it violates the second rule, the first character after the `\$` sign must be a letter or underscore.
It’s a good idea to give your variable a meaningful name. If the data you will be storing is a customer’s name, a sensible name might be `\$customerName`. You could also call it `\$abc123`, but I hope you agree that the former suggestion is better.
There are different conventions you can follow when writing variable names. Regardless of what you choose, it is important to be consistent and follow the convention throughout your script. For example, you can use an underscore to separate words (e.g. `\$customer_name`), or use capital letters to differentiate words, a style called Camel Case (e.g. `\$customerName`).
You are allowed to use both upper and lower case letters when naming a variable, but be aware that `\$CustomerName` is not the same as `\$customerName`. PHP will treat the two as different variables! This reinforces the need to stick to a naming convention.

## Assigning Variables

Now that you know you can have PHP create a new variable anytime you need it just by writing a new name, let’s look at another example to learn about assigning values to them.
 `1` `
 `2` `\$customerName` `= ``"Fred"``;`
 `3` `\$customerID``;`
 `4` `\$customerID` `= 346646;`
 `5` `\$customerName` `= ``\$customerID``;`
First, the variable `\$customerName` is given the value “Fred”. This is referred to as assigning a value. And because this is the first time `\$customerName` is used, the variable is created automatically. Anytime you write `\$customerName` after that, PHP will know to use the value “Fred” instead.
Then, `\$customerID` is written. A variable can be created without assigning a value to it, though this is generally not considered to be good practice. It is better to assign a default value just so you know it has a value. Remember, variables are variable, so you can always change the value later. Afterwards, the variable `\$customerID` is assigned the value 346646.
Finally, the value of `\$customerID` is assigned to `\$customerName`. You can assign the value of one variable to another; in this case the value of `\$customerID` (346646) overwrites the value in `\$customerName` (“Fred”) so that both variables now represent 346646!
Notice how the types of data referenced by a variable have different “types.” This property is called the data’s data type. “Fred” is given with quotation marks, so it is a string (string is just a fancy name for text). 346646 is obviously a number (more specifically, an integer).
Here are some examples of assigning values with different data types:
 `1` `
 `2` `\$total` `= 0;                              ``// Integer`
 `3` `\$total` `= ``"Year to Date"``;                 ``// String`
 `4` `\$total` `= true;                           ``// Boolean`
 `5` `\$total` `= 100.25;                         ``// Double`
 `6` `\$total` `= ``array``(250, 300, 325, 475);      ``// Array`
Now that you understand the basics of naming variables and assigning values, let’s look at this example and see if you can work out the answer:
 `1` `
 `2` `\$firstNumber` `= 4;`
 `3` `\$secondNumber` `= 6;`
 `4` `\$result` `= ``\$firstNumber` `+ ``\$secondNumber``;`
The examples in the previous section showed that values to the right of the `=` sign are assigned to the variable name on the left of the `=` sign, so the value 4 is assigned to `\$firstNumber`.
Have a close look at the last line. Though I haven’t explained it previously, the `+` sign is an operator, in this case performing addition. So what do you think the value will be in `\$result`?
If your answer is 10 then well done, that’s correct! If not, have a look at the example again and read the explanation carefully.

## Displaying the Value of Variables

As you saw at the beginning, you can display the value represented by a variable using `echo`. You can also use `print` if you’d like, as there is little difference between the two at this point besides less typing with `echo`.
 `1` `
 `2` `echo` `\$customerName``;`
Perhaps you would like to make the example more meaningful by adding some text in quotation marks before the variable contents:
 `1` `
 `2` `echo` `"Customer name = "` `. ``\$customerName``;`
The dot between the text in quotation marks and the variable name is the concatenation operator. It joins the string and the value of the variable together.
You could avoid using concatenation and make use of interpolation instead. Interpolation is when the variable name appears in a string and is replaced by its value instead. Taking advantage of this can sometimes make your code easier to read.
 `1` `
 `2` `echo` `"Customer name = \$customerName"``;`
PHP automatically performs interpolation on strings that are enclosed by double-quotation marks. If you wish to display the name of the variable with your text, you can use a backslash immediately before the variable name:
 `1` `
 `2` `echo` `"\\$customerName has the value: \$customerName"``;`
Alternatively, PHP will not perform interpolation on strings that are enclosed by single-quotation marks. So this is an equally effective statement:
 `1` `
 `2` `echo` `'\$customerName has the value: '` `. ``\$customerName``;`
For more information about variables, check out the PHP documentation. You’ll review everything you’ve learned here, and learn about what special variables PHP will automatically define and make available to your scripts, how a variable is bound to the context in which it was declared, and even how variables can be used as the names for other variables!

## What is Java Virtual Machine (JVM)

--------------Note on JavaVirtual Machine--------------
• The Java Language runs on a “Java Virtual Machine”
– Java Virtual machine abstracts away the details of theunderlying platform and provides a uniform environment for executing Java“byte-code”
• The Java compiler (javac) compiles Java code intobyte-code
– Bytecode is an intermediate form which can run on theJVM
– JVM does the translation from byte-code to machine-codein a platform dependent way.

## Explain Difference between Java and C++

C++

Java
C++ is a complex language

Java is Simple Language
C++ has signed and unsigned data types

By default, all data types in java are signed( Exception char)
Characters in C++ are 8 bit and 16 bit chars are represented by wide character types

By default all the characters 16 bit and supports Unicode
C++ supports pointers and pointer arithmetic

No low-level pointers or pointer arithmetic.
Instead have variables and expressions of reference type.
Objects needs to be deallocated explicitly using destructors

Objects are Garbage collected automatically
Variables can be used before its initialization

No Variable can be used before its initialization
Array bounds are not checked by default

Strict array bounds checking
No built in support for multithreading.

Struct,union , typedef available

No struct, union, typedef—classes and objects are used uniformly instead.
C++ platform dependent

Java is platform independent and machine independent
C++ is less Secure

Java is more Secure

## Explain Features of Java - Introduction

1) Simple
• Similar to C/C++ in syntax
• But eliminates several complexities of
– No direct pointer manipulation or pointer arithmetic
– No multiple inheritance
– No malloc() and free() – handles memory automatically
– Garbage Collector
• Lots more things which make Java more attractive.
2) Object-Oriented
• Fundamentally based on OOP
– Classes and Objects
– Uses a formal OOP type system
– Lends an inherent structure/organization for how wewrite Java programs
• Unlike spaghetti code in languages like Perl
– Efficient re-use of packages such that the programmeronly cares about the interface and not the implementation
3) Distributed / Network Oriented
• Java grew up in the days of the Internet
– Inherently network friendly
– Original release of Java came with Networking libraries
– Newer releases contain even more for handlingdistributed applications
• RMI, Transactions
4) Robust / Secure / Safe
• Designed with the intention of being secure
– No pointer arithmetic or memory management!
– The JVM “verifier”
• Checks integrity of byte-codes
– Dynamic runtime checking for pointer and array access
• No buffer overflow bugs!
– SecurityManager to check which operations a piece ofcode is allowed to do
– “Sandbox” operation for applets and other untrustedcode
• Limited set of operations or resources made available
• Contrast to ActiveX
5) Portable
• “Write-Once Run-Anywhere”
• The Java Virtual Machine becomes the common denominator
– Bytecodes are common across all platforms
– JVM hides the complexity of working on a particularplatform
• Difficult to implement a JVM
• But simpler for the application developer
• Java does this well
6) High-Performance
• Java performance IS slower than C
• Tradeoff between development time vs. run time
• Additional checks in Java which make is secure androbust and network aware etc, all have a small cost.
• BUT
– JIT compilation and HotSpot
• Dynamic compilation of bytecode to native code atruntime to improve performance
– HotSpot optimizes code on the fly based on dynamicexecution patterns
• Can sometimes be even faster than compiled C code!
– We will cover this in a lot of detail
• Basic concept
– The ability to have multiple flows of control/programswhich appear to run at the same time
• Processes - application level
• Threads – within the application
– JVM uses native threads on operating system butprovides a consistent abstraction for the developer.
8) Dynamic
• Java is “self-aware”
– Java code can look at itself and tell what interfaces itexports (Introspection)
– Can dynamically load new classes/code at runtime
9) Java Programmer Efficiency
• Faster Development
– More programmer friendly
– Less error prone
• OOP
– Easier to manage large development projects
• Robust memory system
– No pointer arithmetic and manual memory management.Garbage collector!
• Libraries
– Re-use of code

## JAVA Tutorial 1- Introduction to Java

Java was developed by James Gosling at Sun Microsystems in 1991.
His Original Aim was to develop a low cost, Hardware Independent Language based on C++.
Due to technical reasons that idea was dropped.
A new programming Language called Oak was developed based on C++.
The language oak was developed by removing undesirable features of C++.
Those features include:
Multiple Inheritance
Automatic type conversions
Use of pointers
Memory Management.
By 1994 the World Wide Web Emerged and Oak was Re-named as Java.

## PL/SQL to Create or Replace Triggers, Varray and nested tables

Question: 1)
Create orreplace trigger trig_msg after update ordelete or insert on customer for each row
Code:
declare
oper varchar2(10);
begin
if updating then
DBMS_OUTPUT.PUT_LINE('UPDATING');
end if;
if deleting then
DBMS_OUTPUT.PUT_LINE('DELETING');
end if;
if inserting then
DBMS_OUTPUT.PUT_LINE('INSERTING');
end if;
end;
SQL> set serveroutput on;
SQL> insert into customer values(1,'vish','delhi',500,'21-jan-2001');
INSERTING
1 row created.
SQL> delete from customer where loanno = 1;
DELETING
1 row deleted.
Question 2)
create or replace trigger trig_nodml after update orinsert or delete on loan for each row
Code:
declare
m varchar2(15);
begin
if updating then
RAISE_APPLICATION_ERROR(-20000,'NO UPDATE ALLOWED');
end if;
if deleting then
RAISE_APPLICATION_ERROR(-20000,'NO DELETING ALLOWED');
end if;
if inserting then
m:=TO_CHAR(sysdate,'DAY');
if (upper(m)<> upper('sunday')) then
RAISE_APPLICATION_ERROR(-20000,'NOT ALLOWED ON WEEKDAY');
end if;
end if;
end;
SQL> insert into loan values(1,'vishal','delhi',2000);
insert into loan values(1,'vishal','delhi',2000)
*
ERROR at line 1:
ORA-20000: NOT ALLOWED ON WEEKDAY
ORA-06512: at "SCOTT.TRIG_NODML", line 13
ORA-04088: error during execution of trigger 'SCOTT.TRIG_NODML'
5)Varray and nested tables
i)
declare
typevmarktype is varray(10) of integer ;
c int;
xvmarktype;
begin
x:=vmarktype(12,45,78,45,77);
c:=x.count;
for iin 1..c loop
dbms_output.put_line(x(i));
endloop;
end;
SQL> @c:\varray.sql
12 /
12
45
78
45
77
PL/SQL procedure successfully completed.

## Advanced Database Techniques Practical - Experiment No.1

PRACTICAL NO. 1

Create tables as per following definitions.

Deposit3 :
Actno
Cname
Brname
Amount
Date

SQL> create table deposit3
(actno number(5),cname varchar(20),brname varchar2(20),amount number(10,2),dt date);

Table created.

Branch3 :
Brid
Brname
City
Ins_date
Update_date

SQL> create table branch3
(brid varchar2(20), brname varchar2(20),city varchar2(20),insdate date,update_date date);

Table created.

Customer3 :
Custid
Cname
City
ins_date
update_date

SQL> create table customer3
(custid varchar2(20), cname varchar2(20),city varchar2(20),insdate date,update_date date);

Table created.

Borrow3 :
loanno
custname
brname
amount
ins_date

SQL> create table borrow3
(loanno number(10), custname varchar2(20),brname varchar2(20),amount number(10,2),insdate date);

Table created.

Describe all tables.

SQL> desc deposit3

Name        Null?        Type
-------------------------------------------------------------------
ACTNO             NUMBER(5)
CNAME              VARCHAR2(20)
BRNAME             VARCHAR2(20)
AMOUNT            NUMBER(10,2)
DT                DATE

SQL> desc branch3

Name            Null?        Type
-------------------------------------------------------------------
BRID                 VARCHAR2(20)
BRNAME            VARCHAR2(20)
CITY                VARCHAR2(20)
INSDATE            DATE
UPDATE_DATE        DATE

SQL> desc customer3;

Name             Null?         Type
------------------------------------------------------------------
CUSTID             VARCHAR2(20)
CNAME            VARCHAR2(20)
CITY                 VARCHAR2(20)
INSDATE             DATE
UPDATE_DATE         DATE

SQL> desc borrow3;

Name            Null?        Type
-------------------------------------------------------------------------------
LOANNO                NUMBER(10)
CUSTNAME                VARCHAR2(20)
BRNAME                VARCHAR2(20)
AMOUNT                 NUMBER(10,2)
INSDATE                DATE

List all data from all four tables.

SQL> select * from deposit3;

ACTNO     CNAME    BRNAME    AMOUNT                       DT
------------------------------------------------------------------------------------------------------------
100        Anil        VRCE        1000         01-MAR-95
101        Sunil        AJNI         5000         04-JAN-96
102      Mehul        Karolbagh    3500         17-APR-95
105        Sandip        Andheri    2000         27-MAR-96
106         Shivani        Virar        1000         31-MAR-96
107     Kranti          Nehru Plane    5000         05-SEP-95
108     Naren        Powai        7000         10-AUG-05

9 rows selected.

SQL> select * from branch3;

BRID     BRNAME     CITY         INSDATE       UPDATE_DA
---------------------------------------------------------------------------------------------------
A101    VRCE        Nagpur         22-JAN-12     24-JAN-12
A102    AJNI         Nagpur        22-JAN-12     24-JAN-12
A103     Karolbagh       Delhi         22-JAN-12     24-JAN-12
A104     Chandani       Delhi          22-JAN-12     24-JAN-12
A105     Dharampeth     Nagpur      22-JAN-12     24-JAN-12
A106      MG Road          Bangalore     22-JAN-12     24-JAN-12
A107      Andheri    Mumbai      22-JAN-12     24-JAN-12
A108     Virar            Mumbai    22-JAN-12     24-JAN-12
A109    Nehruplane         Delhi           22-JAN-12     24-JAN-12
A110       Powai             Mumbai     22-JAN-12     24-JAN-12

10 rows selected.

SQL> select * from customer3;

CUSTID    CNAME    CITY         INSDATE    UPDATE_DA
-------------------------------------------------------------------------------------------------------------
C201        Anil            Calcutta     14-JAN-12
C202         Sunil            Delhi         14-JAN-12
C203           Mehul        Baroda       14-JAN-12      24-JAN-12
C204         Mandar      Patna          14-JAN-12
C206            Pramod        Nagpur                14-JAN-12
C207            Sandip        Surat            14-JAN-12     24-JAN-12
C208           Shivani       Mumbai       14-JAN-12
C209          Kranti         Mumbai      14-JAN-12
C210          Naren          Mumbai       14-JAN-12      24-JAN-12

10 rows selected.

SQL> select * from borrow3;

LOANNO     CUSTNAME    BRNAME    AMOUNT     INSDATE
--------------------------------------------------------------------------------------------------------
201          Anil                     VRCE        1000         24-JAN-12
206         Mehul               AJNI            5000         24-JAN-12
311          Sunil                    Dharampeth      3000         24-JAN-12
375          Pramod             Virar             8000         24-JAN-12
481          Kranti                  Nehruplane       3000         24-JAN-12

Give names of depositors having amount greater than 4000.

SQL> select cname  from deposit3  where amount>4000;

CNAME
--------------------
Sunil
Kranti
Naren

Give names of customers living in the city ="Nagpur"

SQL>select cname  from customer3  where city = 'Nagpur';

CNAME
--------------------
Pramod

Give names of customer who opened account after date '1-12-1995 '

SQL>select cname  from deposit3  where dt>'1-dec-95';

CNAME
--------------------
Sunil
Pramod
Sandip
Shivani
Naren

6 rows selected.

Give amount no & deposite amount of customer having account opened between dates '1-06-1995 ' and '1-12-1995 '

SQL>select actno,cname,amount  from deposit3
where dt Between '1-jun-95' and '1-dec-95';

ACTNO     CNAME    AMOUNT
---------------------------------------------------
107       Kranti          5000

Give details of loan whose custname starts with 'N' or having 'a' in between words

SQL> select * from borrow3 where custname like 'N%' or custname like '%a%' ;

LOANNO     CUSTNAME    BRNAME    AMOUNT     INSDATE
----------------------------------------------------------------------------------------------------------
375         Pramod              Virar           8000         24-JAN-12
481        Kranti           Nehruplane        3000         24-JAN-12

Use Joins.

Give name of customers from depositor having city like 'Mumbai' and branch city 'Delhi '

SQL> select d.cname from deposit3 d, branch3 b, customer3 c
where d.bname=b.brname
and b.city='DELHI'
and d.cname=c.cname
and c.city='MUMBAI';

CNAME
--------------------
KRANTI

Give name of customers who are borrowers as well as depositors and having living city like 'Nagpur '

SQL> select d.cname
from deposit3 d, borrow3 b, customer3 c
where d.cname=b.custname
and d.cname=c.cname
and c.city='NAGPUR';

CNAME
--------------------
PRAMOD

Give depositor details and loan details of the customer in the city where 'Pramod' is living.

SQL>select d.*, b.* from customer3 c,deposit3 d,borrow3 b
where c.cname=d.cname and c.cname=b.custname
and city=(select city from customer3 where cname='Pramod');

ACTNO CNAME  BRNAME   AMT        DT       LOANNO  CUSTNAME  BRNAME   AMT    INSDATE
------------------------------------------------------------------------------------------------------------------------------------

104     Pramod       MCAD       3000    23-MAR-96    375    Pramod        Virar      8000    24-JAN-12

Give names of depositor having the same branch city as that of 'Sunil' and having same living city as that of 'Anil'

SQL> select d.cname
from deposit3 d, customer3 c, branch3 br
where br.city in (select br.city from branch3 where d.cname='SUNIL')
and c.city in   (select c.city from customer3 where c.cname='ANIL')
and d.cname=c.cname   and d.bname=br.brname;

no rows selected

Give branch city of 'Sunil' or branch city of 'Anil'

SQL> select distinct b.city from deposit3 d, branch3 b
where d.bname=b.brname
and b.city in
(select b.city from branch3 where d.cname='SUNIL' or d.cname='ANIL');

CITY
--------------------
NAGPUR

Set operators(minus, Union, Intersect, In, Any, All).

List all the customers who are depositors but not borrowers

SQL> select cname from deposit3
minus
(select cname from borrow3);
CNAME
--------------
Naren
Sandeep
Shivani

List all the customers who are both depositors and borrowers

SQL> select distinct cname from deposit3
intersect
select custname from borrow3;

CNAME
--------------------
ANIL
KRANTI
MEHUL
PRAMOD
SUNIL

6 rows selected.

List the branch cities of 'Anil' and 'Sunil'

SQL> select b.city from branch3 b, deposit3 d
where b.brname=d.bname and d.cname='ANIL'
union
select b.city from branch3 b, deposit3 d
where b.brname=d.bname and d.cname='SUNIL';

CITY
--------------------
NAGPUR

List all the depositors living in the city Nagpur and having branches in city 'Delhi'

SQL>  select  d.cname from deposit3 d, customer3 c
where d.cname=c.cname   and c.city='NAGPUR'
intersect
select d.cname from deposit3 d,branch3 b
where d.bname=b.brname  and b.city='DELHI';

CNAME
--------------------

List the cities which are either branch city of 'Anil' or living city of 'Sunil'

SQL>select b.city from branch3 b, deposit3 d
where b.brname=d.bname and d.cname='ANIL'
union
select city from customer3 where cname='SUNIL’;

CITY
--------------------
DELHI
NAGPUR

List the customers who are both borrowers and depositors and having same branch city as 'Anil'

SQL>select custname from borrow3
intersect
select d.cname from deposit3 d,branch3 b
where d.bname=b.brname  and b.city in  (select city from branch3, deposit3
where branch3.brname=deposit3.bname and deposit3.cname='ANIL');

CUSTNAME
--------------------
ANIL
SUNIL

Aggregate Functions.
List total deposit, max deposit of customers living in city 'Nagpur'.

SQL> select sum(amount), max(amount)
from deposit3,customer3
where customer3.city='Nagpur’;

MAX(AMOUNT)          SUM(AMOUNT)
---------------------------------------------------------

7000               57400

Give branchwise loan of customers living in 'Nagpur'.

SQL> select borrow3.brname, sum(amount)
from borrow3, branch3
where branch3.city='nagpur' and borrow3.brname=branch3.brname
group by(borrow3.brname);

BRNAME               SUM(AMOUNT)
----------------------------------------------
AJNI                            5000
DHARAMPETH            3000
VRCE                            1000

Give no of customers who are depositors as well as borrowers.

SQL> select count(cname) from deposit3, borrow3
where deposit3.cname=borrow3.custname;

COUNT(CNAME)
------------------------
6

List the name of branch having highest no of depositers (use group by, having, ALL)

SQL> select deposit3.brname from deposit3
group by deposit3.brname
having count(deposit3.cname)>=all(select count(deposit3.cname) from deposit3
group by deposit3.brname);

BRNAME
--------------------
AJNI
Andheri
Chandni
Karoubangh
Nehru place
Powai
VRCE
Virar

9 rows selected

Give names of cust in ‘Powai’ branch having more deposit than any other customer in ‘VRCE’ branch. (use group by, having, Any)

SQL> select c1.cname,d1.amount
from customer3 c1,deposit3  d1,branch3 b1
where b1.brname='Powai' and b1.brname=d1.brname and d1.cname=c1.cname
and d1.amount > (select max(amount)
from deposit3
where brname='VRCE');

CNAME                    AMOUNT
----------------------------------------
Naren                      7000

Give names of branches having the number of depositers more than the number of borrowers.

SQL> select d1.brname
from deposit3 d1
group by d1.brname
having count(d1.cname) > all (select count(b1.cname)
from borrow3  b1
where b1.brname=d1.brname
group by b1.brname);

BRNAME
--------------------
Andheri
Chandni
Karoubangh
Nehru place
Powai
Virar

7 rows selected.

Give names of customers living in the city where max number of depositors are located.

SQL>select cname from customer3
where city = (select c.city from deposit3 d,customer3 c
where upper(c.cname) = upper(d.cname)
group by c.city having count(c.city) >= ALL (select count(d.cname)
from deposit3 d,customer3 c
where upper(c.cname) = upper(d.cname)
group  by (c.city)));

CNAME
----------------
Shivani
Kranti
Naren

## IMPORTANT ANNOUNCEMENT FOR IBPS SPECIALIST OFFICERS EXAM ON 11.03.2012

The Common Written Examination for recruitment of Specialist Officers in 19 Public Sector
Banks will be held on 11.03.2012.
The examination will be held in one or two sessions at different centres.
No correspondence regarding change of centre of examination/ time  of examination/ post will be entertained.
Examination at least 30 minutes prior to the time printed in the call letter (i.e. 8.30 a.m./ 1.00
p.m.). Candidates who report late will not be permitted to take the examination.
The “Acquaint Yourself Booklet” has also been made available on the IBPS website. You may
Please note that candidates will NOT BE PERMITTED to appear for the  Common Written Examination without the following documents:
(1) Call Letter for the relevant session of examination with photograph  affixed thereon
(2) Original fee payment receipt (CBS challan/ e-receipt)
(3) Original photo-identity proof such as  PAN Card/ Passport/ Driver’s  Licence/ Voter’s Card/ Bank Passbook with photograph/ Photo identity proof Issued by a Gazzetted Officer/ People’s Representative along with a  photograph / Identity Card issued by a recognised college/ university/ Aadhar  card with a photograph/ Employee ID
(4) Photocopy of photo-identity proof (as specified above)

## Maharashtra Common Entrance test (MAH CET) exam, the biggest state level MBA entrance exam for pursuing MBA in Maharashtra date has been postponed.

Maharashtra Common Entrance test (MAH CET) exam, the biggest state level MBA entrance exam for pursuing MBA in Maharashtra date has been postponed. Directorate of Technical Education (DTE), the body that conducts the exam, mentions in its website, “The CET is rescheduled on 11 March 2012 instead of 26 February 2012. “

On November 1, 2011, DTE had announced that the date of MAH CET for the programs MBA, MMS, PGDBM and PGDM courses would be held on Sunday, February 26, 2012. However, in a recent update, it has been confirmed by DTE that the date for MAH CET 2012 has been postponed to Sunday, March 11, 2012. DTE also states that the Information brochure of the exam will be published soon.

The reason for this postponement is possibly due to the dates of the AICTE CMAT exam. The CMAT exam, which is scheduled from February 20 to February 28, 2012, is clashing with the date of the MAH CET 2012 exam which was earlier scheduled for February 26, 2012.

MAH CET 2011 was held on Sunday, February 27, 2011. MAH CET is a paper pencil based test. The total number questions in the exam are 200. There are six sections in the exam which are Quantitative Aptitude, Data Interpretation, Data Sufficiency, Logical Reasoning, Visual Reasoning, Verbal Ability and Verbal Reasoning and Reading Comprehension.

The scores of the exam are accepted by top B-schools in Maharashtra such as JBIMS Mumbai, K J Somaiya Institute of Management Studies & Research, Sydenham Institute of Management Studies, Research and Entrepreneurship Education (SIMSREE) and other institutes under Mumbai University.

Stay tuned to MBAUniverse.com for more updates on MAH CET 2012 exam.