Tuesday, 29 March 2011

claculator on Java with "back space" and "calculation display"

/*
    Title: Calculator App
    Created: August 7, 2008
    Author: Blmaster
    Comments:
        Wanted to see if I could make it.
        Last Edited: August 20, 2008
    Changes:
        See Bottom of Code ||
        *******************\/
*/
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

public class Calculator implements ActionListener, ItemListener, KeyListener        {
    private final String VERSION = "4.0";
//Initializes window, buttons, panels, textfield and other variables
    JFrame window = new JFrame("Calculator " + VERSION);
    JMenuBar Menu = new JMenuBar();
    JMenu mnuProgram, mnuView, mnuHelp;
    JMenuItem mnuReset, mnuExit, mnuAbout;
    JCheckBoxMenuItem mnuShowCalc;
    JPanel pnlBottom, pnlBackspace, pnlClear, pnlButtons, pnlCalculation;
    JLabel lblFirst, lblOperator, lblSecond, lblEqual, lblResult;
    JTextField txtDisplay;
    JButton buttons[] = new JButton[23];
   
    final short MAX_INPUT = 30;
    final float DIVIDE_ZERO_ERROR = (float)-.04060802;
    final float ERROR = (float)-.04060801;
    String tempNum;
    String sign;
    String Label;
    String R;
    String tempString;
    double number1, number2, result;
    boolean decimalUsed, secondNum, makeSecondTrue, lblSecondNum, secondEqual, error;
//constructor for Calculator class
    Calculator() {
        //Window Properties
        window.setSize(306, 210);
        window.setLocation(470, 290);
        window.setLayout(new BorderLayout());
        window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        window.setResizable(false);
       
//Making the Menu and Menu Items and adding action listener/item listener
        mnuProgram = new JMenu("Program");
        mnuView = new JMenu("View");
        mnuHelp = new JMenu("Help");
        Menu.add(mnuProgram);        
        Menu.add(mnuView);
        Menu.add(mnuHelp);
        mnuReset = new JMenuItem("Reset");
        mnuExit = new JMenuItem("Exit");
        mnuShowCalc = new JCheckBoxMenuItem("Show Calculations");
        mnuAbout = new JMenuItem("About Calculator");
        mnuProgram.add(mnuReset);
        mnuProgram.add(mnuExit);
        mnuView.add(mnuShowCalc);
        mnuHelp.add(mnuAbout);
        mnuReset.addActionListener(this);
        mnuExit.addActionListener(this);
        mnuShowCalc.addItemListener(this);
        mnuAbout.addActionListener(this);
       
        //Making Panels
/*        pnlButtons holds all the Buttons Except for Backspace, CE, and C buttons
        pnlClear holds CE and C Buttons
        pnlBackspace holds the Backspace Button
        pnlBottom holds all the other Panels so I can put them all at the bottom of the window
        pnlCalculations holds all the Labels for the Show Calcualtions function            */
        pnlBottom = new JPanel();
        pnlBackspace = new JPanel();
        pnlClear = new JPanel();
        pnlButtons = new JPanel();
        pnlCalculation = new JPanel();
       
        //Setting Layouts for the Panels and other Properties
        pnlBottom.setLayout(new BorderLayout());
        pnlButtons.setLayout(new GridLayout(4, 5, 2, 2));
        pnlClear.setLayout(new GridLayout(1, 2, 2, 2));
        pnlBackspace.setLayout(new GridLayout(1, 2, 2, 2));
        pnlCalculation.setLayout(new FlowLayout(FlowLayout.CENTER));
        pnlBottom.setBackground(new Color(200, 200, 200));
       
        //Making Labels and adding them to pnlCalculation Panel.
        lblFirst = new JLabel();
        lblOperator = new JLabel();
        lblSecond = new JLabel();
        lblEqual = new JLabel();
        lblResult = new JLabel();
        pnlCalculation.add(lblFirst);
        pnlCalculation.add(lblOperator);
        pnlCalculation.add(lblSecond);
        pnlCalculation.add(lblEqual);
        pnlCalculation.add(lblResult);
       
        //Text Field Properties
        txtDisplay = new JTextField("0");
        txtDisplay.setEditable(false);
        txtDisplay.setHorizontalAlignment(JTextField.TRAILING);
        txtDisplay.setBackground(Color.WHITE);
        txtDisplay.setOpaque(true);
        txtDisplay.addKeyListener(this);
       
        //Making Buttons and adding to Panel Buttons
        buttons[0] = new JButton("0");
        buttons[10] = new JButton(".");
        buttons[11] = new JButton("=");
        buttons[12] = new JButton("/");
        buttons[13] = new JButton("*");
        buttons[14] = new JButton("-");
        buttons[15] = new JButton("+");
        buttons[16] = new JButton("sqrt");
        buttons[17] = new JButton("%");
        buttons[18] = new JButton("1/x");
        buttons[19] = new JButton("+/-");
        for(int i=7; i<10; i++)    {
            buttons[i] = new JButton(String.valueOf(i));
            pnlButtons.add(buttons[i]);
        }
        pnlButtons.add(buttons[12]);
        pnlButtons.add(buttons[16]);
        for(int i=4; i<7; i++)    {
            buttons[i] = new JButton(String.valueOf(i));
            pnlButtons.add(buttons[i]);
        }
        pnlButtons.add(buttons[13]);
        pnlButtons.add(buttons[17]);
        for(int i=1; i<4; i++)    {
            buttons[i] = new JButton(String.valueOf(i));
            pnlButtons.add(buttons[i]);
        }
        pnlButtons.add(buttons[14]);
        pnlButtons.add(buttons[18]);
        pnlButtons.add(buttons[0]);
        pnlButtons.add(buttons[10]);
        pnlButtons.add(buttons[11]);
        pnlButtons.add(buttons[15]);
        pnlButtons.add(buttons[19]);
       
        //Creating Backspace Button and adding it to Backspace panel
        buttons[20] = new JButton("BackSpace");
        pnlBackspace.add(buttons[20]);
       
        //Creating Clear Buttons and adding it to Clear panel
        buttons[21] = new JButton("CE");
        buttons[22] = new JButton(" C ");
        pnlClear.add(buttons[21]);
        pnlClear.add(buttons[22]);
       
      /*Adds Action Listener to every button
        and adds color to all the numbered buttons
        plus the decimal and all the other buttons
        to red                                                */
        for(int i=0; i<buttons.length; i++)    {
            buttons[i].addActionListener(this);
            if(i<11 || (i>15 && i<20))
                buttons[i].setForeground(Color.blue);
            else
                buttons[i].setForeground(Color.red);
        }
       
        //Adds Panels to window and shows window
        pnlBottom.add(txtDisplay, BorderLayout.NORTH);
        pnlBottom.add(pnlBackspace, BorderLayout.WEST);
        pnlBottom.add(pnlClear, BorderLayout.EAST);
        pnlBottom.add(pnlButtons, BorderLayout.SOUTH);
        window.add(Menu, BorderLayout.NORTH);
        window.add(pnlCalculation);
        window.add(pnlBottom, BorderLayout.SOUTH);
        window.setVisible(true);
        pnlCalculation.setVisible(false);
       
        //Clears the screen. sets Variables to default.
        Clear();
    }
   
    public void actionPerformed(ActionEvent click)    {
        //    Adding Digits to Screen
        for(int i=0; i<10; i++)    {
            if(click.getSource() == buttons[i])
                addDigit(String.valueOf(i));
        }
        //    Adding Decimal Point to Screen
        if(click.getSource() == buttons[10])    {
            if(!decimalUsed)    {
                addDigit(".");
                decimalUsed = true;
            }
        }
        for(int i=11; i<buttons.length; i++)    {
            if(click.getSource() == buttons[i])    {
                switch(i)    {
                    case 11:
                        Calculate("=");// EQUAL
                        break;
                    case 12:
                        Calculate("/");//    DIVDIE
                        break;
                    case 13:
                        Calculate("*");//    MULTIPLY
                        break;
                    case 14:
                        Calculate("-");//    SUBTRACT
                        break;
                    case 15:
                        Calculate("+");//    ADD
                        break;
                    case 16://    SQUARE ROOT
                        sqrt();
                        break;
                    case 17://    %
                        percent();
                        break;
                    case 18://    1/x
                        divideByX();
                        break;
                    case 19://    +/-
                        signChange();
                        break;
                    case 20://    BACKSPACE
                        Backspace();
                        break;
                    case 21://    CE
                        ClearExisting();
                        break;
                    case 22://    C
                        Clear();
                        break;
                }
            }
        }
        if(!(buttons[11] == click.getSource()))
            secondEqual = false;
        // Program -> Reset
        if(click.getSource() == mnuReset)    {
            Clear();
            window.setSize(306, 210);
            pnlCalculation.setVisible(false);
            mnuShowCalc.setState(false);
            JOptionPane.showMessageDialog(null, "Reset!\nEverthing is back to default."
            , "Reset", JOptionPane.INFORMATION_MESSAGE);
        }
        // Program -> Exit
        if(click.getSource() == mnuExit)    {
            System.exit(0);
        }
        // Help -> About
        if(click.getSource() == mnuAbout)    {
            showAboutDialog();
        }
        txtDisplay.requestFocus();
    }


/*    If the Menu Checkbox is clicked it will make the pnlCalculation visible and the window
    bigger so the user can see it too. if it is unseleceted it will go back to normal            */
    public void itemStateChanged(ItemEvent click)    {
        if(click.getSource() == mnuShowCalc)    {
            if(click.getStateChange() == ItemEvent.SELECTED)    {
                window.setSize(306, 235);
                pnlCalculation.setVisible(true);
            }    else {
                window.setSize(306, 210);
                pnlCalculation.setVisible(false);
            }
        }
    }
   
    public void keyPressed(KeyEvent e)    {
        int key = e.getKeyChar();
        if(!(key == KeyEvent.VK_ENTER))
            secondEqual = false;
        switch(key)    {
            case KeyEvent.VK_0:
                addDigit("0");
                break;
            case KeyEvent.VK_1:
                addDigit("1");
                break;
            case KeyEvent.VK_2:
                addDigit("2");
                break;
            case KeyEvent.VK_3:
                addDigit("3");
                break;
            case KeyEvent.VK_4:
                addDigit("4");
                break;
            case KeyEvent.VK_5:
                addDigit("5");
                break;
            case KeyEvent.VK_6:
                addDigit("6");
                break;
            case KeyEvent.VK_7:
                addDigit("7");
                break;
            case KeyEvent.VK_8:
                addDigit("8");
                break;
            case KeyEvent.VK_9:
                addDigit("9");
                break;
            case KeyEvent.VK_PERIOD:
                if(!decimalUsed)    {
                    addDigit(".");
                    decimalUsed = true;
                }
                break;
            case KeyEvent.VK_ENTER:
                Calculate("=");
                break;
            case KeyEvent.VK_SLASH:
                Calculate("/");
                break;
            case 42:
                Calculate("*");
                break;
            case KeyEvent.VK_MINUS:
                Calculate("-");
                break;
            case 43:
                Calculate("+");
                break;
            case KeyEvent.VK_BACK_SPACE:
                Backspace();
                break;
            case KeyEvent.VK_ESCAPE:
                Clear();
                break;
            case KeyEvent.VK_DELETE:
                ClearExisting();
                break;
        }
    }
    public void keyTyped(KeyEvent e)    {}
    public void keyReleased(KeyEvent e)    {}
   
   




   
/*********************************************************************************************************************************   
    NON-LISTENER METHODS
/*********************************************************************************************************************************/
   
   
/*    adds Digit to screen
    But if TempNum is empty and the button we click is 0 then just set the display box to 0    */
    public void addDigit(String digit)    {
        if(!error)    {
            if(tempNum.equals("") && digit.equals("0"))    {
                txtDisplay.setText("0");
                    tempNum = "";
                if(lblSecondNum)
                    lblSecond.setText("0");
                else    {
                    lblFirst.setText("0");
                    lblSecond.setText("_");
                    lblResult.setText("_");
                }
            }    else if(tempNum.length() < MAX_INPUT)    {
                tempNum += digit;
                if(tempNum.charAt(0) == '.')
                    tempNum = "0" + tempNum;
                txtDisplay.setText(tempNum);
                if(makeSecondTrue)
                    secondNum = true;
                checkLabels();
            }
            secondEqual = false;
        }
    }
   
/*    Calculates if /, *, -, +, or = sign is pressed
    Second and makeSecondTrue are here because
    Second should only be true if a digit is pressed after the First Part    */
    public void Calculate(String operator)    {
        if(!error)    {
            decimalUsed = false;
            if(operator.equals("="))    {
                if(secondEqual)    {    ///////////
                    number1 = result;                //
                    result = Process();            //Equal Sign Pressed Twice or more
                    Display(result);                //
                }    else    {                ///////////            ////////////////////
                    number2 = Double.parseDouble(txtDisplay.getText());    //
                    setSecondLabel();                                                    //
                    result = Process();                                                //Equal Sign Pressed Once
                    Display(result);                                                    //
                    number1 = result;                                                    //
                    secondEqual = true;                                                //
                }                                                    ////////////////////
                secondNum = false;
                makeSecondTrue = false;
                lblSecondNum = false;
            }    else {
                if(secondNum)    {    /////////////////
                    number2 = Double.parseDouble(txtDisplay.getText());
                    setSecondLabel();                    //
                    result = Process();                //
                    Display(result);                    //Second Part
                    number1 = result;                    //
                    lblSecond.setText("_");            //
                    lblResult.setText("_");            //
                    lblOperator.setText("?");        //
                    setFirstLabel(String.valueOf(result));
                    secondNum = false;                //
                }    else {            /////////////////        ///////////////////
                    number1 = Double.parseDouble(txtDisplay.getText());        //
                    makeSecondTrue = true;                                                //
                    setFirstLabel();                                                        //
                    lblSecond.setText("_");                                                //First Part
                    lblResult.setText("_");                                                //   
                    lblOperator.setText("?");                                            //
                    lblSecondNum = true;                                                    //
                }                                                        ////////////////////
                sign = operator;   
                secondEqual = false;
            }
            lblOperator.setText(sign);
            tempNum = "";
        }
    }
   
/*    Makes the number in text field SecondNum
    Returns the result of whatever calculation the user has pressed ( / , * , - , + )    */
    public double Process()    {
        if(sign.equals("*"))
            return (number1 * number2);
        else if(sign.equals("-"))
            return (number1 - number2);
        else if(sign.equals("+"))
            return (number1 + number2);
        else if(sign.equals("/"))    {
            if(number2 == 0)
                return DIVIDE_ZERO_ERROR; //if second number is 0 and it is a division operator, return DIVIDE_ZERO_ERROR
                                        //    so when displayed, it gives a message, "Cannot Divide by Zero"
            else
                return (number1 / number2);
        }
        else
            return ERROR;    //anything other than (/, *, -, +) should return ERROR so when displayed it gives error
    }
   
    //Displays a double number unless if some errors are created
    public void Display(double num)    {
        if(num == DIVIDE_ZERO_ERROR)    {
            R = "Cannot Divide by Zero!";
            error = true;
        }
        else if(num == ERROR)    {
            R = "Invalid Input for Function!";
            error = true;
        }
        else    {
            R = String.valueOf(num);
            if((R.charAt((R.length()) -1) == '0') && (R.charAt((R.length()) -2) == '.'))
            R = R.substring(0, R.length() - 2);
        }
        txtDisplay.setText(R);
        lblResult.setText(R);
        setFirstLabel();
    }
   
    //Square Root function. (sqrt)
    public void sqrt()    {
        if(!error)    {
            tempString = txtDisplay.getText();
            try {result = Math.sqrt(Double.parseDouble(tempString));} catch(Exception e) {result = ERROR;}
            if(tempString.indexOf("-") == 0)
                result = ERROR;
            lblSecond.setText("sqrt( " + tempString + " )");
            Display(result);
            lblFirst.setText("");
            lblOperator.setText("");
            secondNum = false;
            makeSecondTrue = false;
            lblSecondNum = false;
            tempNum = "";
        }
    }
   
    //converts number to percent (%)
    public void percent()    {
        if(!error)    {
            tempString = txtDisplay.getText();
            try {result = (Double.parseDouble(tempString) / 100);} catch(Exception e) {result = ERROR;}
            Display(result);
            setFirstLabel(tempString);
            lblOperator.setText("/");
            setSecondLabel("100");
            secondNum = false;
            makeSecondTrue = false;
            lblSecondNum = false;
            tempNum = "";
        }
    }
   
    //1 Divide by X function (1/x)
    public void divideByX()    {
        if(!error)    {
            tempString = txtDisplay.getText();
            if(tempString.equals("0"))
                result = DIVIDE_ZERO_ERROR;
            else
                try {result = 1 / Double.parseDouble(tempString);} catch(Exception e) {result = ERROR;}
            setSecondLabel(tempString);
            Display(result);
            setFirstLabel("1");
            lblOperator.setText("/");
            secondNum = false;
            makeSecondTrue = false;
            lblSecondNum = false;
            tempNum = "";
        }
    }
   
    //Makes it negative if positive and vice versa
    public void signChange()    {
        if(!error)    {
            tempString = txtDisplay.getText();
            if(tempString.equals("0"))   
            {
                /* Do Nothing*/
            }    else    {
                if(tempString.charAt(0) == '-')
                    tempNum = tempNum.substring(1, tempNum.length());
                else
                    tempNum = "-" + tempString;
                txtDisplay.setText(tempNum);
                checkLabels();
            }
        }
    }
   
    /*    Checks the labels in pnlCalulation to the correct number corresponding with
    whatever user types in.                                                                                    */
    public void checkLabels()    {
        if(tempNum.equals(""))    {
            if(lblSecondNum)    {
                setFirstLabel();
                lblSecond.setText("_");    }
            else    {
                lblFirst.setText("_");
                lblSecond.setText("_");
                lblResult.setText("_");
                lblOperator.setText("?");
            }
        } else    {
            if(lblSecondNum)
                lblSecond.setText(tempNum);
            else    {
                lblFirst.setText(tempNum);
                lblSecond.setText("_");
                lblResult.setText("_");
                lblOperator.setText("?");
            }
        }
    }
   
/*    First Number Label, lblFirst, gets set the number1 without the .0 at the end.
    Sets lblFirst to whatever number1 is depending on where it is needed.                */
    public void setFirstLabel()    {
        Label = String.valueOf(number1);
        if(Label.length() > 2)    {
            if(Label.charAt(Label.length() - 1) == '0' && Label.charAt(Label.length() - 2) == '.')
                Label = Label.substring(0, Label.length() - 2);
        }
        lblFirst.setText(Label);
    }
    public void setFirstLabel(String f)    {
        if(f.length() > 2)    {
            if(f.charAt(f.length() - 1) == '0' && f.charAt(f.length() - 2) == '.')
                f = f.substring(0, f.length() - 2);
        }
        lblFirst.setText(f);
    }
   
    public void setSecondLabel()    {
        Label = String.valueOf(number2);
        lblResult.setText("_");
        if(Label.length() > 2)    {
            if(Label.charAt(Label.length() - 1) == '0' && Label.charAt(Label.length() - 2) == '.')
                Label = Label.substring(0, Label.length() - 2);
        }
        lblSecond.setText(Label);
    }
    public void setSecondLabel(String s)    {
        if(s.length() > 2)    {
            if(s.charAt(s.length() - 1) == '0' && s.charAt(s.length() - 2) == '.')
                s = s.substring(0, s.length() - 2);
        }
        lblSecond.setText(s);
    }
   
    //Backspace
    public void Backspace()    {
        if(!error)    {
            if(txtDisplay.getText().length() < 2)    {
                tempNum = "";
                txtDisplay.setText("0");
            } else    {
                if((txtDisplay.getText().charAt(txtDisplay.getText().length() - 1) == '.' &&
                txtDisplay.getText().charAt(txtDisplay.getText().length() - 2) == '0') ||
                (txtDisplay.getText().length() == 2 && txtDisplay.getText().charAt(0) == '-'))    {
                    tempNum = "";
                    txtDisplay.setText("0");
                    decimalUsed = false;
                }    else    {
                    if(txtDisplay.getText().charAt(txtDisplay.getText().length() - 1) == '.')
                    decimalUsed = false;
                    tempNum = txtDisplay.getText().substring(0, txtDisplay.getText().length() - 1);
                    txtDisplay.setText(tempNum);
                }
            }
            checkLabels();
        }
    }
   
    //Clears First Number or Second Number or everything if result has been shown.
    public void ClearExisting()    {
        tempNum = "";
        txtDisplay.setText("0");
        decimalUsed = false;
        checkLabels();
        error = false;
    }
   
    //Resets everything to startup
    public void Clear()    {
        tempNum = ""; sign = "0"; tempString = "";
        Label = ""; R = "";
        txtDisplay.setText("0");
        lblFirst.setText("_");
        lblOperator.setText("?");
        lblSecond.setText("_");
        lblEqual.setText("=");
        lblResult.setText("_");
        number1 = 0.0; number2 = 0.0; result = 0.0;
        decimalUsed = false; secondNum = false; makeSecondTrue = false;
        lblSecondNum = false; secondEqual = false; error = false;
    }
   
    //Shows the About Calculator Dialog
    public void showAboutDialog()    {
/*        JDialog(Frame, Title, boolean)
                                    boolean: for if you want the dialog to be a pop-up so you
                                                have to do something to make it go away or another kind of frame
                                                beside your original frame.                                                */
        JDialog dlgAbout = new JDialog(window, "About Calculator", true);
        JTextArea txtAbout = new JTextArea(4, 4);
        txtAbout.setLayout(new FlowLayout(FlowLayout.CENTER));
        JPanel pnlAbout = new JPanel(new FlowLayout(FlowLayout.CENTER));
        String about;
        about =     "Calculator" + "\n\n" +
                    "Version: " + VERSION + "\n" +
                    "Created: August 7, 2008" + "\n" +
                    "Author: Blmaster";
        txtAbout.setText(about);
        txtAbout.setEditable(false);
        txtAbout.setBackground(new Color(240, 240, 240));
        pnlAbout.add(txtAbout);
        pnlAbout.setBackground(Color.blue);
        dlgAbout.add(pnlAbout);
        dlgAbout.setSize(180, 122);
        dlgAbout.setLocation(window.getX() + 60, window.getY() + 50);
        dlgAbout.setResizable(false);
        dlgAbout.setVisible(true);
    }
   
/*    Since you cant call a class (you can only call a method),
    we have to make a instance of it. An example would be like,
    you cant call a car so it magically appears in front of you,
    but you can make a car. Something like that.
    The "new" makes a new Calculator and pretty much calls
    the code in the class contructor.                                          */
    public static void main(String[] args)    {
        new Calculator();
    }
}

/*
Version Changes:
    0.5-    made basic layout of application.
    1.0-    added basic (/, *, -, +) operator functions.
    1.1-    added function: lets you keep calculating without hitting "=" button.
    1.15-    fixed bug: wouldnt work after first time.
    1.2-    added function: Clear button.
    1.3-    added function: Clear Exisiting button.
    1.4-     reorganized code: works more efficient now.
    1.6-    added function: change operator sign.
    1.65- fixed bug: intefered with equal sign.
    1.7-     added function: MAX_INPUT for textbox
    1.75-    fixed bug: after textbox has reached MAX_INPUT, wouldnt work.
    1.8-     added function: Backspace button.
    1.85-    fixed (1.6) bug: 1.6 function wouldnt work after first use.
    2.0-     improved: error system, reorganized code, C, CE, Backspace Buttons.
    2.1-    added function: menu bar. Program --> Reset, Exit
    2.2-     added Help --> About to menu bar.
    2.5-     added View --> Show Calculations to menu bar. (beta)
    2/6-     replaced About with a Dialog Message.
    2.7-    fixed Show Calculations. (a lot of work)
    2.8-     reorganized code: show calculation function is cleaned to work more efficiently.
    2.9-     fixed bug: 0 button would add 0 in front of number. Ex. 032
    2.95-    fixed (1.8) bug: Backspace wouldnt make decimal work if it erases decimal.
    2.99-    fixed (2.5) bugs: another Show Calculation bug. wouldnt show 0.
    3.0-    Menu Bar, Show Calculation function, removed all the ".0" at end of number. STABLE
    3.2-    added (sqrt, %, 1/x, +/-) functions.
    3.25-    fixed bugs: 3.2 functions intefered with labels.
    3.4-    reorganized code: more methods for easier understanding.
    3.5-    added Key Listener: Numper Pad in keyboard works with Calculator.
    3.55-    fixed (3.2) bugs:    you can start over after doing functions.
    3.59-    fixed bug: first number label always showing 0 with percent button.
    3.6-    fixed bug: sqrt function would display error as number.
    3.65-    fixed bug: the equal button would calculate wrongly when pressed twice in a row.
    3.7-    added function: forces user to clear or clear exisiting or reset to get out of error.
    3.8-    changed About dialog.
    4.0-    FINISHED
*/

Wednesday, 23 March 2011

dictionary for software engineering students

While studying our teacher says some terms that some time i cant understand the meaning of that so i was finding a dictionary that is only for the software engineering so i have found some of the links that help me so it can help others also
below are the links check out 
1,http://adf.ly/w5mA
2,http://adf.ly/w5ml
3,http://adf.ly/w5nM

guide to java

Click Here

Welcome to Java Video Tutorials!  

Check if This Help You In Ur Work

Java Video Tutorials

Top 40 Java Video Tutorials on youtube

Here are the what I consider the Top 40 Java Video Tutorials on youtube. Some of these teach you the basics with getting starting programming using Java, and some are more advanced, showing you how to code loops, arrays, exceptions, Netbeans, Web services, Event handing, JDBC, and Inheritance. Here is one of the Java Tutorial searches I used to find these.


Top 40 Java Video Tutorials on youtube



Java Video Tutorial 1: Installing the Java Development Kit
This tutorial is the first of a collection of basic java video tutorials that will get you started. In this tutorial you will learn how to install the JDK on a Windows XP machine.   Time: 09:48
Java Video Tutorial 2: Hello World!
This Java tutorial guides you through the basics of writing, compiling and running a simple program with some extra hints and tips along theway....java video tutorial  Time: 07:16
Java Video Tutorial 3: Variables and Arithmatic (Part1)
Part 1 describes how to declare and assign variables in java aswell as discussing the various data types.  Time: 09:48
Java Video Tutorial 3: Variables and Arithmatic (Part2)
Part 2 shows you how to perform simple arithmatic and display variables through an example Java program.  Time: 09:48
Java Video Tutorial 4: If Statements
This tutorial discusses: *If statements *If else statements*Conditional operators...java video tutorial programming lesson if statements else conditional operator statement program flow  Time: 11:40
Java Video Tutorial 5: Object Oriented Programming
This tutorial discusses the basic concepts of object oriented programming (OOP). This includes object behaviour and attributes as well as constructors.  Time: 15:40
Java Video Tutorial 6: Loops
This tutorial will show you how to create while loops, do...while loops and for loops!...java video tutorial lesson programming basic loops  Time: 11:24
Java Video Tutorial 7: Switch Statements
In this tutorial you learn about switch statements....java video tutorial lesson basic programming switch statements program flow.  Time: 08:52
Java Video Tutorial 8: Arrays
This tutorial shows you how to use arrays....java video tutorial lesson basic programming arrays array element.  Time: 15:30
Java Video Tutorial 9: Exceptions
of exception handling. java video tutorial lesson basic programming exceptions exception handling  Time: 09:12


Java Tutorial #1 - Hello World
This Java tutorial covers how to make a hello world program. Go to www.javaomatic.com for more Java tutorials. I useThisJava tutorial covers how to make a hello world program. Go to www.javaomatic.com for more Java tutorials. I use the Eclipse IDE to write Java code, and you can download it at www.eclipse.org&nbsp;  Time: 08:38


Hello world java tutorial
Basic helloworld java tutorial...helloworld hello world java tutorial tutorial  Time: 04:04


Java tutorial 1 - The Basics (Part 1)
Java tutorial 1 - The Basics (Part 2)
Java tutorial 1 - The Basics (Part 3)
This is a Java tutorial on printing, retrieving input, and transforming it into a String. You should have JDK 5.0, because I will teach about user input through a Scanner.  Time: 03:21


Tutorial:: Intro to Java
This is the intro video to the series of Java programming tutorials that I have created.  Time: 09:51


Java tutorial
Indian guy explains Java UI programming with AWT...java awt powerpoint  Time: 01:46


Java tutorial - Part 2 - Installing the Eclipse IDE
A little tutorial I made showing how to install the Eclipse IDE... notthat hard I guess... but I key step I think to getting on with yourJava programming career.   Time: 04:00

 
java tutorial
This Java tutorial uses a simple mathematical operators, I'm using jcreator Pro editor for my sample....java tutorial  Time: 06:49

 
Eclipse and Java for Total Beginners Time: 08:10
Eclipse and Java: Introducing Persistence Time: 09:48
Eclipse and Java: Using the Debugger Time: 09:54 
Eclipse Java tutorial video for beginners. Go to eclipsetutorial.sourceforge.net/ to download the entire 16 lessons of Eclipse and Java for Total Beginners. The downloaded lessons are full size and good quality.


JAVA Introduction: JDK Installation
to start a series of Java Tutorial in simple language. Any question can be sent through comment....Java Video Download JDK Tutorial NewProgramming Technology Installation  Time: 08:00


Re: Java Hello World Application Tutorial
Just a little something about theJava Command Prompt....java programming hello world javac application tutorial  Time: 03:31

 
The Basics Of Java Programming
Just a tutorial to cover the very basics of Java, also the first I'veused Windows Movie Editor to make....Java Programming Tutorial Basics


How To Compile & Configure Java Sucessfully in Gentoo
Shows you how to compile and configure java in gentoo Linux! The title explains it all.  Time: 05:13


Tutorial "creating web services" with netbeans part1
in Java. A much better quality is available at belgampaul.googlepages.com/ws_tutorials.wmv ...software java webservices tutorial  Time: 05:18


java dialog with eclipse
java dialog with eclipse. sorry for the bad resolution, i just don'twant to make it a huge file....java dialog eclipse tutorial  Time: 04:51


Tutorial "creating web services" with netbeans
A short tutorial on how to implement web services in netbeans 6.0 M9. Writing Web Services in Java. A much better quality is available at belgampaul.googlepages.com&nbsp;  Time: 08:48

 
Basic GUI in Java
A tutorial showing you basic GUI in Java...tutorial java GUI help swing awt  Time: 03:57


Event Handling in Java
A video tutorial on how to create a basic GUI window in java and handleevents such as the click of a button....java GUI create basic  Time: 07:25


java] JDBC - Connect to access database
Tutorial connect to database by jdbc in java programming...tutorial java  Time: 00:46


java program
almost a year to complete this.. I just like to share what java can do.....java languages programming applet tutorial sun microsystem Sales and inventory system using the Java language, this system is my greatest development ever it took me almost a year to complete this..  Time: 06:17


eclipse_setup_1
Example how to setup Eclipse IDE with ANT and Tomcat for a sample Guestbook application written in Java...Eclipse Ant Tomcat Java  Time: 03:32
eclipse_setup_2
Example how to setup Eclipse IDE with ANT and Tomcat for a sample Guestbook application written in Java...Eclipse Ant Tomcat Java  Time: 03:39
eclipse_setup_3
Example how to setup Eclipse IDE with ANT and Tomcat for a sample Guestbook application written in Java...Eclipse Ant Tomcat Java  Time: 03:12


Java, the easy way
In this lesson you will see a Java addition example, its easy! ...Java programming program  Time: 02:13


Inheritance: Polymorphism and Interfaces
Tutorial on inheritance, polymorphism, and interfaces as they relate to Java....programming  Time: 05:04


Test Driven Development Introduction
Introduction to test driven development with a Javajunit example using Eclipse 3.2. Agile Development all the way!...TestDriven Development TDD Software Engineering Developer Agile  Time: 09:23

Monday, 21 March 2011

SQL Server Question and Answear


1Question : Identify the advantages of a Network Database Model.      
      
a)    The relationships are easier to implement      
b)    The databases are easy to design      
c)    The model enforces database integrity      
d)    The model achieves sufficient data independence.      
e)    All of the above      
Correct Answers : acd      //e  http://wiki.answers.com/Q/The_advantages_and_disadvantages_of_database_network_model      
2 Question : The __________ component is used to administer permissions on the databases and database objects.      
      
f)    DML      
g)    sub-schema DDL      
h)    DCL      
i)    DDL      
Correct Answers : c  
http://blog.sqlauthority.com/2008/01/15/sql-server-what-is-dml-ddl-dcl-and-tcl-introduction-and-examples/      
3 Question : Which of the following statement/s with respect to the Relational Model is/are True?      
      
j)    This model hides all the complexities of the system      
k)    This model is much faster than the other database systems      
l)    This model concentrates more on the logical view of the database rather than the physical view.      
m)    This model offers a great deal of querying flexibility      
n)    This model is very easy to handle.      
Correct Answers : acde  //in book page no 16
The fastest database modle is network database modle      
4 Question : The Entity integrity rule states that no component of the primary key of a base table should be allowed to accept NULL values. Do you agree with this statement?      
      
o)    Yes.  Because, if the primary key contains NULL values, then the rows would no longer be unique.      
p)    No.  The primary key can contain NULL values but not a zero.      
q)    Can't say.      
Correct Answers : a
Very easy      
5 Question : Statement 1:  For a column to be set as a foreign key in a given table, it must be a primary key in another table.
Statement 2: The two columns being joined by the foreign key relationships must have an identical definition.      
      
r)    Only statement 2 is True      
s)    Both the statements are True      
t)    Both the statements are False      
u)    Only statement 1 is True      
Correct Answers : b
So easy       
6 Question : Which of the following statements with respect to Referential Integrity and Foreign Keys are NOT TRUE?      
      
v)    A database must not contain more than one  unmatched foreign key value.      
w)    The attribute values in the foreign key must have a corresponding match in the relation where the attribute is a primary key.      
x)    New values cannot be introduced in a foreign key      
y)    None of the above      
Correct Answers : a      
7 Question : Who am I?
I am used for efficient searching through a database.
I am used to build online libraries      
      
z)    DML      
aa)    DCL      
bb)    CCL      
cc)    DDL      
dd)    DQL      
Correct Answers : c      
8 Question : Jack has created a database in MS ACCESS using the Database Wizard.  The database will be stored as an ______ file on the system.      
      
ee)    .db      
ff)    .rdb      
gg)    .mdb      
hh)    .dw      
Correct Answers : c      
9 Question : In MS Access, the alphanumeric data type is referred to as the 'Text' data type, and is of variable length holding a maximum of _____ characters.      
      
ii)    255      
jj)    256      
kk)    1024      
ll)    25      
Correct Answers : a      
10 Question : MS Access stores date in the _______ format.      
      
mm)    mm/dd/yy      
nn)    dd-mon-yy      
oo)    dd-mm-yy      
pp)    dd/mm/yy      
qq)    yy-mon-dd      
Correct Answers : a      
11 Question : In MS Access, the field size of a 'Text' field has a default setting of _____.      
      
rr)    10      
ss)    20      
tt)    25      
uu)    40      
vv)    50      
ww)    55      
Correct Answers : e      
12 Question : What rules are applicable when we use referential integrity in an MS Access database?      
      
xx)    We cannot enter a value in the foreign key field of the related table if it does not exist in the primary key of the primary table.      
yy)    We cannot enter a null value in the foreign key.      
zz)    We cannot change a primary key value in the primary table.      
aaa)    We cannot delete a record from a primary table, if matching records exist in a related table.      
bbb)    All of the above      
Correct Answers : acd      
15 Question : Match the field names with the kind of data types needed.
a. Patient_Name           1. Autonumber
b. Patient_ID                 2. Memo                                                                                        
c. Patient_Adm_Date     3. Text                                                                                           
d. Patient_History          4. Date/Time      
      
ccc)    a-3,b-1,c-4,d-2      
ddd)    a-4,b-3,c-1,d-2      
eee)    a-2,b-1,c-4,d-3      
fff)    a-3,b-4,c-1,d-2      
Correct Answers : a      
16 Question : Among all these versions, __________ offers a complete range  of advanced scalability and reliability options.      
      
ggg)    SQL Server 2000 Enterprise Edition      
hhh)    SQL Server 2000 Standard Edition      
iii)    SQL Server 2000 Developer Edition      
jjj)    SQL Server 2000 Desktop Edition      
kkk)    SQL Server 2000 Windows CE Edition      
Correct Answers : a      
17 Question : Microsoft Windows NT Server 4.0 Service Pack 5 or later must be installed as a minimum requirement for all SQL Server 2000 editions.  Do you agree with this statement?      
      
lll)    Yes.      
mmm)    No. SP5 must be installed as a minimum requirement only for SQL Server Enterprise Edition.      
nnn)    No. SP5 must be installed as a minimum requirement only for SQL Server Standard Edition.      
ooo)    No. You need not install any Service Pack .      
Correct Answers : a      
18 Question : Identify the Enterprise level features of SQL Server 2000.      
      
ppp)    SQL Server 2000 supports the Client/Server Model      
qqq)    SQL Server 2000 runs on Windows NT 4 and Windows 2000      
rrr)    SQL Server 2000 supports most of the popular protocols such as AppleTalk, TCP/IP.      
sss)    SQL Server 2000 supports data replication.      
ttt)    SQL Server 2000 provides several tools for building data warehouses.      
uuu)    All of the above      
Correct Answers : f      
19 Question : Identify the minimum hardware requirements for installing SQL Server 2000 and connecting to the clients.      
      
vvv)    60 MB Disk space      
www)    128 MB RAM      
xxx)    Intel compatible 32-bit CPU      
yyy)    NIC      
zzz)    95 MB Disk space      
aaaa)    256 MB RAM      
Correct Answers : bcde      
20 Question : James chooses to install SQL Server 2000 relational database with both server and client tools.  In this case, he should select :      
      
bbbb)    named instance of SQL Server 2000      
cccc)    default instance of SQL Server 2000      
dddd)    Both named and default instance of SQL Server 2000      
eeee)    Either named or default instance of SQL Server 2000      
Correct Answers : d      
21 Question : If SQL Server is using Windows Authentication, you have to provide a login ID each time you access a registered SQL Server.      
      
ffff)    TRUE      
gggg)    FALSE      
Correct Answers : b      
22 Question : Which of the following statement/s with respect to Transact-SQL is/are NOT TRUE?      
      
hhhh)    Transact-SQL allows you to declare and utilize local variables and constants within a Transact-SQL object.      
iiii)    Transact-SQL is a standalone product.      
jjjj)    One can use Transact-SQL to write applications directly      
kkkk)    Transact-SQL is the enabler of programming functionality within the relational databases.      
llll)    Transact-SQL is a set of programming extensions from Microsoft      
Correct Answers : bc      
23 Question : Unlike SQL Server 2000, MS Access maps a database over a set of operating-system files.  Data and log information are never mixed on the same file.      
      
mmmm)    TRUE      
nnnn)    FALSE      
Correct Answers : b      
24 Question : Statement 1: The Secondary data files of SQL Server 2000 database include all the data files including the primary data file.
Statement 2: There must be maximum one log file for each SQL Server 2000 database.
Statement 3: The Primary data file is the starting point of the SQL Server 2000 database.
Statement 4: Every database has one secondary data file
      
      
oooo)    Statement 1 is True
pppp)    Statement 2 is False
qqqq)    Statement 3 is True
rrrr)    Statement 4 is False      
ssss)    Statement 1 is False
tttt)    Statement 2 is True
uuuu)    Statement 3 is False
vvvv)    Statement 4 is True      
wwww)    Statement 1 is False
xxxx)    Statement 2 is False
yyyy)    Statement 3 is True
zzzz)    Statement 4 is True      
aaaaa)    Statement 1 is False
bbbbb)    Statement 2 is False
ccccc)    Statement 3 is True
ddddd)    Statement 4 is False      
eeeee)    Statement 1 is False
fffff)    Statement 2 is False
ggggg)    Statement 3 is False
hhhhh)    Statement 4 is False      
iiiii)          
Correct Answers : d      
25 Question : What command will you give, to set the 'emp' database file eligible for automatic periodic shrinking?      
      
jjjjj)    EXEC sp_adoption 'emp', autoshrink, true      
kkkkk)    EXEC sp_adoption 'emp', autoshrink, Yes      
lllll)    EXECUTE sp_adoption 'emp', autoshrink, Yes      
mmmmm)    EXE  'emp', autoshrink, true      
Correct Answers : a      
26 Question : What will the following command do?
DBCC SHRINKDATABASE(PUBS, 10)
      
      
nnnnn)    It will decrease the size of files in 'Pubs' database to allow 10 percent free space      
ooooo)    It will decrease the size of files in 'Pubs' database 10 times its current size      
ppppp)    It will decrease the size of files in 'Pubs' database to allow 90 percent free space      
qqqqq)    It will decrease the size of 10 files in 'Pubs' database      
Correct Answers : a      
27 Question : What role does the SQL Server Enterprise Manager play?      
      
rrrrr)    It allows users to define groups of servers running SQL Server 2000      
sssss)    It registers individual servers in a group      
ttttt)    It configures all SQL Server 2000 options for each registered server      
uuuuu)    It creates and administers all SQL Server 2000 databases, objects, logins, users, and permissions in each registered sever.      
Correct Answers : abcd      
28 Question : Which of the following statements with respect to the autoshrink feature of SQL Server 2000 are True?      
      
vvvvv)    When using SQL Server Enterprise Edition, the Autoshrink option is set to True      
wwwww)    When using SQL Server Desktop Edition, the Autoshrink option is set to False      
xxxxx)    The autoshrink option is set to False for all other editions regardless of the operation system except for the SQL Server Standard Edition      
yyyyy)    It is not possible to shrink a read-only database      
Correct Answers : d      
29 Question : Can we say that two Nulls are equal?      
      
zzzzz)    Yes      
aaaaaa)    No      
Correct Answers : b      
30 Question : What are the characteristics of a normalized database?      
      
bbbbbb)    There must be no repeating fields      
cccccc)    Each table must contain information about a single entity      
dddddd)    Each table must have a key field      
eeeeee)    Each field in a table must depend on the key field      
ffffff)    All non-key fields must be mutually dependent.      
gggggg)    All of the above      
Correct Answers : abcd      
31 Question : Donald is confused as to when he should use Normalization.  What is your advice to him?      
      
hhhhhh)    Use Normalization when the data is large and scattered      
iiiiii)    Use Normalization when the data is too complicated      
jjjjjj)    Use Normalization when there is a defined group of data      
kkkkkk)    Use Normalization as the first step to build the database application      
Correct Answers : abd      
32 Question : Identify the SQL Server 2000 tools available for enforcing Domain integrity.      
      
llllll)    DEFAULT definition      
mmmmmm)    PRIMARY key constraint      
nnnnnn)    FOREIGN key constraint      
oooooo)    CHECK constraint      
pppppp)    NOT NULL property      
qqqqqq)    UNIQUE CONSTRAINT      
Correct Answers : acde      
Question : ____________ enforces restrictions on the values entered for a particular column.      
      
rrrrrr)    Entity integrity      
ssssss)    Domain integrity      
tttttt)    User-defined integrity      
uuuuuu)    Referential integrity      
Correct Answers : b      
33 Question : Rules, Stored Procedures and Triggers are SQL Server Tools for enforcing _______________ Integrity.      
      
vvvvvv)    Entity      
wwwwww)    Domain      
xxxxxx)    User-defined      
yyyyyy)    Referential      
Correct Answers : d      
34 Question : Statement 1: If we have an option of choosing from a simple primary key and a composite key to be a primary key, we need to select the simple primary key.
Statement 2: Manipulating a single column is faster than manipulating multiple columns.      
      
zzzzzz)    Both the statements are True and statement 2 is the reason for statement 1 being True      
aaaaaaa)    Both the statements are True but statement 2 is not the reason for statement 1 being True      
bbbbbbb)    Only statement 2 is True.      
ccccccc)    Both the statements are False      
Correct Answers : a      
35 Question : A primary key constraint cannot be deleted if it is being referenced by a foreign key constraint in another table; the foreign key constraint must be deleted first.      
      
ddddddd)    TRUE      
eeeeeee)    FALSE      
Correct Answers : a      
36 Question : Which of the following statements with respect to UNIQUE constraint are True?      
      
fffffff)    A UNIQUE constraint is used when we want to enforce the uniqueness of a column that is not the primary key      
ggggggg)    Only one UNIQUE key constraint can be defined on a table.      
hhhhhhh)    A UNIQUE constraint can be referenced by a FOREIGN key constraint.      
iiiiiii)    UNIQUE constraints can be defined on columns that allow null values      
Correct Answers : acd      
Question : By default, the starting value set by the IDENTITY property is _______.      
      
jjjjjjj)    TRUE      
kkkkkkk)    FALSE      
lllllll)    0      
mmmmmmm)    1      
nnnnnnn)    -1      
Correct Answers : d      
37 Question : Alex has deleted the 'emp' table from the database.  He would now like to retrieve the structural definition of the table.  Does SQL Server 2000, allow him to do this?      
      
ooooooo)    Yes.  When a table is deleted from the database, the data and indexes if any are permanently deleted from the database but the structural definition remains intact.      
ppppppp)    No.  When a table is deleted from the database, the structural definition, data, full-text indexes, constraints, and indexes are permanently deleted from the database.      
qqqqqqq)    Can't say. If the DROP table command included an option to restore the structural definition, then it can be retrieved even after the table is permanently deleted.      
rrrrrrr)    Yes.  When a table is deleted from the database, all the data is lost but the table structure and its column constraints, indexes and so on are intact.      
Correct Answers : b      
38 Question : Statement 1: A FOREIGN key constraint has to be linked only to a column with PRIMARY KEY constraint in another table.
Statement 2: A FOREIGN key constraint can be defined to refer to columns with the UNIQUE constraint in another table.      
      
sssssss)    Only statement 1 is True      
ttttttt)    Only statement 2 is True      
uuuuuuu)    Both the statements are True      
vvvvvvv)    Both the statements are False      
Correct Answers : b      
39 Question : When a CHECK constraint is added to an existing table, the CHECK constraint by default is applied to existing data as well as new data.      
      
wwwwwww)    TRUE      
xxxxxxx)    FALSE      
Correct Answers : a      
40 Question : When more than one logical operator is used in a statement, ______ is evaluated first, then ________, and finally _______.      
      
yyyyyyy)    AND, OR, NOT      
zzzzzzz)    OR, NOT, AND      
aaaaaaaa)    NOT, AND, OR      
bbbbbbbb)    NOT, OR, AND      
cccccccc)    AND, NOT, OR      
dddddddd)    OR, AND, NOT      
Correct Answers : c      
41 Question : Statement 1: Inner Joins eliminate the rows that do not match with a row  from the other table.
Statement 2: Outer Joins, return all rows from atleast one of the tables mentioned in the FROM clause, as along as those rows meet any WHERE or HAVING search conditions of the SELECT statement.      
      
eeeeeeee)    Only statement 1 is True      
ffffffff)    Only statement 2 is True      
gggggggg)    Both the statements are True      
hhhhhhhh)    Both the statements are False      
Correct Answers : c      
41 Question : What will happen, if there are records in other tables linked to the records being deleted?      
      
iiiiiiii)    The deletion will not take place.      
jjjjjjjj)    The records from the current table will be deleted.      
kkkkkkkk)    The records from the current table as well as the linked records will be deleted.      
Correct Answers : a      
42 Question : What command must Sam use to delete all the rows from a table.      
      
llllllll)    DROP table      
mmmmmmmm)    DELETE ROWS      
nnnnnnnn)    DELETE TABLE      
oooooooo)    TRUNCATE TABLE      
Correct Answers : d      
43 Question : The Create Table statement belongs to the ___ category of SQL statements .      
      
pppppppp)    DML      
qqqqqqqq)    DCL      
rrrrrrrr)    CCL      
ssssssss)    DDL      
tttttttt)    DQL      
Correct Answers : d      
44 Question : Which SQL statement will return all items like chocolates, chocopie etc.      
      
uuuuuuuu)    Select * from eatables where item_desc LIKE CHOCO*"      
vvvvvvvv)    Select  from eatables where item_desc = CHOCO%"      
wwwwwwww)    Select * from eatables where item_desc LIKE CHOCO%"      
xxxxxxxx)    Select * from eatables where item_desc LIKE %CHOCO?"      
Correct Answers : c      
45 Question : You want to check what will be the salary of all employees, if their basic is increased by 10%. What SQL statement will show you this result ?      
      
yyyyyyyy)    Select emp_code, basic*.10 from employee order by emp_code      
zzzzzzzz)    Select emp_code, basic+basic*.01 from employee order by emp_code      
aaaaaaaaa)    Select emp_code, basic+10 from employee order by emp_code      
bbbbbbbbb)    Select emp_code, basic+basic*.10 from employee order by emp_code      
Correct Answers : d      
46 Question : Identify the query which will increase the cost of all books by about 10%.      
      
ccccccccc)    UPDATE BookDetails SET Book_Price*10/100;      
ddddddddd)    UPDATE BookDetails SET Book_Price=Book_Price*10/100;      
eeeeeeeee)    UPDATE Book_Price=Book_Price+Book_Price*10/100 FROM BookDetails;      
fffffffff)    UPDATE BookDetails SET Book_Price=Book_Price+Book_Price*10/100;      
Correct Answers : d      
47 Question : 1. A key which qualifies to be a Primary Key is called a Secondary Key.                                 
2. A Candidate key, which is not used as a Primary Key is called an Alternate Key.
      
      
ggggggggg)    1 is true      
hhhhhhhhh)    1 is false      
iiiiiiiii)    2 is true      
jjjjjjjjj)    2 is false      
kkkkkkkkk)          
lllllllll)          
Correct Answers : bc      
48 Question : __________ ensures that relationships defined between tables are valid and accidental deletion or modification of related data is not possible.      
      
mmmmmmmmm)    Entity integrity      
nnnnnnnnn)    Domain integrity      
ooooooooo)    User-defined integrity      
ppppppppp)    Referential integrity      
qqqqqqqqq)          
rrrrrrrrr)          
Correct Answers : b      
49 Question : The SQL statement - "SELECT name, id, mks from Student, Marks where student.id(+)=Marks.id "  ....is an example of ___ Join.      
      
sssssssss)    Inner      
ttttttttt)    Outer      
uuuuuuuuu)    Self      
vvvvvvvvv)          
wwwwwwwww)          
xxxxxxxxx)          
Correct Answers : b      
50 Question : To view only those records from ‘Student’ table, where regis_dt field value is in between 10/02/2004 and 12/02/2004, then the following SQL statement can be used:      
      
yyyyyyyyy)    SELECT * FROM Student
zzzzzzzzz)     WHERE regis_dt
aaaaaaaaaa)     BETWEEN "10/02/2004" AND "12/02/2004";      
bbbbbbbbbb)    SELECT * FROM Student                                                                         WHERE regis_dt
cccccccccc)    BETWEEN #10/02/2004# AND #12/02/2004#;      
dddddddddd)    SELECT * FROM Student                                                                         WHERE regis_dt
eeeeeeeeee)    NOT BETWEEN #10/02/2004# AND #12/02/2004#;      
ffffffffff)          
gggggggggg)          
hhhhhhhhhh)          
Correct Answers : b      
51 Question : Which one of the following SQL statements will display the maximum marks achieved by a student, subject wise?      
      
iiiiiiiiii)    SELECT Student_Name,Student_Subject, Max(Marks)FROM Student_Acads
jjjjjjjjjj)    GROUP BY Student_Subject      
kkkkkkkkkk)    SELECT Student_Subject, FROM Student_Acads
llllllllll)    GROUP BY Student_Subject WHERE Max(Marks)      
mmmmmmmmmm)    SELECT Student_Subject, Max(Marks)FROM Student_Acads
nnnnnnnnnn)    GROUP BY Student_Subject      
oooooooooo)    SELECT Student_Subject, Max(Marks)FROM Student_Acads
pppppppppp)    WHERE Mac(Marks) GROUP BY Student_Subject      
qqqqqqqqqq)          
rrrrrrrrrr)          
Correct Answers : c      
52 Question : Which one of the following SQL statements returns the name of the employee receiving the maximum salary in a particular department ?      
      
ssssssssss)    SELECT Emp_Name,Dep_Code,Salary
tttttttttt)    FROM Employee
uuuuuuuuuu)    WHERE Employee.Salary = (Select Max(Salary) from Employee GROUP BY Dep_Code);      
vvvvvvvvvv)    SELECT Emp_Name,Dep_Code,Salary
wwwwwwwwww)    FROM Employee
xxxxxxxxxx)    WHERE Employee.Salary In (Select Max(Salary) from Employee GROUP BY Dep_Code HAVING Max(Salary));      
yyyyyyyyyy)    SELECT Emp_Name,Dep_Code,Salary
zzzzzzzzzz)    FROM Employee
aaaaaaaaaaa)    WHERE Employee.Salary In (Select Max(Salary) from Employee GROUP BY Dep_Code);      
bbbbbbbbbbb)    SELECT Emp_Name,Dep_Code,Salary
ccccccccccc)    FROM Employee
ddddddddddd)    WHERE Employee.Salary In (Select Salary from Employee GROUP BY Dep_Code HAVING Max(Salary));      
eeeeeeeeeee)          
fffffffffff)          
Correct Answers : c      
53 Question : The following SQL statement returns the total number of employees in a Company :      
      
ggggggggggg)    Select count(Emp_Code) from Employee      
hhhhhhhhhhh)    Select sum(Emp_Code) from Employee      
iiiiiiiiiii)    Select max(Emp_Code) from Employee      
jjjjjjjjjjj)    Select Emp_Code from Employee where count(employee) >0      
kkkkkkkkkkk)          
lllllllllll)          
Correct Answers : a      
Question : What do you understand by database design?      
      
mmmmmmmmmmm)    The process of planning and structuring data objects along with the relationships among them (if any) within a database      
nnnnnnnnnnn)    A design sub activity involving the design of the conceptual, logical, and physical structure of one or more databases.
ooooooooooo)          
ppppppppppp)    The formal process of analyzing facts about the real world into a structured database model.      
qqqqqqqqqqq)    All of the above      
rrrrrrrrrrr)          
sssssssssss)          
Correct Answers : d      
54 Question : A table that tracks sales transactions will commonly have a link to the customers table so that the complete customer information can be associated with the sales transaction.  Such type of information is stored in which type of columns of a table in the database ?      
      
ttttttttttt)    Identifier columns      
uuuuuuuuuuu)    Relational or referential columns      
vvvvvvvvvvv)    Categorical columns      
wwwwwwwwwww)    Raw data columns      
xxxxxxxxxxx)          
yyyyyyyyyyy)          
Correct Answers : b      
55 Question : The Entity Relationship Diagram (E-R diagram), is a modeling tool for ______________.      
      
zzzzzzzzzzz)    Logical database design      
aaaaaaaaaaaa)    Physical Database design      
bbbbbbbbbbbb)    Conceptual Database design      
cccccccccccc)          
dddddddddddd)          
eeeeeeeeeeee)          
Correct Answers : a      
Question : Identify the ERD symbol used to represent entity sets.      
      
ffffffffffff)    Diamonds      
gggggggggggg)    Ellipses      
hhhhhhhhhhhh)    Rectangle      
iiiiiiiiiiii)    Squares      
jjjjjjjjjjjj)          
kkkkkkkkkkkk)          
Correct Answers : c      
56 Question : What benefits can be achieved by converting data into normalized form?      
      
llllllllllll)    Reduce a database structure to its simplest form      
mmmmmmmmmmmm)    Identify all data that is dependent on other data      
nnnnnnnnnnnn)    Remove redundant columns from tables      
oooooooooooo)    All of the above      
Correct Answers : d      
Question : Normalization is the process of converting an arbitrary relational database design into one that will have "good" operational properties      
      
pppppppppppp)    TRUE      
qqqqqqqqqqqq)    FALSE      
Correct Answers : a      
57 Question : When is a relation said to be in the Second Normal Form (2NF)?      
      
rrrrrrrrrrrr)    If and only if all underlying domains contain atomic values      
ssssssssssss)    If it is in 1NF and every non-key attribute is fully dependent on each foreign key of the relation.      
tttttttttttt)    If every non-key attribute of R is non-transitively dependent on each candidate key of R.      
uuuuuuuuuuuu)    If it is in 1NF and every non-key attribute is fully dependent on each candidate key of the relation      
Correct Answers : d      
58 Question : What is the difference between Joins and Unions ?      
      
vvvvvvvvvvvv)    Unions combine rows from multiple data tables, while Joins combine columns from multiple data tables.
wwwwwwwwwwww)          
xxxxxxxxxxxx)    Unions combine columns from multiple data tables, while Joins combine rows from multiple data tables.
yyyyyyyyyyyy)          
zzzzzzzzzzzz)    There is no such difference between Joins and Unions.      
Correct Answers : a      
59 Question : The __________ and __________ clause can be used to generate aggregate totals.      
      
aaaaaaaaaaaaa)    COMPUTE      
bbbbbbbbbbbbb)    CALCULATE      
ccccccccccccc)    COMPUTE BY      
ddddddddddddd)    CALCULATE BY      
eeeeeeeeeeeee)    AGGREGATE      
Correct Answers : a,c      
60 Question : By default, the UNION operator doesn't remove duplicates from the result set.      
      
fffffffffffff)    TRUE      
ggggggggggggg)    FALSE      
Correct Answers : b      
61 Question : What is the SQL syntax for selecting only a few columns from a table?      
      
hhhhhhhhhhhhh)    SELECT  <COLUMN1>, <COLUMN2>… From  <Table Name>      
iiiiiiiiiiiii)    SELECT * FROM <Table_name>      
jjjjjjjjjjjjj)    SELECT  <COLUMN1>, <COLUMN2>,....      
Correct Answers : a      
62 Question : The SELECT statement can be used to populate the result of a query into another table.      
      
kkkkkkkkkkkkk)    TRUE      
lllllllllllll)    FALSE      
Correct Answers : b      
Question : How many rows can be returned by a subquery without generating an error?      
      
mmmmmmmmmmmmm)    Only one.      
nnnnnnnnnnnnn)    Only one unless preceded by the ANY, ALL, EXISTS, or IN operators      
ooooooooooooo)    Unlimited      
ppppppppppppp)    Unlimited unless, preceded by the ANY, ALL, EXISTS or IN operators      
Correct Answers : d      
63 Question : We can use a subquery as a replacement for a value in the SELECT clause, as a part of WHERE clause.      
      
qqqqqqqqqqqqq)    TRUE      
rrrrrrrrrrrrr)    FALSE      
Correct Answers : a      
64 Question : !=, <>, ^= all denote the same operation in SQL.      
      
sssssssssssss)    TRUE      
ttttttttttttt)    FALSE      
Correct Answers : a      
65 Question : Which one of the following keywords indicates the end of a SQL batch?
      
      
uuuuuuuuuuuuu)    Go      
vvvvvvvvvvvvv)    End      
wwwwwwwwwwwww)    STOP      
xxxxxxxxxxxxx)    TERMINATE      
yyyyyyyyyyyyy)    No such keyword is used      
Correct Answers : a      
66 Question : When running a SELECT query, how do you select each DISTINCT element?      
      
zzzzzzzzzzzzz)    Add the keyword DISTINCT after SELECT.      
aaaaaaaaaaaaaa)    Add the keyword DISTINCT before SELECT.      
bbbbbbbbbbbbbb)    Add the keyword DISTINCT after WHERE.      
cccccccccccccc)    Add the keyword DISTINCT after FROM.      
Correct Answers : c      
67 Question : Refer to the given query:
SELECT product_id FROM order_items
UNION
SELECT product_id FROM inventories;
Which of the following is true?      
      
dddddddddddddd)    There are syntax errors      
eeeeeeeeeeeeee)    Only distinct rows that appear in either result are returned       
ffffffffffffff)    All the rows in the result are returned      
gggggggggggggg)    No output      
Correct Answers : b      
68 Question : When can you place a index on a view?      
      
hhhhhhhhhhhhhh)    When you only DELETE from the view      
iiiiiiiiiiiiii)    When you only SELECT from the view      
jjjjjjjjjjjjjj)    When there is a WITH CHECK OPTION used to create the view      
kkkkkkkkkkkkkk)    When you can UPDATE using the view      
llllllllllllll)    You cannot place a index on the view      
Correct Answers : e      
69 Question : What is the default length of a CHAR column?      
      
mmmmmmmmmmmmmm)    2 bytes      
nnnnnnnnnnnnnn)    8 bytes      
oooooooooooooo)    1 byte      
pppppppppppppp)    4 bytes      
Correct Answers : c      
70 Question : Which of the following clauses are mandatory in a SQL query?      
      
qqqqqqqqqqqqqq)    SELECT      
rrrrrrrrrrrrrr)    WHERE      
ssssssssssssss)    HAVING      
tttttttttttttt)    FROM      
Correct Answers : a,d      
71 Question : Where all can you use SQL expressions?      
      
uuuuuuuuuuuuuu)    In the condition of the WHERE clause and the HAVING clause      
vvvvvvvvvvvvvv)    In the VALUES clause of the INSERT statement      
wwwwwwwwwwwwww)    In the SET clause of the UPDATE statement      
xxxxxxxxxxxxxx)    In the select list of the SELECT statement      
yyyyyyyyyyyyyy)          
zzzzzzzzzzzzzz)          
Correct Answers : a,b,c,d      
72 Question : Partitioned tables are preferable over partition views in most operational environments.      
      
aaaaaaaaaaaaaaa)    TRUE      
bbbbbbbbbbbbbbb)    FALSE      
ccccccccccccccc)    TRUE: Only when the base tables are empty      
ddddddddddddddd)          
eeeeeeeeeeeeeee)          
fffffffffffffff)          
Correct Answers : a      
73 Question : Which of the following clauses may use a Temporary Tablespace?      
      
ggggggggggggggg)    UNION ALL clause      
hhhhhhhhhhhhhhh)    SELECT DISTINCT Clause      
iiiiiiiiiiiiiii)    INNER JOIN      
jjjjjjjjjjjjjjj)    GROUP BY clause      
kkkkkkkkkkkkkkk)          
lllllllllllllll)          
Correct Answers : b,c,d      
74 Question : What is the purpose of the IN operator?      
      
mmmmmmmmmmmmmmm)    Compare two similar values.      
nnnnnnnnnnnnnnn)    Restrict results to a specified list of values.      
ooooooooooooooo)    Perform an equality comparison.      
ppppppppppppppp)    Evaluate a range of values.      
qqqqqqqqqqqqqqq)          
rrrrrrrrrrrrrrr)          
Correct Answers : b      
75 Question : Which of the following commands can you use to define the name and structure of the cursor together with the SELECT statement that will populate the cursor with your data?      
      
sssssssssssssss)    FETCH      
ttttttttttttttt)    OPEN      
uuuuuuuuuuuuuuu)    DECLARE      
vvvvvvvvvvvvvvv)    CLOSE      
wwwwwwwwwwwwwww)          
xxxxxxxxxxxxxxx)          
Correct Answers : c      
76 Question : SQL statements with the HAVING clause:      
      
yyyyyyyyyyyyyyy)    Must include the GROUP BY clause      
zzzzzzzzzzzzzzz)    Must exclude the GROUP BY clause.      
aaaaaaaaaaaaaaaa)    May or may not include the GROUP BY clause.      
bbbbbbbbbbbbbbbb)          
cccccccccccccccc)          
dddddddddddddddd)          
Correct Answers : c      
77 Question : To write a query that performs an outer join on tables A and B and returns all rows from A, you are actually about to write:      
      
eeeeeeeeeeeeeeee)    A left outer join      
ffffffffffffffff)    An inner join      
gggggggggggggggg)    A right outer join      
hhhhhhhhhhhhhhhh)    An equijoin      
iiiiiiiiiiiiiiii)          
jjjjjjjjjjjjjjjj)          
Correct Answers : a      
78 Question : Which of the following is executed automatically?      
      
kkkkkkkkkkkkkkkk)    Procedure      
llllllllllllllll)    Anonymous PL/SQL block      
mmmmmmmmmmmmmmmm)    Function      
nnnnnnnnnnnnnnnn)    Trigger      
oooooooooooooooo)          
pppppppppppppppp)          
Correct Answers : d      
79 Question : Identify the SELECT statement which returns all the ‘Names’ in the Accounts table containing the alphabet ‘e’, but not as the first letter.      
      
qqqqqqqqqqqqqqqq)    SELECT * FROM Accounts WHERE Names LIKE ‘e’      
rrrrrrrrrrrrrrrr)    SELECT Name FROM Accounts WHERE Name LIKE ‘%e’      
ssssssssssssssss)    SELECT * FROM Accounts WHERE Name LIKE ‘&e’      
tttttttttttttttt)    SELECT * FROM Accounts WHERE Name LIKE ‘%e%’      
uuuuuuuuuuuuuuuu)    SELECT Name FROM Accounts WHERE Name LIKE ‘[^e]%e%’      
vvvvvvvvvvvvvvvv)          
Correct Answers : e      
80 Question : There is a table Student, which has a field studentname containing names of students. Identify the wildcard used to retrieve names of students, which don’t start within the range of e-g.      
      
wwwwwwwwwwwwwwww)    [e-g]%      
xxxxxxxxxxxxxxxx)    [e^g]%      
yyyyyyyyyyyyyyyy)    [^e-g]%      
zzzzzzzzzzzzzzzz)    [efg]%      
aaaaaaaaaaaaaaaaa)    [^efg]%      
bbbbbbbbbbbbbbbbb)          
Correct Answers : c      
81 Question : We have a table 'SSC_Result' that contains fields like student_name, Marks, Sub, School_Name. Construct a query to display the school_Name and the marks of those who have scored maximum marks in Maths.      
      
ccccccccccccccccc)    SELECT MAX (Marks), School_Name, Student_Name FROM SSC_Result WHERE sub = 'Maths' GROUP BY School_Name      
ddddddddddddddddd)    SELECT MAX (Marks), School_Name FROM SSC_Result WHERE sub = 'Maths' GROUP BY School_Name      
eeeeeeeeeeeeeeeee)    SELECT Marks(Max), School_Name, Student_Name FROM SSC_Result WHERE sub = 'Maths' GROUP BY School_Name      
fffffffffffffffff)          
ggggggggggggggggg)          
hhhhhhhhhhhhhhhhh)          
Correct Answers : b      
82 Question : A Trigger cannot be fired with the ____ SQL command.      
      
iiiiiiiiiiiiiiiii)    update      
jjjjjjjjjjjjjjjjj)    drop      
kkkkkkkkkkkkkkkkk)    delete      
lllllllllllllllll)    insert      
mmmmmmmmmmmmmmmmm)          
nnnnnnnnnnnnnnnnn)          
Correct Answers : b      
83 Question : SQL Server automatically creates an index for:      
      
ooooooooooooooooo)    Foreign key      
ppppppppppppppppp)    Primary key      
qqqqqqqqqqqqqqqqq)    Unique key      
rrrrrrrrrrrrrrrrr)    Default key      
sssssssssssssssss)          
ttttttttttttttttt)          
Correct Answers : b,c      
84 Question : Which of the following statement/s with respect to the Primary key is/are TRUE?      
      
uuuuuuuuuuuuuuuuu)    Primary key does not take null values.      
vvvvvvvvvvvvvvvvv)    All fields marked with primary keys can be unique keys but all unique keys are not primary keys.      
wwwwwwwwwwwwwwwww)    We can have only one primary key for a table.      
xxxxxxxxxxxxxxxxx)    Primary key uses unique key for making relationships      
yyyyyyyyyyyyyyyyy)          
zzzzzzzzzzzzzzzzz)          
Correct Answers : a,c      
85 Question : Which one of the following should be removed to transform a relation from the first normal form to the second normal form ?      
      
aaaaaaaaaaaaaaaaaa)    All partial-key dependencies      
bbbbbbbbbbbbbbbbbb)    All inverse partial-key dependencies      
cccccccccccccccccc)    All repeating groups      
dddddddddddddddddd)    All transitive dependencies      
eeeeeeeeeeeeeeeeee)          
ffffffffffffffffff)          
Correct Answers : a      
86 Question : Which of the following statement/s with respect to the count(*) function is/are TRUE?      
      
gggggggggggggggggg)    It can be used with  parameters      
hhhhhhhhhhhhhhhhhh)    It returns the number of unique rows, if used  with the Distinct keyword      
iiiiiiiiiiiiiiiiii)    It returns rows having null values      
jjjjjjjjjjjjjjjjjj)    It doesn't return rows having null values      
kkkkkkkkkkkkkkkkkk)          
llllllllllllllllll)          
Correct Answers : c      
Question : Views are dropped when corresponding table/s is/are dropped.      
      
mmmmmmmmmmmmmmmmmm)    TRUE      
nnnnnnnnnnnnnnnnnn)    FALSE      
oooooooooooooooooo)          
pppppppppppppppppp)          
qqqqqqqqqqqqqqqqqq)          
rrrrrrrrrrrrrrrrrr)          
Correct Answers : b      
87 Question : Choose the SELECT statement to display the name of the employee who belongs to the computer department and whose salary is greater than Rs.5000.      
      
ssssssssssssssssss)    Select emp_name from emp where dept = 'Computer' and sal >5000      
tttttttttttttttttt)    Select emp_name from emp where dept = 'Computer'  or sal >5000      
uuuuuuuuuuuuuuuuuu)    Select * from emp where dept like 'C%' or sal like > 5000      
vvvvvvvvvvvvvvvvvv)    Select * from emp      
wwwwwwwwwwwwwwwwww)          
xxxxxxxxxxxxxxxxxx)          
Correct Answers : a      
Question : Identify the query to compute the total number of rows present in the emp table.      
      
yyyyyyyyyyyyyyyyyy)    Select rowcount from emp      
zzzzzzzzzzzzzzzzzz)    Select totalrows from emp      
aaaaaaaaaaaaaaaaaaa)    Select count(*) from emp      
bbbbbbbbbbbbbbbbbbb)    Select count_rows from emp      
ccccccccccccccccccc)          
ddddddddddddddddddd)          
Correct Answers : c      
88 Question : Which trigger is used to enforce referential integrity?      
      
eeeeeeeeeeeeeeeeeee)    Instead of trigger      
fffffffffffffffffff)    Cascading trigger      
ggggggggggggggggggg)    Update trigger      
hhhhhhhhhhhhhhhhhhh)    Nested trigger      
iiiiiiiiiiiiiiiiiii)          
jjjjjjjjjjjjjjjjjjj)          
Correct Answers : b      
Question : What is the return type of a stored procedure in SQL Server 2000?      
      
kkkkkkkkkkkkkkkkkkk)    Integer      
lllllllllllllllllll)    Character      
mmmmmmmmmmmmmmmmmmm)    Boolean      
nnnnnnnnnnnnnnnnnnn)          
ooooooooooooooooooo)          
ppppppppppppppppppp)          
Correct Answers : a      
89 Question : Which one of the following SQL statements will you use to return the minimum and maximum salary from the employee table?      
      
qqqqqqqqqqqqqqqqqqq)    Select min(sal) and max(sal) from emp      
rrrrrrrrrrrrrrrrrrr)    Select min(sal) , max(sal) from emp Group by sal      
sssssssssssssssssss)    Select min(sal),max(sal) from emp      
ttttttttttttttttttt)          
uuuuuuuuuuuuuuuuuuu)          
vvvvvvvvvvvvvvvvvvv)          
Correct Answers : c      
90 Question : The _______ function in SQL Server returns the current date.      
      
wwwwwwwwwwwwwwwwwww)    getdate()      
xxxxxxxxxxxxxxxxxxx)    now()      
yyyyyyyyyyyyyyyyyyy)    date()      
zzzzzzzzzzzzzzzzzzz)    currentdate()      
aaaaaaaaaaaaaaaaaaaa)          
bbbbbbbbbbbbbbbbbbbb)          
Correct Answers : a      
91 Question : We can use the Alter table command to drop the constraint from a table.      
      
cccccccccccccccccccc)    TRUE      
dddddddddddddddddddd)    FALSE      
eeeeeeeeeeeeeeeeeeee)          
ffffffffffffffffffff)          
gggggggggggggggggggg)          
hhhhhhhhhhhhhhhhhhhh)          
Correct Answers : a      
92 Question : The ________ function is used to compute the square of a number.      
      
iiiiiiiiiiiiiiiiiiii)    POWER      
jjjjjjjjjjjjjjjjjjjj)    SQUARE      
kkkkkkkkkkkkkkkkkkkk)    SQR      
llllllllllllllllllll)    POW      
mmmmmmmmmmmmmmmmmmmm)          
nnnnnnnnnnnnnnnnnnnn)          
Correct Answers : a      
93 Question : What is the return type of the query given below?
SELECT SIGN(0)      
      
oooooooooooooooooooo)    0      
pppppppppppppppppppp)    1      
qqqqqqqqqqqqqqqqqqqq)    -1      
rrrrrrrrrrrrrrrrrrrr)          
ssssssssssssssssssss)          
tttttttttttttttttttt)          
Correct Answers : a      
94 Question : Pick the odd one out:(all are system functions)      
      
uuuuuuuuuuuuuuuuuuuu)    DB_ID      
vvvvvvvvvvvvvvvvvvvv)    DB_NAME      
wwwwwwwwwwwwwwwwwwww)    DB_SID      
xxxxxxxxxxxxxxxxxxxx)    SUSER_SID      
yyyyyyyyyyyyyyyyyyyy)    SUSER_ID      
zzzzzzzzzzzzzzzzzzzz)    SUSER_SNAME      
Correct Answers : c      
95 Question : To write a query that performs an outer join on tables A and B and returns all rows from A, you need to apply the outer join operator to all columns of table ______ in the join condition in the WHERE clause.      
      
aaaaaaaaaaaaaaaaaaaaa)    A      
bbbbbbbbbbbbbbbbbbbbb)    B      
ccccccccccccccccccccc)    A and B      
ddddddddddddddddddddd)          
eeeeeeeeeeeeeeeeeeeee)          
fffffffffffffffffffff)          
Correct Answers : b      
96 Question : What type of relationship exists between employees and the department?      
      
ggggggggggggggggggggg)    one to one      
hhhhhhhhhhhhhhhhhhhhh)    one to many      
iiiiiiiiiiiiiiiiiiiii)    many to one      
jjjjjjjjjjjjjjjjjjjjj)    many to many      
kkkkkkkkkkkkkkkkkkkkk)          
lllllllllllllllllllll)          
Correct Answers : c      
Question : Which of the following is present in the oval symbol in an ERD?      
      
mmmmmmmmmmmmmmmmmmmmm)    Entity      
nnnnnnnnnnnnnnnnnnnnn)    Attribute      
ooooooooooooooooooooo)    Process      
ppppppppppppppppppppp)    Data store      
qqqqqqqqqqqqqqqqqqqqq)          
rrrrrrrrrrrrrrrrrrrrr)          
Correct Answers : b      
97 Question : _____ command is used in Database management system to fetch the common records from two tables.      
      
sssssssssssssssssssss)    Union      
ttttttttttttttttttttt)    Intersect      
uuuuuuuuuuuuuuuuuuuuu)    Difference      
vvvvvvvvvvvvvvvvvvvvv)    Join      
wwwwwwwwwwwwwwwwwwwww)          
xxxxxxxxxxxxxxxxxxxxx)          
Correct Answers : b      
98 Question : Emp_code in an employee table is _______ in an ER diagram.      
      
yyyyyyyyyyyyyyyyyyyyy)    an attribute      
zzzzzzzzzzzzzzzzzzzzz)    an entity      
aaaaaaaaaaaaaaaaaaaaaa)    an entityset      
bbbbbbbbbbbbbbbbbbbbbb)    an attributeset      
cccccccccccccccccccccc)          
dddddddddddddddddddddd)          
Correct Answers : a      
99 Question : Identify the many-to-many relationships from the following:      
      
eeeeeeeeeeeeeeeeeeeeee)    Student--Course      
ffffffffffffffffffffff)    Employee--Department      
gggggggggggggggggggggg)    Customer--Order      
hhhhhhhhhhhhhhhhhhhhhh)    Students--Roll_No.      
iiiiiiiiiiiiiiiiiiiiii)          
jjjjjjjjjjjjjjjjjjjjjj)          
Correct Answers : a,c      
100 Question : Which global variable is used to view the date, version number and processor type of the current SQL Server?      
      
kkkkkkkkkkkkkkkkkkkkkk)    @@ServerName      
llllllllllllllllllllll)    @@ServiceName      
mmmmmmmmmmmmmmmmmmmmmm)    @@CPU_Busy      
nnnnnnnnnnnnnnnnnnnnnn)    @@Version      
oooooooooooooooooooooo)          
pppppppppppppppppppppp)          
Correct Answers : d      
101 Question : Statement 1:Views can be created using other views
Statement 2:Views can be accessed only in the current database.
Statement 3:Views can contain only 250 columns.
Statement 4:A View is dropped when we drop the corresponding table.
Identify the valid statement/s.      
      
qqqqqqqqqqqqqqqqqqqqqq)    Statement 1      
rrrrrrrrrrrrrrrrrrrrrr)    Statement 2      
ssssssssssssssssssssss)    Statement 3      
tttttttttttttttttttttt)    Statement 4      
uuuuuuuuuuuuuuuuuuuuuu)          
vvvvvvvvvvvvvvvvvvvvvv)          
Correct Answers : d      
102 Question : Update Employee set Sal = Sal + (Sal * .20) where Sal between 2000 and 4000                                                          
What is the output of the above query?      
      
wwwwwwwwwwwwwwwwwwwwww)    The query will  increase the salary by 20% for the employees whose salary is 2000 and 4000      
xxxxxxxxxxxxxxxxxxxxxx)    The query will  increase the salary by 20% for  the employees  whose salary is between  2000 and 4000. It will also include the employees whose salary is 2000 and 4000      
yyyyyyyyyyyyyyyyyyyyyy)    The query will  increase the salary by 20% for  the employees  whose salary is between  2000 and 4000. It will exclude the employees whose salary is 2000 and 4000      
zzzzzzzzzzzzzzzzzzzzzz)          
aaaaaaaaaaaaaaaaaaaaaaa)          
bbbbbbbbbbbbbbbbbbbbbbb)          
Correct Answers : b      
103 Question : A stored procedure is a group of T-SQL statements compiled into a single execution plan.      
      
ccccccccccccccccccccccc)    TRUE      
ddddddddddddddddddddddd)    FALSE      
eeeeeeeeeeeeeeeeeeeeeee)          
fffffffffffffffffffffff)          
ggggggggggggggggggggggg)          
hhhhhhhhhhhhhhhhhhhhhhh)          
Correct Answers : a      
104 Question : Which property ensures that all the transactions have been completed successfully?      
      
iiiiiiiiiiiiiiiiiiiiiii)    Atomicity      
jjjjjjjjjjjjjjjjjjjjjjj)    Consistent      
kkkkkkkkkkkkkkkkkkkkkkk)    Isolated      
lllllllllllllllllllllll)    Durable      
mmmmmmmmmmmmmmmmmmmmmmm)          
nnnnnnnnnnnnnnnnnnnnnnn)          
Correct Answers : a      
105 Question : Following are the types of transactions in SQL Server 2000.      
      
ooooooooooooooooooooooo)    Explicit transaction      
ppppppppppppppppppppppp)    Implicit transaction      
qqqqqqqqqqqqqqqqqqqqqqq)    Autocommit transaction      
rrrrrrrrrrrrrrrrrrrrrrr)    Rollback transaction      
sssssssssssssssssssssss)          
ttttttttttttttttttttttt)          
106 Correct Answers : a,b,c      
Question : Following query in SQL Server 200 is used to fetch the first 10 records from a table which contain 100 records. (Choose all that apply)      
      
uuuuuuuuuuuuuuuuuuuuuuu)    Select * from Table_name      
vvvvvvvvvvvvvvvvvvvvvvv)    Select top 10 * from Table_name      
wwwwwwwwwwwwwwwwwwwwwww)    Select top 10 percent * from Table_name      
xxxxxxxxxxxxxxxxxxxxxxx)    Select * from Table_name top 10      
yyyyyyyyyyyyyyyyyyyyyyy)    Select * from Table_name top 10 percent *      
zzzzzzzzzzzzzzzzzzzzzzz)          
Correct Answers : b,c      
107 Question : Identify the correct sequence of keywords in a SQL Server 2000 query.      
      
aaaaaaaaaaaaaaaaaaaaaaaa)    where---having---groupby      
bbbbbbbbbbbbbbbbbbbbbbbb)    groupby---where---having      
cccccccccccccccccccccccc)    having---where---groupby      
dddddddddddddddddddddddd)    where---groupby---having      
eeeeeeeeeeeeeeeeeeeeeeee)          
ffffffffffffffffffffffff)          
Correct Answers : d      
108 Question : Consider the following Employee table definition
Fields                                      Data_Type
Emp_ID                                     Number
Emp_Name                               Character
Salary                                       Number
Which of the given SQL Server functions cannot be applied to the Emp_Name column?      
      
gggggggggggggggggggggggg)    SUM      
hhhhhhhhhhhhhhhhhhhhhhhh)    MAX      
iiiiiiiiiiiiiiiiiiiiiiii)    MIN      
jjjjjjjjjjjjjjjjjjjjjjjj)    COUNT      
kkkkkkkkkkkkkkkkkkkkkkkk)          
llllllllllllllllllllllll)          
Correct Answers : a      
109 Question : Read the following query.
Select floor(sal) from Employee Where Emp_Name='John'
What will be the output produced by SQL Server, if the salary present in the database is 80.5?      
      
mmmmmmmmmmmmmmmmmmmmmmmm)    80      
nnnnnnnnnnnnnnnnnnnnnnnn)    81      
oooooooooooooooooooooooo)    79      
pppppppppppppppppppppppp)    ERROR      
qqqqqqqqqqqqqqqqqqqqqqqq)          
rrrrrrrrrrrrrrrrrrrrrrrr)          
Correct Answers : a      
110 Question : Indexing speeds up the processing of a table. It results into some drawbacks if :      
      
ssssssssssssssssssssssss)    A column is used for searching  frequently      
tttttttttttttttttttttttt)    A column is used for sorting the data      
uuuuuuuuuuuuuuuuuuuuuuuu)    The table size is small      
vvvvvvvvvvvvvvvvvvvvvvvv)    The table size is large      
wwwwwwwwwwwwwwwwwwwwwwww)          
xxxxxxxxxxxxxxxxxxxxxxxx)          
Correct Answers : c      
111 Question : By default, the  primary key creates a ______ index.      
      
yyyyyyyyyyyyyyyyyyyyyyyy)    clustered      
zzzzzzzzzzzzzzzzzzzzzzzz)    nonclustered      
aaaaaaaaaaaaaaaaaaaaaaaaa)    composite      
bbbbbbbbbbbbbbbbbbbbbbbbb)          
ccccccccccccccccccccccccc)          
ddddddddddddddddddddddddd)          
Correct Answers : a      
Question : Identify the query used to view the index created on the table?      
      
eeeeeeeeeeeeeeeeeeeeeeeee)    sp_helpindex <table_name>      
fffffffffffffffffffffffff)    sp_index <table_name>      
ggggggggggggggggggggggggg)    index <table_name>      
hhhhhhhhhhhhhhhhhhhhhhhhh)    index_help <table_name>      
iiiiiiiiiiiiiiiiiiiiiiiii)          
jjjjjjjjjjjjjjjjjjjjjjjjj)          
Correct Answers : a      
112 Question : Name the system stored procedure used to display the information about any database objects.      
      
kkkkkkkkkkkkkkkkkkkkkkkkk)    sp_database      
lllllllllllllllllllllllll)    sp_tables      
mmmmmmmmmmmmmmmmmmmmmmmmm)    sp_stored_procedures      
nnnnnnnnnnnnnnnnnnnnnnnnn)    sp_help      
ooooooooooooooooooooooooo)          
ppppppppppppppppppppppppp)          
Correct Answers : d      
113 Question : _______ is the default mode of a Transaction.      
      
qqqqqqqqqqqqqqqqqqqqqqqqq)    Implicit      
rrrrrrrrrrrrrrrrrrrrrrrrr)    Explicit      
sssssssssssssssssssssssss)    Autocommit      
ttttttttttttttttttttttttt)          
uuuuuuuuuuuuuuuuuuuuuuuuu)          
vvvvvvvvvvvvvvvvvvvvvvvvv)          
Correct Answers : c      
114 Question : What happens when the Distinct clause is used with the Avg function?      
      
wwwwwwwwwwwwwwwwwwwwwwwww)    It will calculate the average  of all the values present in the column      
xxxxxxxxxxxxxxxxxxxxxxxxx)    It will calculate the average of only distinct values i.e it will consider only one value for the repeated values.      
yyyyyyyyyyyyyyyyyyyyyyyyy)    It will give an error      
zzzzzzzzzzzzzzzzzzzzzzzzz)          
aaaaaaaaaaaaaaaaaaaaaaaaaa)          
bbbbbbbbbbbbbbbbbbbbbbbbbb)          
Correct Answers : b      
115 Question : Once the table  definition has been  approved by the end user , the database designer can draw the ERD for the tables.      
      
cccccccccccccccccccccccccc)    TRUE      
dddddddddddddddddddddddddd)    FALSE      
eeeeeeeeeeeeeeeeeeeeeeeeee)          
ffffffffffffffffffffffffff)          
gggggggggggggggggggggggggg)          
hhhhhhhhhhhhhhhhhhhhhhhhhh)          
Correct Answers : b      
116 Question : Which of the following property/ies is/are  invalid for triggers?
1.A trigger is applied to one or more tables
2.A trigger can include any number of SQL statements
3.A trigger is associated with create and alter statements                                   
4.We can hide the definition of a trigger from the user      
      
iiiiiiiiiiiiiiiiiiiiiiiiii)    Statement 1      
jjjjjjjjjjjjjjjjjjjjjjjjjj)    Statement 2      
kkkkkkkkkkkkkkkkkkkkkkkkkk)    Statement 3      
llllllllllllllllllllllllll)    Statement 4      
mmmmmmmmmmmmmmmmmmmmmmmmmm)          
nnnnnnnnnnnnnnnnnnnnnnnnnn)          
Correct Answers : a,c      
117 Question : What is the use of Rollup in SQL Server?:      
      
oooooooooooooooooooooooooo)    It is used to display the grand total.      
pppppppppppppppppppppppppp)    It is used to display the subtotals and grand total.      
qqqqqqqqqqqqqqqqqqqqqqqqqq)    It rollbacks the committed data.      
rrrrrrrrrrrrrrrrrrrrrrrrrr)    None of the above      
ssssssssssssssssssssssssss)          
tttttttttttttttttttttttttt)          
Correct Answers : b      
118 Question : Name the function used to get the identification number of the workstation.      
      
uuuuuuuuuuuuuuuuuuuuuuuuuu)    Host_ID()      
vvvvvvvvvvvvvvvvvvvvvvvvvv)    User_ID()      
wwwwwwwwwwwwwwwwwwwwwwwwww)    Object_ID()      
xxxxxxxxxxxxxxxxxxxxxxxxxx)    Suser_ID()      
yyyyyyyyyyyyyyyyyyyyyyyyyy)          
zzzzzzzzzzzzzzzzzzzzzzzzzz)          
Correct Answers : a      
119 Question : The __________ option prevents the user from viewing the text of the trigger.      
      
aaaaaaaaaaaaaaaaaaaaaaaaaaa)    WITH ENCRYPTION      
bbbbbbbbbbbbbbbbbbbbbbbbbbb)    WITH CIPHERTEXT      
ccccccccccccccccccccccccccc)    WITH SECURITY      
ddddddddddddddddddddddddddd)    WITH UNICODE      
eeeeeeeeeeeeeeeeeeeeeeeeeee)          
fffffffffffffffffffffffffff)          
Correct Answers : a      
120 Question : By default, only the owner of the database has the permission to create a trigger. This permission is transferable.      
      
ggggggggggggggggggggggggggg)    TRUE      
hhhhhhhhhhhhhhhhhhhhhhhhhhh)    FALSE      
iiiiiiiiiiiiiiiiiiiiiiiiiii)          
jjjjjjjjjjjjjjjjjjjjjjjjjjj)          
kkkkkkkkkkkkkkkkkkkkkkkkkkk)          
lllllllllllllllllllllllllll)          
Correct Answers : b      
121 Question : Name the system stored procedure used to enable the nesting of triggers.      
      
mmmmmmmmmmmmmmmmmmmmmmmmmmm)    nested_configure      
nnnnnnnnnnnnnnnnnnnnnnnnnnn)    sp_configure      
ooooooooooooooooooooooooooo)    sp_init      
ppppppppppppppppppppppppppp)    sp_start_triggers      
qqqqqqqqqqqqqqqqqqqqqqqqqqq)          
rrrrrrrrrrrrrrrrrrrrrrrrrrr)          
Correct Answers : b      
122 Question : Which of the following statement/s is/are invalid w.r.t triggers?      
      
sssssssssssssssssssssssssss)    A trigger can include any number of SQL statements.      
ttttttttttttttttttttttttttt)    Only an owner of the database can create the trigger.      
uuuuuuuuuuuuuuuuuuuuuuuuuuu)    A trigger can reference a view or a temporary table, but cannot be associated with it.      
vvvvvvvvvvvvvvvvvvvvvvvvvvv)    Trigger permissions are transferable      
wwwwwwwwwwwwwwwwwwwwwwwwwww)    A trigger can be associated with three actions performed on a table, INSERT, UPDATE, and DELETE.      
xxxxxxxxxxxxxxxxxxxxxxxxxxx)    A trigger cannot be used with CREATE DATABASE command.      
Correct Answers : d      
123 Question : What is an index created on two or more columns called?      
      
yyyyyyyyyyyyyyyyyyyyyyyyyyy)    clustered      
zzzzzzzzzzzzzzzzzzzzzzzzzzz)    non clustered      
aaaaaaaaaaaaaaaaaaaaaaaaaaaa)    composite      
bbbbbbbbbbbbbbbbbbbbbbbbbbbb)    mixed      
cccccccccccccccccccccccccccc)          
dddddddddddddddddddddddddddd)          
Correct Answers : c      
124 Question : The global variable @error stores the error number  in SQL Server.      
      
eeeeeeeeeeeeeeeeeeeeeeeeeeee)    TRUE      
ffffffffffffffffffffffffffff)    FALSE      
gggggggggggggggggggggggggggg)          
hhhhhhhhhhhhhhhhhhhhhhhhhhhh)          
iiiiiiiiiiiiiiiiiiiiiiiiiiii)          
jjjjjjjjjjjjjjjjjjjjjjjjjjjj)          
Correct Answers : b      
125 Question : How many clustered indexes  can we have in a table?      
      
kkkkkkkkkkkkkkkkkkkkkkkkkkkk)    1      
llllllllllllllllllllllllllll)    2      
mmmmmmmmmmmmmmmmmmmmmmmmmmmm)    16      
nnnnnnnnnnnnnnnnnnnnnnnnnnnn)    unlimited      
oooooooooooooooooooooooooooo)          
pppppppppppppppppppppppppppp)          
Correct Answers : a      
126 Question : You want the result of the query very fast. Join and subquery will serve your purpose. What you will prefer so that the SQL Server processes the query faster?      
      
qqqqqqqqqqqqqqqqqqqqqqqqqqqq)    Joins      
rrrrrrrrrrrrrrrrrrrrrrrrrrrr)    Subqueries      
ssssssssssssssssssssssssssss)          
tttttttttttttttttttttttttttt)          
uuuuuuuuuuuuuuuuuuuuuuuuuuuu)          
vvvvvvvvvvvvvvvvvvvvvvvvvvvv)          
Correct Answers : a      
127 Question : The following keyword/s cannot be used with Cursors:      
      
wwwwwwwwwwwwwwwwwwwwwwwwwwww)    Read_Only      
xxxxxxxxxxxxxxxxxxxxxxxxxxxx)    Write_Only      
yyyyyyyyyyyyyyyyyyyyyyyyyyyy)    Type_Warning      
zzzzzzzzzzzzzzzzzzzzzzzzzzzz)    Optimistic      
aaaaaaaaaaaaaaaaaaaaaaaaaaaaa)          
bbbbbbbbbbbbbbbbbbbbbbbbbbbbb)          
Correct Answers : b      
128 Question : Which of the following normal forms are based on the multivalue and join dependencies?      
      
ccccccccccccccccccccccccccccc)    First Normal Form      
ddddddddddddddddddddddddddddd)    Second Normal Form      
eeeeeeeeeeeeeeeeeeeeeeeeeeeee)    Third Normal Form      
fffffffffffffffffffffffffffff)    Fourth Normal Form      
ggggggggggggggggggggggggggggg)    Fifth Normal Form      
hhhhhhhhhhhhhhhhhhhhhhhhhhhhh)          
Correct Answers : d,e      
129 Question : Is it possible to decrypt the encrypted triggers?      
      
iiiiiiiiiiiiiiiiiiiiiiiiiiiii)    YES      
jjjjjjjjjjjjjjjjjjjjjjjjjjjjj)    NO      
kkkkkkkkkkkkkkkkkkkkkkkkkkkkk)          
lllllllllllllllllllllllllllll)          
mmmmmmmmmmmmmmmmmmmmmmmmmmmmm)          
nnnnnnnnnnnnnnnnnnnnnnnnnnnnn)          
Correct Answers : b      
130 Question : Identify the co-related query.      
      
ooooooooooooooooooooooooooooo)    SELECT city FROM suppliers WHERE supplierid IN (SELECT supplierid FROM products WHERE suppliers.supplierid=products.supplierid)      
ppppppppppppppppppppppppppppp)    SELECT orderid FROM order_details WHERE productid IN ( SELECT productid FROM products)      
qqqqqqqqqqqqqqqqqqqqqqqqqqqqq)    SELECT Account_No, Name FROM Saving_Accounts
rrrrrrrrrrrrrrrrrrrrrrrrrrrrr)      UNION
sssssssssssssssssssssssssssss)    SELECT Account_No, Name FROM Current_Accounts
ttttttttttttttttttttttttttttt)          
uuuuuuuuuuuuuuuuuuuuuuuuuuuuu)    SELECT * FROM authors WHERE city='Salt Lake city'      
vvvvvvvvvvvvvvvvvvvvvvvvvvvvv)          
wwwwwwwwwwwwwwwwwwwwwwwwwwwww)          
Correct Answers : a      
131 Question : Which one of the following takes parameters from its parent query?      
      
xxxxxxxxxxxxxxxxxxxxxxxxxxxxx)    Correlated subquery      
yyyyyyyyyyyyyyyyyyyyyyyyyyyyy)    Nested subquery      
zzzzzzzzzzzzzzzzzzzzzzzzzzzzz)    Plain subquery      
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)    Join subquery      
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb)          
cccccccccccccccccccccccccccccc)          
Correct Answers : a      
132 Question : Following are the valid date functions in SQL Server.      
      
dddddddddddddddddddddddddddddd)    GETDATE()      
eeeeeeeeeeeeeeeeeeeeeeeeeeeeee)    DATEADD()      
ffffffffffffffffffffffffffffff)    DATEDIFF()      
gggggggggggggggggggggggggggggg)    DATENAME()      
hhhhhhhhhhhhhhhhhhhhhhhhhhhhhh)    DATEPART()      
iiiiiiiiiiiiiiiiiiiiiiiiiiiiii)    all of the above      
Correct Answers : f      
133 Question : When a CHECK constraint is added to an existing table, the CHECK constraint by default is applied to existing data as well as new data.      
      
jjjjjjjjjjjjjjjjjjjjjjjjjjjjjj)    TRUE      
kkkkkkkkkkkkkkkkkkkkkkkkkkkkkk)    FALSE      
llllllllllllllllllllllllllllll)          
mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm)          
nnnnnnnnnnnnnnnnnnnnnnnnnnnnnn)          
oooooooooooooooooooooooooooooo)          
Correct Answers : a      
134 Question : Following mechanisms are provided by SQL Server 2000 for entity integrity?      
      
pppppppppppppppppppppppppppppp)    Primary Key      
qqqqqqqqqqqqqqqqqqqqqqqqqqqqqq)    Unique Key      
rrrrrrrrrrrrrrrrrrrrrrrrrrrrrr)    Foreign Key      
ssssssssssssssssssssssssssssss)    Identity Property      
tttttttttttttttttttttttttttttt)    Check Key      
uuuuuuuuuuuuuuuuuuuuuuuuuuuuuu)    Default Key      
Correct Answers : a,b,d      
135 Question : You want to delete all the rows of an Employee table. This should be done without using much system and transaction log resources. Which command will you use?      
      
vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv)    Truncate      
wwwwwwwwwwwwwwwwwwwwwwwwwwwwww)    Delete      
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx)    Drop      
yyyyyyyyyyyyyyyyyyyyyyyyyyyyyy)    We can use any of he commands provided by SQL Server for deleting the records. All the commands have same performance w.r.t to the usage of log resources.      
zzzzzzzzzzzzzzzzzzzzzzzzzzzzzz)          
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)          
Correct Answers : a      
136 Question : You want to view the highest paid employee in all the departments. What Keyword will you use in the query?      
      
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb)    UNION      
ccccccccccccccccccccccccccccccc)    INTERSECT      
ddddddddddddddddddddddddddddddd)    GROUP BY      
eeeeeeeeeeeeeeeeeeeeeeeeeeeeeee)    ORDERBY      
fffffffffffffffffffffffffffffff)    IN      
ggggggggggggggggggggggggggggggg)    HAVING      
Correct Answers : c      
137 Question : Identify the valid query for viewing only those records wherein the customers have a phone number.      
      
hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh)    SELECT * from customer where phone IS NOT NULL      
iiiiiiiiiiiiiiiiiiiiiiiiiiiiiii)    SELECT * from customer where phone = NOT NULL      
jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj)    SELECT * from customer where phone NOT NULL      
kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk)    SELECT * from customer where HAVING phone NOT NULL      
lllllllllllllllllllllllllllllll)          
mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm)          
Correct Answers : a      
138 Question : State the use of the AS clause in a SQL query?      
      
nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn)    It is used to change the name of a resultset  column      
ooooooooooooooooooooooooooooooo)    It is used to assign a name to a derived column.      
ppppppppppppppppppppppppppppppp)    It is used with the scalar function in SQL for calculating large equations.      
qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq)    It is used with the Group By clause to give  the name to the last result set.      
rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr)          
sssssssssssssssssssssssssssssss)          
Correct Answers : a,b      
139 Question : ________  includes all the rows from atleast one table, provided they match the specified conditions.      
      
ttttttttttttttttttttttttttttttt)    Inner Join      
uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu)    Outer Join      
vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv)    Self Join      
wwwwwwwwwwwwwwwwwwwwwwwwwwwwwww)          
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx)          
yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy)          
Correct Answers : b      
140 Question : Statement 1: Indexed view is supported only by SQL Server Enterprise Edition.
Statement 2: Indexed views improve the performance of complex queries.      
      
zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz)    Only Statement 1 is true      
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)    Only Statement 2 is true      
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb)    Both the statements are true      
cccccccccccccccccccccccccccccccc)    Both the statements are false      
dddddddddddddddddddddddddddddddd)          
eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee)          
Correct Answers : c      
141 Question : Partitioning columns in Views, existing on each member table must follow the given rules:      
      
ffffffffffffffffffffffffffffffff)    The partitioning columns should not contain NULL value.      
gggggggggggggggggggggggggggggggg)    Partitioning columns must be a part of the primary key of the table.      
hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh)    Computed columns cannot be used for partitioning.      
iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii)    You should have only two constraints on the partitioning columns      
jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj)          
kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk)          
Correct Answers : a,b,c      
142 Question : Identify the INVALID option/s with respect to the SCROLL attribute of a CURSOR?      
      
llllllllllllllllllllllllllllllll)    FIRST      
mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm)    LAST      
nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn)    PRIOR      
oooooooooooooooooooooooooooooooo)    NEX``T      
pppppppppppppppppppppppppppppppp)    RELATIVE      
qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq)    PREVIOUS      
Correct Answers : f      
143 Question : The________ attribute of a CURSOR specifies the order of the rows.      
      
rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr)    KEYSET      
ssssssssssssssssssssssssssssssss)    DYNAMIC      
tttttttttttttttttttttttttttttttt)    OPTIMISTIC      
uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu)    RESULTSET      
vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv)    STATIC      
wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww)          
Correct Answers : a      
144 Question : Unions combine columns from multiple data tables.      
      
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx)    TRUE      
yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy)    FALSE      
zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz)          
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)          
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb)          
ccccccccccccccccccccccccccccccccc)          
Correct Answers : b      
145 Question : An ___________ transaction defines the start as well as the end of a transaction.      
      
ddddddddddddddddddddddddddddddddd)    Explicit      
eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee)    Implicit      
fffffffffffffffffffffffffffffffff)    Autocommit      
ggggggggggggggggggggggggggggggggg)          
hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh)          
iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii)          
Correct Answers : a      
146 Question : Which type of isolation level ensures that some other transaction does not update the data?      
      
jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj)    Read Uncommitted      
kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk)    Read Committed      
lllllllllllllllllllllllllllllllll)    Repeatable Read      
mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm)    Read transaction      
nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn)          
ooooooooooooooooooooooooooooooooo)          
Correct Answers : c      
147 Question : Once the transaction is committed, it cannot be rolled back.      
      
ppppppppppppppppppppppppppppppppp)    TRUE      
qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq)    FALSE      
rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr)          
sssssssssssssssssssssssssssssssss)          
ttttttttttttttttttttttttttttttttt)          
uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu)          
Correct Answers : a      
148 Question : What is the use of locking in SQL Server 2000?      
      
vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv)    It is used for transactional integrity      
wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww)    It is used for  database consistency.      
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx)    It is used to increase the capability, for transaction recovery.      
yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy)          
zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz)          
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)          
Correct Answers : a,b      
149 Question : Which type of locks should be used for read-only operations?      
      
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb)    Pessimistic Lock      
cccccccccccccccccccccccccccccccccc)    Update Locks      
dddddddddddddddddddddddddddddddddd)    Exclusive Locks      
eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee)    Shared Locks      
ffffffffffffffffffffffffffffffffff)          
gggggggggggggggggggggggggggggggggg)          
Correct Answers : d      
150 Question : Which type of lock ensures that multiple updates cannot be made to the same resource simultaneously?      
      
hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh)    Exclusive Locks      
iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii)    Optimistic Lock      
jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj)    Update Locks      
kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk)    Exclusive Locks      
llllllllllllllllllllllllllllllllll)          
mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm)          
Correct Answers : d      
151 Question : No other transaction can read or modify data locked with an exclusive lock.      
      
nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn)    TRUE      
oooooooooooooooooooooooooooooooooo)    FALSE      
pppppppppppppppppppppppppppppppppp)          
qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq)          
rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr)          
ssssssssssssssssssssssssssssssssss)          
Correct Answers : a      
152 Question : Which type of locks help to avoid deadlock problem?      
      
tttttttttttttttttttttttttttttttttt)    Update Locks      
uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu)    Exclusive Locks      
vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv)    Shared Locks      
wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww)    Optimistic Lock      
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx)          
yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy)          
Correct Answers : a      
153 Question : In the syntax given below,
SET DEADLOCK_PRIORITY { LOW | NORMAL | @deadlock_var }
@deadlock_var is a character variable which specifies :      
      
zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz)    The deadlock-handling method      
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)    A deadlock situation      
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb)    The session is returned to the default deadlock-handling method      
ccccccccccccccccccccccccccccccccccc)    None of the above      
ddddddddddddddddddddddddddddddddddd)          
eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee)          
Correct Answers : a      
154 Question : Which Statement is used to throw away all the changes since the most recent transaction statement?      
      
fffffffffffffffffffffffffffffffffff)    COMMIT TRANSACTION      
ggggggggggggggggggggggggggggggggggg)    ROLLBACK TRANSACTION      
hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh)    BEGIN TRANSACTION      
iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii)    SAVE TRANSACTION      
jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj)          
kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk)          
Correct Answers : b      
155 Question : Which statement is used in SQL Server to indicate that the most recent transaction you started is marked as ready to be saved?      
      
lllllllllllllllllllllllllllllllllll)    COMMIT TRANSACTION      
mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm)    ROLLBACK TRANSACTION      
nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn)    BEGIN TRANSACTION      
ooooooooooooooooooooooooooooooooooo)    SAVE TRANSACTION      
ppppppppppppppppppppppppppppppppppp)          
qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq)          
Correct Answers : c      
156 Question : The process of refining a database design to ensure data consistency and reduce duplication is known as ___________.      
      
rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr)    Normalization      
sssssssssssssssssssssssssssssssssss)    Data Modeling      
ttttttttttttttttttttttttttttttttttt)    Data Optimizing      
uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu)          
vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv)          
wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww)          
Correct Answers : a      
157 Question : You have to define a database to control projects and reports at your college. Each student works with a project team which produces a project report. Identify the relationship between the Student and the Project?      
      
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx)    One-to-One      
yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy)    Many-to-Many      
zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz)    One-to-Many      
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)    Many-to-One      
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb)          
cccccccccccccccccccccccccccccccccccc)          
Correct Answers : b      
158 Question : You must ensure that each row in a table is uniquely identified. What type of constraint/s should you implement and what does it enforce?
      
      
dddddddddddddddddddddddddddddddddddd)    Referential integrity      
eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee)    Domain integrity      
ffffffffffffffffffffffffffffffffffff)    Entity integrity      
gggggggggggggggggggggggggggggggggggg)    Foreign key constraint      
hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh)    Primary key constraint      
iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii)    Check constraint      
Correct Answers : c,e      
159 Question : Which of the following describes a SQL Server batch?      
      
jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj)    Executed in a single transaction.      
kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk)    Compiled into a single unit.      
llllllllllllllllllllllllllllllllllll)    Executed as individual statements.      
mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm)    Compiled as individual statements.      
nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn)    Executed as a single unit.      
oooooooooooooooooooooooooooooooooooo)    A group of SQL statements.      
Correct Answers : b,c,f      
160 Question : Entity integrity is enforced by unique indexes because a unique value exists in each column.      
      
pppppppppppppppppppppppppppppppppppp)    TRUE      
qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq)    FALSE      
rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr)          
ssssssssssssssssssssssssssssssssssss)          
tttttttttttttttttttttttttttttttttttt)          
uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu)          
Correct Answers : b      
161 Question : Refer to these statements:
SELECT product_id FROM inventories
INTERSECT
SELECT product_id FROM order_items;
Which of the following is true?      
      
vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv)    There are syntax errors      
wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww)    Only distinct rows that appear in either result are returned      
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx)    All rows in the results are returned      
yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy)    Only those rows returned by both the queries are returned.      
zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz)          
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)          
Correct Answers : d      
162 Question : Which of the following statement/s with respect to Explicit Transactions? is/are NOT TRUE      
      
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb)    Explicit transactions are manually configured transactions.      
ccccccccccccccccccccccccccccccccccccc)    Explicit transactions last only for the duration of the transaction.      
ddddddddddddddddddddddddddddddddddddd)    Explicit transactions are started by SQL Server      
eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee)          
fffffffffffffffffffffffffffffffffffff)          
ggggggggggggggggggggggggggggggggggggg)          
Correct Answers : c      
163 Question : The order and number of columns in a composite index affect query performance      
      
hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh)    TRUE      
iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii)    FALSE      
jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj)          
kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk)          
lllllllllllllllllllllllllllllllllllll)          
mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm)          
Correct Answers : a      
164 Question : Which one of the following variables is used to specify the number of milliseconds the system has been processing since SQL Server was started?      
      
nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn)    @@FETCH_STATUS      
ooooooooooooooooooooooooooooooooooooo)    @@CPU_BUSY      
ppppppppppppppppppppppppppppppppppppp)    @@MAX_CONNECTIONS      
qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq)          
rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr)          
sssssssssssssssssssssssssssssssssssss)          
Correct Answers : b      
165 Question : Following are the types of T-SQL functions.      
      
ttttttttttttttttttttttttttttttttttttt)    Scalar functions      
uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu)    Linear functions      
vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv)    Aggregate functions      
wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww)    Rowset functions      
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx)          
yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy)          
Correct Answers : a,c,d      
166 Question : Expression statements are applied in __________ system functions.      
      
zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz)    Scalar      
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)    Aggregate      
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb)    Rowset      
cccccccccccccccccccccccccccccccccccccc)          
dddddddddddddddddddddddddddddddddddddd)          
eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee)          
Correct Answers : a      
167 Question : Which of the following system function is used to retrieve the User’s login identification name?      
      
ffffffffffffffffffffffffffffffffffffff)    SUSER_NAME([server_user_id])      
gggggggggggggggggggggggggggggggggggggg)    USER_NAME([user_id])      
hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh)    HOST_NAME()      
iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii)    DB_NAME([database_id])      
jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj)          
kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk)          
Correct Answers : a      
168 Question : Joe is working on a Library project. He is designing a database for the required system. The system will perform the shifting of records very frequently. Which one of the following SQL statements will you advise him to use?      
      
llllllllllllllllllllllllllllllllllllll)    DQL      
mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm)    DML      
nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn)    DCL      
oooooooooooooooooooooooooooooooooooooo)    DDL      
pppppppppppppppppppppppppppppppppppppp)    CCL      
qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq)          
Correct Answers : e      
169 Question : Which of the following database file/s is/are always present in the database?      
      
rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr)    Primary data files      
ssssssssssssssssssssssssssssssssssssss)    Secondary data files      
tttttttttttttttttttttttttttttttttttttt)    Log files      
uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu)    Command data files      
vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv)          
wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww)          
Correct Answers : a,c      
170 Question : Which one of the following is a valid command for shrinking the size of a database ?      
      
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx)    DBCC SHRINKDATABASE(PUBS, 10)      
yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy)    DB SHRINKDATABASE(PUBS, 10)      
zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz)    DBCC SHRINK(PUBS, 10)      
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)    DBCC SHRINKDATABASE(PUBS,TEMP, 10)      
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb)          
ccccccccccccccccccccccccccccccccccccccc)          
Correct Answers : a