FSS INTERVIEW QUESTIONS – FOR FRESHERS

 This blog explains about FSS INTERVIEW QUESTIONS – FOR FRESHERS with answers. Some of the interview questions are given below :

_______________________________________________________________________________

                                  C & C++ Assessment Questions with Answers:

I .The output of the following code is:

 Main ()

{

 Int a[10], I;

For (i =1; 1<=0; i++)

{

Scanf(“%d”,a[i]);

printf(“%d”,a[i]);

}

}

 a.runtime error

 b.10

 c.1 to 10 will be displayed

d. logical Error

______________________________________________________________________

2. Which of the followings are false statements about Local class?

a. A local class type name can only be used in the enclosing function

b.All the methods of Local classes must be defined inside the class only

c. A Local class can contain static data members.

d. A Local class may contain static functions.

e. Non-static variables of the enclosing function are not accessible inside local classes.

f.Local classes cannot access global types, variables and functions.

a.Only 1,3

b.Only 3, 6

c. Only 2 , 4 6

d. None of these

ANSWER : b . Only 3 , 6 

_____________________________________________________________________

3.A pure virtual function is a virtual function that

 A) has no body

B) returns nothing

C) is used in base class

D) both (A) and (C)

ANSWER : D) BOTH (A) and (C)

_______________________________________________________________________________

4 . Which of the following is not used to seek a file pointer?

                a. ios::cur

               b. ios::set

               c. ios::end

               d. ios::beg

ANSWER : b) ios:set

__________________________________________________________________________

5. Which of the following is CPP style type-casting?

 A. per = total/(float)m

 B. per = total/float(m)

C. per = (float)total/m

 D. None of these.

 ANSWER : B. per = total/float(m)

 

________________________________________________________________________

6. Which of the following is/are valid ways to allocate memory for an integer by dynamic memory allocation in CPP?

 a. int *p = new int(100);

 b. int *p; p = new int; *p = 100;

c. int *P = NULL; p = new int;*p=100;

d. Only 1,2     

 e. All of these

ANSWER : e. All of these

_______________________________________________________________________________

7.Consider the declaration

char street(10) = “abcdefghi”:

Choose the correct remark(s)

A .& street and street will have different values

 B . &street is meaningless

C. &street+I and street+1 will have the same values

D. None of the above

ANSWER : D. None of the above

 

_____________________________________________________________________________

 8. if following program(myprogram)is run from the command line as myprog Friday Tuesday Sunday then what would be the output?

Main(int arg; char*argv)

printf(“%c”,**++argv);

}

a . m

 b.  f

c.myprog

d.None of these

 ANSWER : c.myprog

_____________________________________________________________________________

 9.consider the declaration static struct

{

Unsigned a:5;

Unsigned b:5;

Unsigned c:5;

Unsigned d:5%;

} v= (1,2,3,4);

V occupies

a.4 bytes

b.2 bytes

c. 1 bytes

d. None of these

 ANSWER : a.4 bytes

____________________________________________________________________________

10 Which of the following is the perfect set of operators that can’t be overloaded in CPP

a. += , ? , :: , >>

b. >>,<< ?, *, sizeof ()

c. :: , . , .* , ?:

d.:: , ->, * , new, delete.

ANSWER : c. :: , . , .* , ?:

 

_______________________________________________________________________________

 11.Only the ____________ can have access to the private members and private functions.

 a. data functions

b. inline functions

c. member functions

d. member variables

ANSWER : c. member functions

 

__________________________________________________________________________

 12 . int main()

 {

 static int arr[] = {0, 1, 2, 3, 4);

int *p[] = {arr, arr+1, arr+2, arr+3, arr+4};

 int **ptr=p;

# include<stdio.h>

ptr++;

printf(“%d. %d, %d\n”, ptr-p, *ptr-arr, **ptr);

*ptr++

 printf(“%cl, %d, %d\n”, ptr-p, *ptr-arr, **ptr);

*++ptr;

 printf(“%d, %d, %d\n”, ptr-p, *ptr-arr, **ptr);

 ++*ptr; printf(“%d, %d, 4Yochn”, ptr-p, *ptr-arr, **ptr);

return 0;

}

A.0, 0, 0

 1, 1, 1

 2, 2, 2

3, 3, 3

  B .2, 2, 3

3, 3, 4

4, 4, 1

C.1, 1, 1

 2, 2, 2

 3, 3, 3

 3, 4, 4

D. 1, 2, 3

    2, 3, 4

    3, 4, 5

_____________________________________________________________________

 13 . By executing following code. C compiler gives error of <code>int x[8].j; <br> for( j=0; j<=8; ++j ) <br> x[j] = j; <code>

 a. Declaration error

b. Initialization error

c.Referencing error

d.Out of bound error

____________________________________________________________________________

14.Using C function, correct way to write y = (e<sup>n In b<sup>)<sup>3<sup> is

A. y=pow(exp(n.pow(log(b)),2));

B. y=pow (expo pow(log(b))),2);

C. y=pow(exp(n*log(b)),2);

D. y=pow (exp(n*log b ),2);

____________________________________________________________________________

15.Continue statement used for

A. To continue to the next line of code

B. To stop the current iteration and begin the next iteration from the beginning

C. To handle run time error

D. None of above

ANSWER : B. To stop the current iteration and begin the next iteration from the beginning

 

____________________________________________________________________________

16.it is not necessary to typecast the address returned by malloc()

A. true

B. false

ANSWER : B. false

____________________________________________________________________________

17.What will be the output of following program

#include

main()

 {

 int x,y = 10;

 x = y * NULL;

 printf(/”%d/,x);

}

a. error

b.0

c.10

d.Garbage value

ANSWER : b . 0

____________________________________________________________________________

18.Which is more effective while calling the functions?

a) call by value

b) call by reference

c) call by pointer

d) none of the mentioned

ANSWER : b) call by reference

____________________________________________________________________________

19.which of the following statements mentioning the name of the the array begins DOES NOT yield the base address?

1.when array name is used with the sizeof() operator

 2.when array name is operand of the &operator

 3.when array name is passed to scant() function.

4.when array name is passed to print° function.

 a. A,

 b. A, B

 c. B

d. B, D

ANSWER : b. A, B

 

____________________________________________________________________________

20.which one of the following options is correct’?

a.Friendfunction can access public data members of the class

b.Friendfunction can access protected data members of the class

c.Friendfunction can access private data members of the class

d. all the above

ANSWER :  d. all the above 

       ____________________________________________________________________________

21- A trigraph character begins with

    a.#

    b.?

    c.??

    d.all of the above

ANSWER : c . ??

____________________________________________________________________________

22. A constructor can be virtual.

a.- True

b- False

ANSWER : a. True

____________________________________________________________________________

23.’cin’ is an ___

a – Class

 b – Object

c – Package

d NamesPlace

 ANSWER : b – Object

____________________________________________________________________________

24.Choose the respective delete operator usage for the expression ptr-new int 000

a – delete ptr;

b – delete ptr[];

 c – delete[] ptr;

d – [] delete ptr;

____________________________________________________________________________

25 .int x< 1; What is the value of ‘x’?

 a – 1

b – -1

c-2

d – -2

 

____________________________________________________________________________

26.A Variable name in C includes which special symbols?

a- * (asterisk)

 b – # (Hash)

 c – + (Addition)

 d – _ (underscore) 

ANSWER : d – _ (underscore)

____________________________________________________________________________

 27 .Choose the correct program that round off x value (a float value) to an int value to return the output value 4,

                  a – float x = 3.6;

 int y = (int)(x + 0.5);

 printf (“Result = %d/n”, y );

                   b – float x = 3.6;

 int y = int(x +0.5);                                                                                                           

 printf (“Result = %d/n”, y );

                  c – float x = 3.6;

Int y =   (int) X  + 0.5

 printf (Result = a %d/n”, y );

               d- float x=  3.6;

 int y – (int )(int) + 0.5)

 printf(“Result = %d\n”, y );

____________________________________________________________________________

28.The binary equivalent of 50 is,

 a- 110010

 b- 1010110

 c – 101

 d- 101.011.00.00

  ANSWER : a- 110010

____________________________________________________________________________

29.What will be output when you will execute following c code?

#include

 extern enum cricket x;

 int main()

printf { “%d” ,x);

return 0;

{

const enum cricket

{

Taylor

Chanderpaul

  { x=Taylor} Kallis&Chanderpaul;

 a.0

b.17

 c.16

d.15

_______________________________________________________________________________

30.Which  of the following range is a valid long double (Turbo C in 16 bit DOS OS)

 a.3.4E-4932 to 3.4E+4932

 b . 3.4E-4932 to 1.1E+4932

c . 4.1E-4932 to 5.1E+4932

d . 0.7E-4932 to 1.8E+4932

_______________________________________________________________________________