Firstsource Sample Programming Placement Paper Level1

download Firstsource Sample Programming Placement Paper Level1

of 12

Transcript of Firstsource Sample Programming Placement Paper Level1

  • 7/29/2019 Firstsource Sample Programming Placement Paper Level1

    1/12

    Visitwww.latestoffcampus.com for placement papers, interview tips & job updates. Toget

    freeupdates tomailhttps://groups.google.com/group/latestoffcampusLive updates on Facebook @

    https://www.facebook.com/LatestOffCampus

    Visitwww.latestoffcampus.com for placement papers, interview tips & job updates. Toget

    freeupdates tomailhttps://groups.google.com/group/latestoffcampusLive updates on Facebook @

    https://www.facebook.com/LatestOffCampus

    TITLE:Firstsource Sample Programming Placement Paper Level1

    (Bolded option is your answer)

    1.Is there any difference between following declarations?

    1 : extern int fun();

    2 : int fun();

    A Both are

    identical

    B No difference,

    except extern

    int fun(); is

    probably in

    another file

    C int fun(); is

    overrided with

    extern int fun();

    D None of these

    2.In the following program where is the variable a getting defined andwhere it is getting declared?

    #include

    int main()

    {

    extern int a;

    printf("%d\n", a);

    return 0;}

    int a=20;

    A extern int a is

    declaration, int

    a = 20 is the

    definition

    B int a = 20 is

    declaration,

    extern int a is

    the definition

    C int a = 20 is

    definition, a is

    not defined

    D a is declared,

    a is not defined

    3.If the binary eauivalent of 5.375 in normalised form is 0100 0000

    1010 1100 0000 0000 0000 0000, what will be the output of theprogram (on intel machine)?

    #include

    http://www.latestoffcampus.com/http://www.latestoffcampus.com/http://www.latestoffcampus.com/https://groups.google.com/group/latestoffcampushttps://groups.google.com/group/latestoffcampushttps://www.facebook.com/LatestOffCampushttps://www.facebook.com/LatestOffCampushttp://www.latestoffcampus.com/http://www.latestoffcampus.com/http://www.latestoffcampus.com/https://groups.google.com/group/latestoffcampushttps://groups.google.com/group/latestoffcampushttps://www.facebook.com/LatestOffCampushttps://www.facebook.com/LatestOffCampushttps://www.facebook.com/LatestOffCampushttps://groups.google.com/group/latestoffcampushttp://www.latestoffcampus.com/https://www.facebook.com/LatestOffCampushttps://groups.google.com/group/latestoffcampushttp://www.latestoffcampus.com/
  • 7/29/2019 Firstsource Sample Programming Placement Paper Level1

    2/12

    Visitwww.latestoffcampus.com for placement papers, interview tips & job updates. Toget

    freeupdates tomailhttps://groups.google.com/group/latestoffcampusLive updates on Facebook @

    https://www.facebook.com/LatestOffCampus

    Visitwww.latestoffcampus.com for placement papers, interview tips & job updates. Toget

    freeupdates tomailhttps://groups.google.com/group/latestoffcampusLive updates on Facebook @

    https://www.facebook.com/LatestOffCampus

    #include

    int main()

    {

    float a=5.375;

    char *p;

    int i;

    p = (char*)&a;

    for(i=0; i

  • 7/29/2019 Firstsource Sample Programming Placement Paper Level1

    3/12

    Visitwww.latestoffcampus.com for placement papers, interview tips & job updates. Toget

    freeupdates tomailhttps://groups.google.com/group/latestoffcampusLive updates on Facebook @

    https://www.facebook.com/LatestOffCampus

    Visitwww.latestoffcampus.com for placement papers, interview tips & job updates. Toget

    freeupdates tomailhttps://groups.google.com/group/latestoffcampusLive updates on Facebook @

    https://www.facebook.com/LatestOffCampus

    6.Which of the following statement obtains the remainder on dividing

    5.5 by 1.3 ?

    A rem = (5.5 %1.3) B rem =modf(5.5, 1.3) C rem =fmod(5.5, 1.3) D Error: wecan't divide

    7.How will you free the allocated memory ?

    A remove(var-

    name);

    B free(var-

    name);

    C delete(var-

    name);

    D dalloc(var-

    name);

    8.How will you free the memory allocated by the following program?

    #include

    #include

    #define MAXROW 3

    #define MAXCOL 4

    int main()

    {

    int **p, i, j;p = (int **) malloc(MAXROW * sizeof(int*));

    return 0;

    }

    A memfree(int

    p);

    B dealloc(p); C malloc(p, 0); D free(p);

    9.Specify the 2 library functions to dynamically allocate memory?

    A malloc() and

    memalloc()

    B alloc() and

    memalloc()

    C malloc() and

    calloc()

    D memalloc()

    and faralloc()

    10.How many times "IndiaBIX" is get printed?

    http://www.latestoffcampus.com/http://www.latestoffcampus.com/http://www.latestoffcampus.com/https://groups.google.com/group/latestoffcampushttps://groups.google.com/group/latestoffcampushttps://www.facebook.com/LatestOffCampushttps://www.facebook.com/LatestOffCampushttp://www.latestoffcampus.com/http://www.latestoffcampus.com/http://www.latestoffcampus.com/https://groups.google.com/group/latestoffcampushttps://groups.google.com/group/latestoffcampushttps://www.facebook.com/LatestOffCampushttps://www.facebook.com/LatestOffCampushttps://www.facebook.com/LatestOffCampushttps://groups.google.com/group/latestoffcampushttp://www.latestoffcampus.com/https://www.facebook.com/LatestOffCampushttps://groups.google.com/group/latestoffcampushttp://www.latestoffcampus.com/
  • 7/29/2019 Firstsource Sample Programming Placement Paper Level1

    4/12

    Visitwww.latestoffcampus.com for placement papers, interview tips & job updates. Toget

    freeupdates tomailhttps://groups.google.com/group/latestoffcampusLive updates on Facebook @

    https://www.facebook.com/LatestOffCampus

    Visitwww.latestoffcampus.com for placement papers, interview tips & job updates. Toget

    freeupdates tomailhttps://groups.google.com/group/latestoffcampusLive updates on Facebook @

    https://www.facebook.com/LatestOffCampus

    #include

    int main()

    {

    int x;

    for(x=-1; x

  • 7/29/2019 Firstsource Sample Programming Placement Paper Level1

    5/12

    Visitwww.latestoffcampus.com for placement papers, interview tips & job updates. Toget

    freeupdates tomailhttps://groups.google.com/group/latestoffcampusLive updates on Facebook @

    https://www.facebook.com/LatestOffCampus

    Visitwww.latestoffcampus.com for placement papers, interview tips & job updates. Toget

    freeupdates tomailhttps://groups.google.com/group/latestoffcampusLive updates on Facebook @

    https://www.facebook.com/LatestOffCampus

    A Infinite times B 255 times C 256 times D 254 times

    12.How many times the program will print "IndiaBIX" ?

    #include

    int main()

    {

    printf("IndiaBIX");

    main();

    return 0;}

    A Infinite times B 32767 times C 65535 times D Till stack

    overflows

    13.What does the following declaration mean?

    int (*ptr)[10];

    A ptr is array of

    pointers to 10

    integers

    B ptr is a pointer

    to an array of 10

    integers

    C ptr is an array

    of 10 integers

    D ptr is an

    pointer to array

    14.What is the purpose of "rb" in fopen() function used below in the

    code?

    FILE *fp;

    fp = fopen("source.txt", "rb");

    A open

    "source.txt" inbinary mode for

    reading

    B open

    "source.txt" inbinary mode for

    reading and

    writing

    C Create a new

    file "source.txt"for reading and

    writing

    D None of

    above

    http://www.latestoffcampus.com/http://www.latestoffcampus.com/http://www.latestoffcampus.com/https://groups.google.com/group/latestoffcampushttps://groups.google.com/group/latestoffcampushttps://www.facebook.com/LatestOffCampushttps://www.facebook.com/LatestOffCampushttp://www.latestoffcampus.com/http://www.latestoffcampus.com/http://www.latestoffcampus.com/https://groups.google.com/group/latestoffcampushttps://groups.google.com/group/latestoffcampushttps://www.facebook.com/LatestOffCampushttps://www.facebook.com/LatestOffCampushttps://www.facebook.com/LatestOffCampushttps://groups.google.com/group/latestoffcampushttp://www.latestoffcampus.com/https://www.facebook.com/LatestOffCampushttps://groups.google.com/group/latestoffcampushttp://www.latestoffcampus.com/
  • 7/29/2019 Firstsource Sample Programming Placement Paper Level1

    6/12

    Visitwww.latestoffcampus.com for placement papers, interview tips & job updates. Toget

    freeupdates tomailhttps://groups.google.com/group/latestoffcampusLive updates on Facebook @

    https://www.facebook.com/LatestOffCampus

    Visitwww.latestoffcampus.com for placement papers, interview tips & job updates. Toget

    freeupdates tomailhttps://groups.google.com/group/latestoffcampusLive updates on Facebook @

    https://www.facebook.com/LatestOffCampus

    15.Which of the following operations can be performed on the file

    "NOTES.TXT" using the below code?

    FILE *fp;

    fp = fopen("NOTES.TXT", "r+");

    A Reading B Writing C Appending D Read and

    Write

    16.To print out a and b given below, which of the following printf()

    statement will you use?

    #include

    float a=3.14;

    double b=3.14;

    A printf("%f

    %lf", a, b);

    B printf("%Lf

    %f", a, b);

    C printf("%Lf

    %Lf", a, b);

    D printf("%f

    %Lf", a, b);

    17.Which files will get closed through the fclose() in the following

    program?

    #include

    int main()

    {

    FILE *fs, *ft, *fp;

    fp = fopen("A.C", "r");

    fs = fopen("B.C", "r");

    ft = fopen("C.C", "r");

    fclose(fp, fs, ft);

    return 0;

    }

    http://www.latestoffcampus.com/http://www.latestoffcampus.com/http://www.latestoffcampus.com/https://groups.google.com/group/latestoffcampushttps://groups.google.com/group/latestoffcampushttps://www.facebook.com/LatestOffCampushttps://www.facebook.com/LatestOffCampushttp://www.latestoffcampus.com/http://www.latestoffcampus.com/http://www.latestoffcampus.com/https://groups.google.com/group/latestoffcampushttps://groups.google.com/group/latestoffcampushttps://www.facebook.com/LatestOffCampushttps://www.facebook.com/LatestOffCampushttps://www.facebook.com/LatestOffCampushttps://groups.google.com/group/latestoffcampushttp://www.latestoffcampus.com/https://www.facebook.com/LatestOffCampushttps://groups.google.com/group/latestoffcampushttp://www.latestoffcampus.com/
  • 7/29/2019 Firstsource Sample Programming Placement Paper Level1

    7/12

    Visitwww.latestoffcampus.com for placement papers, interview tips & job updates. Toget

    freeupdates tomailhttps://groups.google.com/group/latestoffcampusLive updates on Facebook @

    https://www.facebook.com/LatestOffCampus

    Visitwww.latestoffcampus.com for placement papers, interview tips & job updates. Toget

    freeupdates tomailhttps://groups.google.com/group/latestoffcampusLive updates on Facebook @

    https://www.facebook.com/LatestOffCampus

    A "A.C" "B.C"

    "C.C"

    B "B.C" "C.C" C "A.C" D Error in

    fclose()

    18.What will the SWAP macro in the following program be expanded toon preprocessing? will the code compile?

    #include

    #define SWAP(a, b, c)(c t; t=a, a=b, b=t)

    int main()

    {

    int x=10, y=20;

    SWAP(x, y, int);printf("%d %d\n", x, y);

    return 0;

    }

    A It compiles B Compiles with

    an warning

    C Not compile D Compiles and

    print nothing

    19.How will you print \n on the screen?

    A printf("\n"); B echo "\\n"; C printf('\n'); D printf("\\n");

    20.Declare the following statement?

    "A pointer to an array of three chars".

    A char *ptr[3](); B char

    (*ptr)*[3];

    C char

    (*ptr[3])();

    D char (*ptr)[3];

    21.Declare the following statement?

    "A pointer to a function which receives an int pointer and returns float

    pointer".

    A float

    *(ptr)*int;

    B float

    *(*ptr)(int)

    C float

    *(*ptr)(int*)

    D float

    (*ptr)(int)

    http://www.latestoffcampus.com/http://www.latestoffcampus.com/http://www.latestoffcampus.com/https://groups.google.com/group/latestoffcampushttps://groups.google.com/group/latestoffcampushttps://www.facebook.com/LatestOffCampushttps://www.facebook.com/LatestOffCampushttp://www.latestoffcampus.com/http://www.latestoffcampus.com/http://www.latestoffcampus.com/https://groups.google.com/group/latestoffcampushttps://groups.google.com/group/latestoffcampushttps://www.facebook.com/LatestOffCampushttps://www.facebook.com/LatestOffCampushttps://www.facebook.com/LatestOffCampushttps://groups.google.com/group/latestoffcampushttp://www.latestoffcampus.com/https://www.facebook.com/LatestOffCampushttps://groups.google.com/group/latestoffcampushttp://www.latestoffcampus.com/
  • 7/29/2019 Firstsource Sample Programming Placement Paper Level1

    8/12

    Visitwww.latestoffcampus.com for placement papers, interview tips & job updates. Toget

    freeupdates tomailhttps://groups.google.com/group/latestoffcampusLive updates on Facebook @

    https://www.facebook.com/LatestOffCampus

    Visitwww.latestoffcampus.com for placement papers, interview tips & job updates. Toget

    freeupdates tomailhttps://groups.google.com/group/latestoffcampusLive updates on Facebook @

    https://www.facebook.com/LatestOffCampus

    22.Declare the following statement?

    "A pointer to a function which receives nothing and returns nothing".

    A void*(ptr)*int; B void *(*ptr)() C void *(*ptr)(*) D void (*ptr)()

    23.Which of the following is the correct way of declaring a function as

    constant?

    A const int

    ShowData(void)

    { /* statements

    */ }

    B int const

    ShowData(void)

    { /* statements

    */ }

    C int

    ShowData(void)

    const { /*

    statements */ }

    D Both A and B

    24.Which of the following ways are legal to access a class data member

    using this pointer?

    A this->x B this.x C *this.x D *this-x

    25.What happens when we try to compile the class definition in

    following code snippet?

    class Birds {};class Peacock : protected Birds {};

    A It will not

    compile

    because class

    body of Birds is

    not defined.

    B It will not

    compile because

    class body of

    Eagle is not

    defined.

    C It will not

    compile

    because a class

    cannot be

    protectedly

    inherited from

    other class.

    D It will compile

    succesfully.

    26.Which of the following statements is correct about the program

    given below?

    http://www.latestoffcampus.com/http://www.latestoffcampus.com/http://www.latestoffcampus.com/https://groups.google.com/group/latestoffcampushttps://groups.google.com/group/latestoffcampushttps://www.facebook.com/LatestOffCampushttps://www.facebook.com/LatestOffCampushttp://www.latestoffcampus.com/http://www.latestoffcampus.com/http://www.latestoffcampus.com/https://groups.google.com/group/latestoffcampushttps://groups.google.com/group/latestoffcampushttps://www.facebook.com/LatestOffCampushttps://www.facebook.com/LatestOffCampushttps://www.facebook.com/LatestOffCampushttps://groups.google.com/group/latestoffcampushttp://www.latestoffcampus.com/https://www.facebook.com/LatestOffCampushttps://groups.google.com/group/latestoffcampushttp://www.latestoffcampus.com/
  • 7/29/2019 Firstsource Sample Programming Placement Paper Level1

    9/12

    Visitwww.latestoffcampus.com for placement papers, interview tips & job updates. Toget

    freeupdates tomailhttps://groups.google.com/group/latestoffcampusLive updates on Facebook @

    https://www.facebook.com/LatestOffCampus

    Visitwww.latestoffcampus.com for placement papers, interview tips & job updates. Toget

    freeupdates tomailhttps://groups.google.com/group/latestoffcampusLive updates on Facebook @

    https://www.facebook.com/LatestOffCampus

    class Bix

    {

    public:

    static void MyFunction();

    };

    int main()

    {

    void(*ptr)() = &Bix::MyFunction;

    return 0;

    }

    A The programreports an error

    as pointer to

    member

    function cannot

    be defined

    outside the

    definition of

    class.

    B The programreports an error

    as pointer to

    static member

    function cannot

    be defined.

    C The programreports an error

    as pointer to

    member

    function cannot

    be defined

    without object.

    D The programreports linker

    error.

    27.Which of the following function prototype is perfectly acceptable?

    A int

    Function(int

    Tmp = Show());

    B float

    Function(int

    Tmp = Show(int,

    float));

    C Both A and B. D float =

    Show(int, float)

    Function(Tmp);

    28.What will be the output of the C#.NET code snippet given below?

    byte b1 = 0xF7;

    byte b2 = 0xAB;

    byte temp;

    http://www.latestoffcampus.com/http://www.latestoffcampus.com/http://www.latestoffcampus.com/https://groups.google.com/group/latestoffcampushttps://groups.google.com/group/latestoffcampushttps://www.facebook.com/LatestOffCampushttps://www.facebook.com/LatestOffCampushttp://www.latestoffcampus.com/http://www.latestoffcampus.com/http://www.latestoffcampus.com/https://groups.google.com/group/latestoffcampushttps://groups.google.com/group/latestoffcampushttps://www.facebook.com/LatestOffCampushttps://www.facebook.com/LatestOffCampushttps://www.facebook.com/LatestOffCampushttps://groups.google.com/group/latestoffcampushttp://www.latestoffcampus.com/https://www.facebook.com/LatestOffCampushttps://groups.google.com/group/latestoffcampushttp://www.latestoffcampus.com/
  • 7/29/2019 Firstsource Sample Programming Placement Paper Level1

    10/12

    Visitwww.latestoffcampus.com for placement papers, interview tips & job updates. Toget

    freeupdates tomailhttps://groups.google.com/group/latestoffcampusLive updates on Facebook @

    https://www.facebook.com/LatestOffCampus

    Visitwww.latestoffcampus.com for placement papers, interview tips & job updates. Toget

    freeupdates tomailhttps://groups.google.com/group/latestoffcampusLive updates on Facebook @

    https://www.facebook.com/LatestOffCampus

    temp = (byte)(b1 & b2);

    Console.Write (temp + " ");

    temp = (byte)(b1^b2);

    Console.WriteLine(temp);

    A 163 92 B 92 163 C 192 63 D 0 1

    29.What will be the output of the C#.NET code snippet given below?

    int num = 1, z = 5;

    if (!(num

  • 7/29/2019 Firstsource Sample Programming Placement Paper Level1

    11/12

    Visitwww.latestoffcampus.com for placement papers, interview tips & job updates. Toget

    freeupdates tomailhttps://groups.google.com/group/latestoffcampusLive updates on Facebook @

    https://www.facebook.com/LatestOffCampus

    Visitwww.latestoffcampus.com for placement papers, interview tips & job updates. Toget

    freeupdates tomailhttps://groups.google.com/group/latestoffcampusLive updates on Facebook @

    https://www.facebook.com/LatestOffCampus

    A c = (byte) (a +

    b);

    B c = (byte) a +

    (byte) b;

    C c = (int) a +

    (int) b;

    D c = (int)(a + b);

    33.Which of the following is the correct default value of a Booleantype?

    A 0 B 1 C True D False

    34.When would a structure variable get destroyed?

    A When no

    reference refers

    to it, it will get

    garbage

    collected.

    B Depends upon

    whether it is

    created using

    new or without

    using new.

    C When it goes

    out of scope.

    D Depends upon

    the Project

    Settings made in

    Visual

    Studio.NET.

    35.Which of the following statements is correct?

    A A struct never

    declares a

    defaultconstructor.

    B All value types

    in C# inherently

    derive fromValueType,

    which inherits

    from Object.

    C A struct never

    declares a

    defaultdestructor.

    D In C#, classes

    and structs are

    semanticallysame.

    36.Which of the following is the correct way to apply an attribute to an

    Assembly?

    A [

    AssemblyDescri

    ption("DCube

    Component

    Library") ]

    B [ assembly :

    AssemblyDescri

    ption("DCube

    Component

    Library") ]

    C [ Assemblylnfo

    :

    AssemblyDescri

    ption("DCube

    Component

    Library") ]

    D < Assembly:

    AssemblyDescri

    ption("DCube

    Component

    Library") >

    http://www.latestoffcampus.com/http://www.latestoffcampus.com/http://www.latestoffcampus.com/https://groups.google.com/group/latestoffcampushttps://groups.google.com/group/latestoffcampushttps://www.facebook.com/LatestOffCampushttps://www.facebook.com/LatestOffCampushttp://www.latestoffcampus.com/http://www.latestoffcampus.com/http://www.latestoffcampus.com/https://groups.google.com/group/latestoffcampushttps://groups.google.com/group/latestoffcampushttps://www.facebook.com/LatestOffCampushttps://www.facebook.com/LatestOffCampushttps://www.facebook.com/LatestOffCampushttps://groups.google.com/group/latestoffcampushttp://www.latestoffcampus.com/https://www.facebook.com/LatestOffCampushttps://groups.google.com/group/latestoffcampushttp://www.latestoffcampus.com/
  • 7/29/2019 Firstsource Sample Programming Placement Paper Level1

    12/12

    Visitwww.latestoffcampus.com for placement papers, interview tips & job updates. Toget

    freeupdates tomailhttps://groups.google.com/group/latestoffcampusLive updates on Facebook @

    https://www.facebook.com/LatestOffCampus

    Visitwww.latestoffcampus.com for placement papers, interview tips & job updates. Toget

    freeupdates tomailhttps://groups.google.com/group/latestoffcampusLive updates on Facebook @

    https://www.facebook.com/LatestOffCampus

    http://www.latestoffcampus.com/http://www.latestoffcampus.com/http://www.latestoffcampus.com/https://groups.google.com/group/latestoffcampushttps://groups.google.com/group/latestoffcampushttps://www.facebook.com/LatestOffCampushttps://www.facebook.com/LatestOffCampushttp://www.latestoffcampus.com/http://www.latestoffcampus.com/http://www.latestoffcampus.com/https://groups.google.com/group/latestoffcampushttps://groups.google.com/group/latestoffcampushttps://www.facebook.com/LatestOffCampushttps://www.facebook.com/LatestOffCampushttps://www.facebook.com/LatestOffCampushttps://groups.google.com/group/latestoffcampushttp://www.latestoffcampus.com/https://www.facebook.com/LatestOffCampushttps://groups.google.com/group/latestoffcampushttp://www.latestoffcampus.com/