This question paper is TCS C&COBOL TEST PAPER.
-----------------------------------------------------
1) Which of these is an invalid dataname?
a) wd-count b) wd_count
c) w4count d) wdcountabcd
2) What is the output of the following program
main ()
{
unsigned int i;
for (i = 10; i >= 0; i--)
printf ("%d", i);
}
a) prints numbers 10 - 0 b) prints nos 10 - 1
c) d) goes into infinite loop
11) What is the value of the following expression?
i = 1;
i << 1 % 2
a) 2 b)
c) 1 d) 0
12) What is the value of the following expression?
i = 1;
i = (i <<= 1 % 2)
a) 2 b)
c) 0 d) erroneous syntax
What is the result?
13) *A + 1 - *A + 3
a) - b) -2
c) 4 d) none of the above
14) &A[5] - &A[1]?
a) b)
c) 4 d)
15) C allows
a) only call by value
b) only call by reference
c) both
d) only call by value and sometimes call by reference
16) The following statement is
" The size of a struct is always equal to the sum
of the sizes of its members"
a) valid b) invalid c) can't say
17) How many x's are printed?
for (i = 0, j = 10; i < j; i++, j--)
printf ("x");
a) 10 b) 5 c) 4 d) none
18) output?
main ()
{
int i = 2, j = 3, k = 1;
swap (i, j)
printf ("%d %d", i, j);
}
swap (int i, int j)
{
int temp;
temp = i; i = j; j = temp;
}
YOU KNOW THE ANSWER
19) main ()
{
int i = 2;
twice (2);
printf ("%d", i);
}
twice (int i)
{
bullshit
}
int i, b[] = {1, 2, 3, 4, 5}, *p;
p = b;
++*p;
p += 2;
20) What is the value of *p;
a) 2 b) 3 c) 4 d) 5
21) What is the value of (p - (&p - 2))?
a) b) 2 c) d)
23) x = fopen (b, c)
what is b?
a) pointer to a character array which contains the filename
b) filename whithin double quotes
c) can be anyone of the above
d) none
24) x = malloc (y). Which of the following statements is correct.
a) x is the size of the memory allocated
b) y points to the memory allocated
t
c) x points to the memory allocated
d) none of the above
25) which is the valid declaration?
a) #typedef struct { int i;}in;
b) typedef struct in {int i;};
c) #typedef struct int {int i;};
d) typedef struct {int i;} in;
26) union {
int no;
char ch;
} u;
What is the output?
u.ch = '2';
u.no = 0;
printf ("%d", u.ch);
a) 2 b) 0 c) null character d) none
27) Which of these are valid declarations?
i) union { ii) union u_tag {
int i; int i;
int j; int j;
}; };
iii) union { iv) union {
int i; int i;
int j; int j;
FILE k; }u;
};
a) all correct b) i, ii, iv
c) ii & iv d)
28) p and q are pointers to the same type of dataitems.
Which of these are valid?
i) *(p+q)
ii) *(p-q)
iii) *p - *q
a) all
b)
c) iii is valid sometimes
29) which are valid?
i) pointers can be added
ii) pointers can be subtracted
iii) integers can be added to pointers
a) all correct b) only i and ii
30) int *i;
float *f;
char *c;
which are the valid castings?
i) (int *) &c
ii) (float *) &c
iii) (char *) &i
31) int i = 20;
printf ("%x", i);
what is the output?
a) x14 b) 14 c) 20 d) none of the above
32) main ()
{
char *name = "name";
change (name);
printf ("%s", name);
}
change (char *name)
{
char *nm = "newname";
name = nm;
}
what is the output?
a) name b) newname c) name = nm not valid
d) function call invalid
33) char name[] = {'n', 'a', 'm', 'e'}
printf ("name = \n%s", name);
a) name =
name
b) name =
followed by funk characters
c) name = \nname
d) none
34) int a = 0, b = 2;
if (a = 0)
b = 0;
else
b *= 10;
what is the value of b?
a) 0 b) 20 c) 2 d) none
35) int x = 2, y = 2, z = 1;
what is the value of x afterh the following statmements?
if (x = y%2)
z = crap
else
crap
a) 0 b) 2 c)1 d)none
37) output?
initially n = -24;
printd (int n)
{
if (n < 0)
{
printf ("-");
n = -n;
}
if (n % 10)
printf ("%d", n);
else
printf ("%d", n/10);
printf ("%d", n);
}
a. -24 b.24 c. d.-224
38) float x, y, z;
scanf ("%f %f", &x, &y);
if input stream contains "4.2 3 2.3 ..." what will x and y contain
after scanf?
a. 4.2, 3.0
b. 4.2, 2.3
c.
d.
39) #define max(a,b) (a>b?b:a)
#define squre(x) x*x
int i = 2, j = 3, k = 1;
printf ("%d %d", max(i,j), squre(k));
output?
a.32 b.23 c.31 d.13
40) struct adr {
char *name;
char *city;
int zip;
};
struct adr *adradr;
which are valid references?
i) adr->name X
ii) adradr->name
iii) adr.zip X
iv) adradr.zip
41) main (x, y)
int x, char *y[];
{
printf ("%d %s", x, y[1]);
}
output when invoked as
prog arg1
a. 1 prog b. 1 arg1 c. 2 prog d. 2 arg1
42) extern int s;
int t;
static int u;
main ()
{
}
which of s, t and u are availeble to a function present in another
file
a. only s
b. s & t
c. s, t, u
d. none
43) main ()
{
}
int a;
f1(){}
f2(){}
which of the functions is int a available for?
a. all of them
b. only f2
c. only f1
d. f1 and f2 only
int a = 'a', d = 'd';
char b = "b", c = "cr";
main ()
{
mixup (a, b, &c);
}
mixup (int p1, char *p2, char **p3)
{
int *temp;
....doesnt matter.....
}
44) what is the value of a after mixup?
a. a b.b c.c d.none of the above
45) what is the value of b after mixup?
a. a b.b c.c d.none of the above
46) main ()
{
char s[] = "T.C.S", *A;
print(s);
}
print (char *p)
{
while (*p != '\0')
{
if (*p != ".")
printf ("%s", *p);
p++;
}
}
output?
a.T.C.S
b.TCS
c.
d. none of the above
47) a question on do ... while
48) a question on % operator
49) main ()
{
int ones, twos, threes, others;
int c;
ones = twos = threes = others = 0;
while ((c = getchar ()) != EOF)
{
switch (c)
{
case '1': ++ones;
case '2': ++twos;
case '3': ++threes;
break;
default: ++others;
break;
}
}
printf ("%d %d", ones, others);
}
if the input is "1a1b1c" what is the output?
a. 13
b.
c. 33
d. 31
*****************************************************************************
Subject: TCS C Questions
--------------------------
1) Which of these is an invalid dataname?
a) wd-count b) wd_count
c) w4count d) wdcountabcd
2) What is the output of the following program
main ()
{
unsigned int i;
for (i = 10; i >= 0; i--)
printf ("%d", i);
}
a) prints numbers 10 - 0 b) prints nos 10 - 1
c) d) goes into infinite loop
11) What is the value of the following expression?
i = 1;
i << 1 % 2
a) 2 b)
c) 1 d) 0
12) What is the value of the following expression?
i = 1;
i = (i <<= 1 % 2)
a) 2 b)
c) 0 d) erroneous syntax
What is the result?
13) *A + 1 - *A + 3
a) - b) -2
c) 4 d) none of the above
14) &A[5] - &A[1]?
a) b)
c) 4 d)
15) C allows
a) only call by value
b) only call by reference
c) both
d) only call by value and sometimes call by reference
16) The following statement is
" The size of a struct is always equal to the sum
of the sizes of its members"
a) valid b) invalid c) can't say
17) How many x's are printed?
for (i = 0, j = 10; i < j; i++, j--)
printf ("x");
a) 10 b) 5 c) 4 d) none
18) output?
main ()
{
int i = 2, j = 3, k = 1;
swap (i, j)
printf ("%d %d", i, j);
}
swap (int i, int j)
{
int temp;
temp = i; i = j; j = temp;
}
YOU KNOW THE ANSWER
19) main ()
{
int i = 2;
twice (2);
printf ("%d", i);
}
twice (int i)
{
bullshit
}
int i, b[] = {1, 2, 3, 4, 5}, *p;
p = b;
++*p;
p += 2;
20) What is the value of *p;
a) 2 b) 3 c) 4 d) 5
21) What is the value of (p - (&p - 2))?
a) b) 2 c) d)
23) x = fopen (b, c)
what is b?
a) pointer to a character array which contains the filename
b) filename whithin double quotes
c) can be anyone of the above
d) none
24) x = malloc (y). Which of the following statements is correct.
a) x is the size of the memory allocated
b) y points to the memory allocated
c) x points to the memory allocated
d) none of the above
25) which is the valid declaration?
a) #typedef struct { int i;}in;
b) typedef struct in {int i;};
c) #typedef struct int {int i;};
d) typedef struct {int i;} in;
26) union {
int no;
char ch;
} u;
What is the output?
u.ch = '2';
u.no = 0;
printf ("%d", u.ch);
a) 2 b) 0 c) null character d) none
27) Which of these are valid declarations?
i) union { ii) union u_tag {
int i; int i;
int j; int j;
}; };
iii) union { iv) union {
int i; int i;
int j; int j;
FILE k; }u;
};
a) all correct b) i, ii, iv
c) ii & iv d)
28) p and q are pointers to the same type of dataitems.
Which of these are valid?
i) *(p+q)
ii) *(p-q)
iii) *p - *q
a) all
b)
c) iii is valid sometimes
29) which are valid?
i) pointers can be added
ii) pointers can be subtracted
iii) integers can be added to pointers
a) all correct b) only i and ii
30) int *i;
float *f;
char *c;
which are the valid castings?
i) (int *) &c
ii) (float *) &c
iii) (char *) &i
31) int i = 20;
printf ("%x", i);
what is the output?
a) x14 b) 14 c) 20 d) none of the above
32) main ()
{
char *name = "name";
change (name);
printf ("%s", name);
}
change (char *name)
{
char *nm = "newname";
name = nm;
}
what is the output?
a) name b) newname c) name = nm not valid
d) function call invalid
33) char name[] = {'n', 'a', 'm', 'e'}
printf ("name = \n%s", name);
a) name =
name
b) name =
followed by funk characters
c) name = \nname
d) none
34) int a = 0, b = 2;
if (a = 0)
b = 0;
else
b *= 10;
what is the value of b?
a) 0 b) 20 c) 2 d) none
35) int x = 2, y = 2, z = 1;
what is the value of x afterh the following statmements?
if (x = y%2)
z = crap
else
crap
a) 0 b) 2 c)1 d)none
37) output?
initially n = -24;
printd (int n)
{
if (n < 0)
{
printf ("-");
n = -n;
}
if (n % 10)
printf ("%d", n);
else
printf ("%d", n/10);
printf ("%d", n);
}
a. -24 b.24 c. d.-224
38) float x, y, z;
scanf ("%f %f", &x, &y);
if input stream contains "4.2 3 2.3 ..." what will x and y contain
after scanf?
a. 4.2, 3.0
b. 4.2, 2.3
c.
d.
39) #define max(a,b) (a>b?b:a)
#define squre(x) x*x
int i = 2, j = 3, k = 1;
printf ("%d %d", max(i,j), squre(k));
output?
a.32 b.23 c.31 d.13
40) struct adr {
char *name;
char *city;
int zip;
};
struct adr *adradr;
which are valid references?
i) adr->name X
ii) adradr->name
iii) adr.zip X
iv) adradr.zip
41) main (x, y)
int x, char *y[];
{
printf ("%d %s", x, y[1]);
}
output when invoked as
prog arg1
a. 1 prog b. 1 arg1 c. 2 prog d. 2 arg1
42) extern int s;
int t;
static int u;
main ()
{
}
which of s, t and u are availeble to a function present in another
file
a. only s
b. s & t
c. s, t, u
d. none
43) main ()
{
}
int a;
f1(){}
f2(){}
which of the functions is int a available for?
a. all of them
b. only f2
c. only f1
d. f1 and f2 only
int a = 'a', d = 'd';
char b = "b", c = "cr";
main ()
{
mixup (a, b, &c);
}
mixup (int p1, char *p2, char **p3)
{
int *temp;
....doesnt matter.....
}
44) what is the value of a after mixup?
a. a b.b c.c d.none of the above
45) what is the value of b after mixup?
a. a b.b c.c d.none of the above
46) main ()
{
char s[] = "T.C.S", *A;
print(s);
}
print (char *p)
{
while (*p != '\0')
{
if (*p != ".")
printf ("%s", *p);
p++;
}
}
output?
a.T.C.S
b.TCS
c.
d. none of the above
47) a question on do ... while
48) a question on % operator
49) main ()
{
int ones, twos, threes, others;
int c;
ones = twos = threes = others = 0;
while ((c = getchar ()) != EOF)
{
switch (c)
{
case '1': ++ones;
case '2': ++twos;
case '3': ++threes;
break;
default: ++others;
break;
}
}
printf ("%d %d", ones, others);
}
if the input is "1a1b1c" what is the output?
a. 13
b.
c. 33
d. 31
---------------------------------------------------------------------------------------------------------------------------------------------------------------
HOME
YEAR N ORG
- C++ (1)
- CISCO 2000 (1)
- CISCO IN ISI (1)
- CISCO SELECTION PROCEDURE (1)
- CTS-JUNE-2005 (1)
- GD TIPS (1)
- GE-NIT-CALICUT-06 (1)
- HCL 1995 (1)
- HCL INTERIVIEW (1)
- HUGHES - 2003 (1)
- HUGHES DELHI 1997 (1)
- HUGHES-26/12/03 (1)
- I'VIE QNS TECH COMP (1)
- I'VIEW HOW TO DRESS (1)
- I'VIEW QNS AT EBAY (1)
- I'VIEW QNS ON C (1)
- I'VIEW QNS ORACLE (1)
- I'VIEW TIPS (TEAM) (1)
- I'VIEW TIPS 1 (2)
- I'VIEW TIPS 2 (1)
- I'VIEW TIPS 3 (1)
- I'VIEW TIPS 5 (1)
- I'VIEW WAY OF ANSWERING (1)
- IBM - 2006 (1)
- INFOSYS DCE DELHI 2K (1)
- INFOSYS 1997 (1)
- INFOSYS 1998 (1)
- INFOSYS CET 2000 (1)
- INFOSYS I'VIEW 05 (1)
- INFOSYS IISC (1)
- INFOSYS IISC 2K (1)
- INFOSYS IISC B'LORE (1)
- INFOSYS IITB 2000 (1)
- INFOSYS IITD 2000 (1)
- INFOSYS IT BHU 2K (1)
- INFOSYS PAPER (1)
- INFOSYS PAPR 97 (1)
- INFOSYS QNS (1)
- INFOSYS QYESTIONS (1)
- INFOSYS TECH LTD (1)
- INFOSYS VJIT 2000 (1)
- INFOSYS-BANGLORE-2006 (1)
- interview tips (1)
- ORACLE CANDIDATE EXP (1)
- ORACLE CHENNAI 13/07/03 (1)
- Oracle OFF CAMP (1)
- ORACLE-2001 (1)
- ORACLE-GUIDANCE (1)
- ORACLE-NITK-11/07/03 (1)
- ORACLE-OF CAMPUS 22/06/06 (1)
- ORACLE-OFCAMP -21/06/03 (1)
- ORACLE-OFCAMP 21/06/03 (1)
- ORACLE-OFCAMP-JULY 2003 (1)
- ORACLE-RECW-2003 (1)
- PATNI 1999 (1)
- RESUME 2 (1)
- RESUME 3 (1)
- RESUME 4 (1)
- RESUME 5 (1)
- RESUME 6 (1)
- RESUME 7 (1)
- SAS (1)
- SASKEN SEP 2003 (1)
- SATYAM 2K3 (1)
- SATYAM 2003 (1)
- SATYAM PAPER (1)
- SATYAM PAPER - GD (1)
- SATYAM PAPER CAND EXP (1)
- SATYAM PATTERN (1)
- SATYAM SAMPLE TEST (1)
- SATYAM2003 (1)
- SQL (1)
- Tcs (1)
- TCS - 2006 (1)
- TCS -JADAVPUR UNI 99 (1)
- TCS 01/07/06 PAPER I'VIEW (1)
- TCS 1998 (2)
- TCS 2000 (1)
- TCS 2003 (1)
- TCS B'LRE 23/09/06CAND EXP (1)
- TCS CAND EXPERIENCE (1)
- TCS CHENNAI 10/12/06 (1)
- TCS COBOL PAPER (1)
- TCS HYD 07/10/06 (1)
- TCS HYD 07/10/06 CAND EXP (1)
- TCS I'VIEW (1)
- TCS MODEL PAPER (1)
- TCS PAPER (1)
- TCS PAPER 1998 (1)
- TCS PAPER 2000 (1)
- TCS PAPER I'VIEW 24/07/06 (1)
- TCS PAPER1 (1)
- TCS PATTERN CAND EXP (1)
- TCS PONDY 02/06/07 I'VIEW (1)
- TCS RANCHI 24/07/06 (1)
- TCS ROORKEE 31/07/97 (1)
- TCS SAMPLE TEST 1 (1)
- TCS SAMPLE TEST 2 (1)
- TCS TALENT TEST 1 (1)
- TCS-HYD-20/10/06 (1)
- TEX TECH TEST 2003 (2)
- TEXAS PAPER 2000 (1)
- TEXAS 1999 (1)
- TEXAS 28/07/08 (1)
- TEXAS CSE 2001 (1)
- TEXAS IISc (1)
- TEXAS IITB (1)
- TEXAS IITK (1)
- TEXAS INSTR PAPER (1)
- TEXAS JADAVPUR 99 (1)
- TEXAS PAPER (1)
- TEXAS REC 2000 (1)
- wipro (1)
- WIPRO 1995 (1)
- WIPRO 1999 (1)
- WIPRO 2000 (1)
- WIPRO 2K (2)
- WIPRO INTERVIEW (1)
- WIPRO INTERVIEW 95 (1)
- WIPRO JULY 1997 (1)
- WIPRO NITDURGAPUR 03 (1)
- WIPRO PAPER 2000 (1)
- WIPRO PROCESS B'LORE (1)
- WIPRO ROORKEE 2K (1)
- WIPRO SAMPLETEST 2 (1)
- WIPRO SAMPLETEST1 (1)
- WIPRO SMAPLETEST 3 (1)
- WIPRO SURAT 2002 (1)
- WIPRO TECH 2000 (1)
Thursday, April 19, 2007
TCS COBOL PAPER
Posted by
pappuagloco
at
4:29 PM
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment