Categories
Uncategorised

DPS VK SQL Assignment Solutions

I’ll make this quick, because I’ve some work to do right now. These are the solutions to the SQL assignment given for class 12 at DPS VK, along with the questions. You can download the SQL assignment archive by clicking here. You’ll find the PDFs which have the info, and just in case you want to format something, I’ve included the master document too, in OpenDocument Text format; which you can open by using OpenOffice 2.2 (it’s a free download) or by uploading it to an online service like Google Docs.

Note that I haven’t tested the thing on a database to ensure these are correct, but I think they are. In case you detect any error, please do notify me (the email address is at the bottom of this page). Do note that in questions related to date related queries, the way the date is entered will depend upon your software’s implementation of SQL. Also, in one assignment the question requires the use of ALTER TABLE command – it’s not supported in ANSI, so if your software strictly follows that it might not work.

Categories
Uncategorised

Constructors – Fibonacci Series

/* Copyright © 2007 Ankur Banerjee. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License version 2.1 as published by the Free Software Foundation. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. http://www.fsf.org/licensing/licenses/lgpl.html /

/ Constructors – Fibonacci Series /

#include <iostream.h>
#include <conio.h>

class fib
{
int f, s, n;
public:
fib()
{
f = 0;
s = 1;
n = 10;
}
fib(int first, int second, int number)
{
f = first;
s = second;
n = number;
}
void gen_fib();
} ;

void fib::gen_fib()
{
int t;
cout<<endl<<“Generating required Fibonacci series \n \n”
<<f<<” “<<s<<” “;
for(int i = 0; i < (n – 2); i++)
{
t = f + s;
cout<<t<<” “;
f = s;
s = t;
}
}

void main()
{
clrscr();
int ch, ft, sc, num;
cout<<endl<<“Program Menu”<<endl
<<“1. Generate default Fibonacci series”<<endl
<<“2. Generate custom Fibonacci series”<<endl
<<“Enter your choice : “;
cin>>ch;
switch(ch)
{
case 1 : fib f1;
f1.gen_fib();
break;
case 2 : cout<<“\nEnter first term of Fibonacci series : “;
cin>>ft;
cout<<“Enter second term of Fibonacci series : “;
cin>>sc;
cout<<“Enter number of terms : “;
cin>>num;
fib f2(ft, sc, num);
f2.gen_fib();
break;
default : cout<<endl<<“You entered an incorrect choice”;
}
getch();
}

/ Output */

Program Menu
1. Generate default Fibonacci series
2. Generate custom Fibonacci series
Enter your choice : 1

Generating required Fibonacci series

0 1 1 2 3 5 8 13 21 34

Program Menu
1. Generate default Fibonacci series
2. Generate custom Fibonacci series
Enter your choice : 2

Enter first term of Fibonacci series : 0
Enter second term of Fibonacci series : 1
Enter number of terms : 21

Generating required Fibonacci series

0 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 4181 6765