Samsung Placement paper Bangalore 12 Dec 2011

Posted on :08-02-2016
Written test C (20 qs)

Q1) If integer needs two bytes of storage, then maximum value of an unsigned integer is

a. 2^16-1
b. 2^15-1
c. 2^16
d. 2^15

ANS: a

Q2) If integer needs two bytes of storage, then maximum value of a signed integer is

a. 2^16-1
b. 2^15-1
c. 2^16
d. 2^15       
ANS: b

Q3) What is the output of

printf (%d, printf(tim) );

a. results in a syntax error
b. outputs time
c. outputs garbage
d. prints time and terminates abruptly 

ANS: b

Q4) Length of string correct is

d. implementation dependent

ANS: a

Q5) Consider the following program fragment

char c= a;
while(c++ <= z)

If the required output is abcd wxyz, then xxx should be

a. c
b. c++
c. c-1
d. —c

ANS: c

Q6) Consider the function

Find(int x, int y)
return ((x

The call find   find(a, b)  can be used to find

a. maximum of a, b
b. positive difference of a, b
c. sum of a, b
d. minimum of a, b

ANS: b

Q7) If abc is the input, then the following program fragment

char x, y, z;
printf(%d,scanf(%c%c%c, &x, &y, &z));

results in

a. a syntax error
b. a fatal error
c. segmentation violation
d. printing of 3

ANS: d

Q8) Consider the statements

If ab is the input, the output will be
a. an error message
b. this cant be input
c. ab
d. a b

ANS: c

Q9) The operators ,  ||   <   = if arranged in the ascending order of

a. ,  ||  <   =
b. =  <   ||  ,
c. =   ||    <  ,
d. <   ||    =   ,

Q10) The following program fragment

Unsigned i=-1;
int j = -4
printf(“%u”, i+j);

a. garbage
b. -3
c. an integer that changes from machine to machine
d. none of the above

ANS: c

Q11) The following program fragment

for( i=3; i<15;i+=3);
printf (“%d”,i);
results in

a. a syntax error
b. an execution error
c. printing of 12
d. printing of 15

ANS: d

Q12) The following description of the program, please pick the wrong one? 

int main(void) {
int i= 100;
int**dpi = π

a. dpi to store a pointer with the address for pi is a double pointer
b. (*pi==i) is true.
c. (*pi== **dpi)is true.
d. (*dpi == 100) is true

ANS: d

Q13) Below, please find the results for the program do?

int counter = 0, i;
for(i=0;;i++) (
if (i < 100) continue;
counter ++;
if (counter == 100) break;
printf(%d%d”,i, counter);
a.199 100
b. 200 100      
c. 199 99
d. 200 0

ANS: b

Q14) See below for a description of the defined array, please choose the wrong thing?

int a [] = {10,20,30,40};

a. successive one-dimensional array of elements in the array a[1], a[2] is  located in the contiguous memory space.
b. a[1] and a* (a+1) is the same.
c. During the initialization of an array; array size must be specified otherwise the initial value at compile error occurs
d.  & a[1] which has a +1 value, such as the address

ANS: c

Q15) Which is true about go to statement

ANS: It is used for coming out of the nested loop
Q16) What is conditional compilation

ANS: compilation is based on condition

Q17) Minimum no. of temporary variables required for swapping two numbers

a) 3
b) 2
c) 1
d) 0

ANS: d

Q18) The correct relation between / and 

Logic:-there will be expression containing a,b,/,%.take random values substitute and check the result(LHS=RHS)
Q19) What is the output of the below code

Main ()

Placement Papers for All Companies

FreshersLive - No.1 Job site in India. Here you can find latest 2022 government as well as private job recruitment notifications for different posts vacancies in India. Get top company jobs for both fresher and experienced. Job Seekers can get useful interview tips, resume services & interview Question and answer. Practice online test free which is helpful for interview preparation. Register with us to get latest employment news/rojgar samachar notifications. Also get latest free govt and other sarkari naukri job alerts daily through E-mail... Protection Status