# Intergraph Written test paper

Posted on :07-04-2016

Q1. 5-2-3*5-2 will give 18 if

(a)- is left associative,* has precedence over -
(b) - is right associative,* has precedence over -
(c) - is right associative,- has precedence over *
(d)- is left associative,- has precedence over *

Q2.

printf("%f", 9/5);
prints

(a) 1.8,
(b) 1.0,
(c) 2.0,
(d) none

Q3.

if (a=7)
printf(" a is 7 ");
else
printf("a is not 7");
prints

(a) a is 7,
(b) a is not 7,
(c) nothing,
(d) garbage.

Q4

if (a>b)
if(b>c)
s1;
else s2;
s2 will be executed if

(a) a<= b,
(b) b>c,
(c) b<=c and a<=b,
(d) a>b and b<=c.

Q5.

printf("%d", sizeof(""));
prints

(a) error
(b)0
(c) garbage
(d) 1.

Q6. value of automatic variable that is declared but not initialized will be

(a) 0,
(b) -1,
(c) unpredictable,
(d) none

Q7.

int v=3, *pv=&v;
printf(" %d %d ", v,*pv);

output will be

(a) error
(c) 3 3
(d) none

Q8. Declaration

enum cities{bethlehem,jericho,nazareth=1,jerusalem}
assian value 1 to

(a) bethlehem
(b) nazareth
(c) bethlehem & nazareth
(d) jericho & nazareth

Q9. Max number of nodes in a binary tree with height 3 is 20 :

ANS: False

Q10. 10,20,30,40,50,60 : give the order when put in a queue and in a stack

ANS: Queue : 10,20,30,40,50,60

stack : 60,50,40,30,20,10

Q11. Debugging is the process of finding

ANS: logical and runtime errors

Q12. Trace the error:

void main(){
int &a;
/* some other stuff here */
}

ANS: syntax error

Q13. A problem with a function named myValue will be given and asked to find the value of main() for an argument of 150,

ANS: 150

Q14. Locate the error

int arr (20);

ANS: syntax error.

Q15.

find(int x,int y)
{ return ((x

call find(a,find(a,b)) use to find

(a) maximum of a,b
(b) minimum of a,b
(c) positive difference of a,b
(d) sum of a,b

Q16. integer needs 2bytes , maximum value of an unsigned integer is

(a) { 2 power 16 } -1
(b) {2 power 15}-1
(c) {2 power16}
(d) {2 power 15}

Q17. y is of integer type then expression

3*(y-8)/9 and (y-8)/9*3 yields same value if

(a) must yields same value
(b) must yields different value
(c) may or may not yields same value
(d) none of the above

Q18. 5-2-3*5-2 will give 18 if

(a)- is left associative,* has precedence over -
(b) - is right associative,* has precedence over -
(c) - is right associative,- has precedence over *
(d)- is left associative,- has precedence over *

Q19.

printf("%f", 9/5);
prints

(a) 1.8,
(b) 1.0,
(c) 2.0,
(d) none

Q20.

if (a=7)
printf(" a is 7 ");
else
printf("a is not 7");
prints

(a) a is 7,
(b) a is not 7,
(c) nothing,
(d) garbage.

Q21.

if (a>b)
if(b>c)
s1;
else s2;
s2 will be executed if

(a) a<= b,
(b) b>c,
(c) b<=c and a<=b,
(d) a>b and b<=c.

Q22.

main()
{
inc(); ,inc(); , inc();
}
inc()
{ static int x;
printf("%d", ++x);
}
prints

(a) 012,
(b) 123,
(c) 3 consecutive unprectiable numbers
(d) 111

Q23. Preprocessing is done

(a) either before or at beginning of compilation process
(b) after compilation before execution
(d) none of the above.

Q24.

printf("%d", sizeof(""));
prints

(a) error
(b) 0
(c) garbage
(d) 1.

Q25.

main()
{
int a=5,b=2;
printf("%d", a+++b);
}

(a) results in syntax,
(b) print 7,
(c) print 8,
(d) none,

Q26. Process by which one bit pattern in to another by bit wise operation is

(b) pruning,
(c) biting,
(d) chopping,

Q27. Value of automatic variable that is declared but not intialized
will be

(a) 0,
(b) -1,
(c) unpredictable,
(d) none,

Q28.

int v=3, *pv=&v;
printf(" %d %d ", v,*pv);

output will be

(a) error
(c) 3 3
(d) none.

Q29.

#include
#include
void main()
{
char buffer[82]={80};
char *result;
printf( "input line of text, followed by carriage return : ");
result = cgets(buffer);
printf("text=%s ",result);
}

(a) printf("length=%d",buffer[1]);
(b) printf("length=%d",buffer[0]);
(c) printf("length=%d",buffer[81]);
(d) printf("length=%d",buffer[2]);

Q30. consider scanf and sscanf function , which is true

(a) no standard function called sscanf
(b) sscanf(s,...) is equivalent to scanf(...) except that input character are taken from string s.
(c) sscanf is equivalent to scanf.
(d) none of above.

Q31.

#include

main()
{
char line[80];
scanf("%[^ ]",line);
printf("%s",line);
}

what scanf do ?

(a) compilation error . illegal format string.
(b) terminates reading input into variable line.
(c) and (d) other two options.

Q32. ceil(-2.8) ?

(a) 0
(b) -3.0
(c) -2.0
(d) 2

Q33.

for( p=head; p!=null; p= p -> next)
free(p);

(a) program run smooth.
(b) compilation error.
(c) run time error.
(d) none of above.

Q34.

int x[3][4] ={
{1,2,3},
{4,5,6},
{7,8,9}
}

(a) x[2][1] = x[2][2] =x[2][3] = 0
(b) value in fourth column is zero
(c) value in last row is zero
(d) none of above.

Q35

main ()
{
printf("%u" , main());
}

(a) print garbage.
(b) execution error
(c) printing of starting address of function main.
(d) infinite loop.

Register