Sunday, September 15, 2013

SQL Server MCQ Test – 4


Que.1. Which of the following prevent "Dirty Reads"?

A:        Read commited
B:        Read Uncommitted
C:        Repeatable Read
D:        Serializable

Right Answer : C

Que.2. A filtered index is an optimized non-clustered index

A:        False
B:        True

Right Answer : B

Que.3. ___________ enables the DBA for managing the work load of SQL Server and critical system resource consumption

A:        SQL manager
B:        SQL profiler
C:        Resource Governor
D:        Resource manager

Right Answer : C

Que.4. Which join combines all rows from both tables?

A:        Inner Join
B:        Left Outer Join
C:        Right Outer Join
D:        Cross Join

Right Answer : D

Que.5. SQL Server 2008 supports two types of compression. Which of the following below are they?

A:        Row level and column level
B:        Row level and page level

Right Answer : B

Que.6. ______________ Allows you to provide the full path to a template.

A:        Trace file name
B:        Trace file path
C:        Template name
D:        Trace name

Right Answer : A

Que.7. Which of the following is the default isolation level in SQL Server?

A:        Read Committed
B:        Read Uncommitted
C:        Repeatable Read
D:        Serializable

Right Answer : A

Que.8. An index can be defined for a single column

A:        True
B:        False

Right Answer : A

Que.9. For every unique constraint on a column, SQL server will create

A:        Does not create any index
B:        clustered index for that column
C:        index for that column
D:        non-clustered index for that column

Right Answer : D

Que.10. Which of the following below are Compound Operators in sql server 2008

A:        +=
B:        %=
C:        *=
D:        all of above

Right Answer : D

Que.11. Which of the following commands below are used to run a stored procedure?

A:        EXEC MyStoredProcedure
B:        EXECUTE MyStoredProcedure
C:        RUN MyStoredProcedure
D:        Both a and b above

Right Answer : D

Que.12. A database schema is a way to logically group objects such as tables,rows, views, stored procedures etc.

A:        True
B:        False

Right Answer : B

Que.13. What is a MULTI_USER in sql server?

A:        users that have the appropriate permissions to connect to the database are allowed
B:        One user at a time is allowed to connect to the database
C:        Only some members are allowed to access the database
D:        Only the system admin and some members are allowed to access the database

Right Answer : A

Que.14. ____________ is a set of graphical tools that allows you to transfer data between disparate sources into one or more destinations.

A:        Data Transfer Services
B:        Data Transformation Services
C:        Data Disperse Services
D:        Data transform Services

Right Answer : B

Que.15. Which of the following below are capabilities of SQL Server Integration Services (SSIS)?

A:        integrate smoothly with other applications and data sources.
B:        copy or download files
C:        ALL
D:        send e-mail messages in response to events

Right Answer : C

Que.16. Why type of user is the default in sql server?

A:        SINGLE_USER
B:        MULTI_USER
C:        RESTRICTED_USER
D:        ROOT_USER

Right Answer : B

Que.17. Issuing ___________ will cause the named savepoint to be discarded

A:        TRUNCATE SAVEPOINT
B:        DELETE SAVEPOINT
C:        DISCARD SAVEPOINT
D:        RELEASE SAVEPOINT

Right Answer : D

Que.18. DTS Run utility is used for

A:        run DTS packages from the command prompt
B:        transfer data to and from a SQL Server database
C:        schedule and run a DTS package.
D:        both a and b above

Right Answer : C

Que.19. Which of the following below are valid database states?

A:        OFFLINE
B:        SUSPECT
C:        EMERGENCY
D:        All choices are correct.

Right Answer : D

Que.20. In which type of cursor, the key values of the rows are saved in tempdb?

A:        Static
B:        Keyset
C:        Dynamic
D:        Forward_only

Right Answer : B

C MCQ Test - 4


Que.1. Which of the following is correct about err used in the declaration given below?
 typedef enum error { warning, test, exception } err;

A:        It is a typedef for enum error.
B:         It is a variable of type enum error.
C:         The statement is erroneous.
D:        It is a structure.

Right Answer : A

Que.2. Point out the error in the following program.
#include<stdio.h>
int main()
{
    void v = 0;

    printf("%d", v);

    return 0;
}

A:        Error: Declaration syntax error 'v' (or) Size of v is unknown or zero.
B:         Program terminates abnormally.
C:         No error.
D:        None of these.

Right Answer : A

Que.3. What will be the output of the program?
#include<stdio.h>
int main()
{
    int X=40;
    {
        int X=20;
        printf("%d ", X);
    }
    printf("%d\n", X);
    return 0;
}

A:        40 40
B:         20 40
C:         20
D:        Error

Right Answer : B

Que.4. Point out the error in the following program.
#include<stdio.h>
struct emp
{
    char name[20];
    int age;
};
int main()
{
    emp int xx;
    int a;
    printf("%d\n", &a);
    return 0;
}

A:        Error: in printf
B:         Error: in emp int xx;
C:         No error.
D:        None of these.

Right Answer : B

Que.5. What will be the output of the program?
#include<stdio.h>
void fun(int*, int*);
int main()
{
    int i=5, j=2;
    fun(&i, &j);
    printf("%d, %d", i, j);
    return 0;
}
void fun(int *i, int *j)
{
    *i = *i**i;
    *j = *j**j;
}

A:        5, 2
B:         25, 4
C:         10, 4
D:        2, 5

Right Answer : B

Que.6. What is the output of the program?

#include<stdio.h>
int main()
{
    union a
    {
        int i;
        char ch[2];
    };
    union a u;
    u.ch[0] = 3;
    u.ch[1] = 2;
    printf("%d, %d, %d\n", u.ch[0], u.ch[1], u.i);
    return 0;
}

A:        3, 2, 515
B:         515, 2, 3
C:         3, 2, 5
D:        None of these

Right Answer : A

Que.7. Point out the error in the following program (if it is compiled with Turbo C compiler).
#include<stdio.h>
int main()
{
    display();
    return 0;
}
void display()
{
    printf("iExamCenter.com");
}

A:        No error
B:         display() doesn't get invoked
C:         display() is called before it is defined
D:        None of these

Right Answer : C

Que.8. Which of the following statement is correct prototype of the malloc() function in c ?

A:        int* malloc(int);
B:         char* malloc(char);
C:         unsigned int* malloc(unsigned int);
D:        void* malloc(size_t);

Right Answer : D

Que.9. Point out the correct statement will let you access the elements of the array using 'p' in the following program?
#include<stdio.h>
#include<stdlib.h>

int main()
{
    int i, j;
    int(*p)[3];
    p = (int(*)[3])malloc(3*sizeof(*p));
    return 0;
}

A:        for(i=0; i<3; i++)
{
    for(j=0; j<3; j++)
        printf("%d", p[i+j]);
}
B:         for(i=0; i<3; i++)
    printf("%d", p[i]);
C:         for(i=0; i<3; i++)
{
    for(j=0; j<3; j++)
        printf("%d", p[i][j]);
}
D:        for(j=0; j<3; j++)
    printf("%d", p[i][j]);

Right Answer : C

Que.10. In the following program how long will the for loop get executed?
#include<stdio.h>
int main()
{
    int i=5;
    for(;scanf("%s", &i); printf("%d\n", i));
    return 0;
}

A:        The for loop would not get executed at all
B:         The for loop would get executed only once
C:         The for loop would get executed 5 times
D:        The for loop would get executed infinite times

Right Answer : D

Que.11. What is the output of the program in Turbo C (in DOS 16-bit OS)?

#include<stdio.h>
int main()
{
    char *s1;
    char far *s2;
    char huge *s3;
    printf("%d, %d, %d\n", sizeof(s1), sizeof(s2), sizeof(s3));
    return 0;
}

A:        2, 4, 6
B:         4, 4, 2
C:         2, 4, 4
D:        2, 2, 2

Right Answer : C

Que.12. What is the output of the program

#include<stdio.h>
int main()
{
    int x = 10, y = 20, z = 5, i;
    i = x < y < z;
    printf("%d\n", i);
    return 0;
}

A:        0
B:         1
C:         Error
D:        None of these

Right Answer : B

Que.13. What is the output of the program

#include<stdio.h>
int main()
{
    struct emp
    {
        char name[20];
        int age;
        float sal;
    };
    struct emp e = {"Tiger"};
    printf("%d, %f\n", e.age, e.sal);
    return 0;
}

A:        0, 0.000000
B:         Garbage values
C:         Error
D:        None of above

Right Answer : A

Que.14. Point out the correct statement which correctly allocates memory dynamically for 2D array following program?
#include<stdio.h>
#include<stdlib.h>

int main()
{
    int *p, i, j;
    /* Add statement here */
    for(i=0; i<3; i++)
    {
        for(j=0; j<4; j++)
        {
            p[i*4+j] = i;
            printf("%d", p[i*4+j]);
        }
    }
    return 0;
}

A:        p = (int*) malloc(3, 4);
B:         p = (int*) malloc(3*sizeof(int));
C:         p = malloc(3*4*sizeof(int));
D:        p = (int*) malloc(3*4*sizeof(int));

Right Answer : D

Que.15. What is the output of the program

#include<stdio.h>
int main()
{
    extern int fun(float);
    int a;
    a = fun(3.14);
    printf("%d\n", a);
    return 0;
}
int fun(int aa)
{
    return (int)++aa;
}

A:        3
B:         0
C:         Compile Error
D:        4

Right Answer : C

Que.16. Point out the correct statement which correctly free the memory pointed to by 's' and 'p' in the following program?
#include<stdio.h>
#include<stdlib.h>

int main()
{
    struct ex
    {
        int i;
        float j;
        char *s
    };
    struct ex *p;
    p = (struct ex *)malloc(sizeof(struct ex));
    p->s = (char*)malloc(20);
    return 0;
}

A:        free(p); , free(p->s);
B:         free(p->s); , free(p);
C:         free(p->s);
D:        free(p);

Right Answer : B

Que.17. What will be the output of the program?

#include<stdio.h>
int X=40;
int main()
{
    int X=20;
    printf("%d\n", X);
    return 0;
}

A:        20
B:         40
C:         Error
D:        No Output

Right Answer : A

Que.18. What will be the output of the program?
#include<stdio.h>
#define SQUARE(x) x*x

int main()
{
    float s=10, u=30, t=2, a;
    a = 2*(s-u*t)/SQUARE(t);
    printf("Result = %f", a);
    return 0;
}

A:        Result = -100.000000
B:         Result = -25.000000
C:         Result = 0.000000
D:        Result = 100.000000

Right Answer : A

Que.19. What will be the output of the program?
#include<stdio.h>
#define MAN(x, y) ((x)>(y)) ? (x):(y);

int main()
{
    int i=10, j=5, k=0;
    k = MAN(++i, j++);
    printf("%d, %d, %d\n", i, j, k);
    return 0;
}

A:        12, 6, 12
B:         11, 5, 11
C:         11, 5, Garbage
D:        12, 6, Garbage

Right Answer : A

Que.20. What is the output of the program?

#include<stdio.h>
int main()
{
    extern int a;
    printf("%d\n", a);
    return 0;
}
int a=20;

A:        20
B:         0
C:         Garbage Value
D:        Error

Right Answer : A