Wednesday, 23 March 2011

hcl c technical questions

Instructions:1. Please ignore any case-sensitive errors and un-included libraries.
2. You may use the back of this question paper for any rough work.

Q1.main()
{
int i;
clrscr();
printf("%d", &i)+1;
scanf("%d", i)-1;
}
a. Runtime error.
b. Runtime error. Access violation.
c. Compile error. Illegal syntax
d. None of the above
Ans: d,printf( ) prints address/garbage of i,
scanf() dont hav & sign, so scans address for i
+1, -1 dont hav any effect on code
Q2.main(int argc, char *argv[])
{
(main && argc) ? main(argc-1, NULL) : return 0;
}
a. Runtime error.
b. Compile error. Illegal syntax
c. Gets into Infinite loop
d. None of the above
Ans: b) illegal syntax for using return
Q3.main()
{
int i;
float *pf;
pf = (float *)&i;
*pf = 100.00;
printf("\n %d", i);
}
a. Runtime error.
b. 100
c. Some Integer not 100
d. None of the above

Ans: d) 0
Q4.
main()
{
int i = 0xff ;
printf("\n%d", i<<2);
}
a. 4
b. 512
c. 1020
d. 1024

Ans: c) 1020

Q5.#define SQR(x) x * x
main()
{
printf("%d", 225/SQR(15));
}
a. 1
b. 225
c. 15
d. none of the above
Ans: b) 225

Q6.union u
{
struct st
{
int i : 4;
int j : 4;
int k : 4;
int l;
}st;
int i;
}u;
main()
{
u.i = 100;
printf("%d, %d, %d",u.i, u.st.i, u.st.l);
}
a. 4, 4, 0
b. 0, 0, 0
c. 100, 4, 0
d. 40, 4, 0
Ans: c) 100, 4, 0
Q7.union u
{
union u
{
int i;
int j;
}a[10];
 



Placement Papers

·     3i-Infotech
§     ABB
§     AMD
§     ANZ
§     Aalayance
§     Accel Frontline
§     Accenture
§     Aditi
§     Adobe
§     Alcatel
§     Allfon
§     Amazon
§     Amdocs
§     Aricent
§     Ashok Leyland
§     Axes
§     Aztec
§     BARC
§     BEL
§     BFL
§     BHEL
§     BSNL
§     Bajaj
§     BirlaSoft
§     Blue Star
§     Bosch
§     C-DOT
§     CDAC
§     CGI
§     CMC
§     CSC
§     CTS
§     Cadance
§     Calsoft
§     Capgemini
§     Caritor
§     Chatargee
§     Ciena
§     Cisco
§     CitiCorp
§     Cognizant
§     Comp. Associates
§     Convergys
§     Covansys
§     DBS
§     DRDO
§     DSRC
§     DeShaw
§     Dell
§     Deloitte
§     Delphi
§     Dharma
§     ELGI
§     EMC
§     ESSAR
§     EasyTech
§     Epson
§     Flextronics
§     FutureSoft
§     GE
§     Genpact
§     Geometric
§     Google
§     Grapecity
§     HAL
§     HCL
§     HP
§     Hexaware
§     Honeywell
§     Huawei
§     Hughes
§     I-Flex
§     I-Gate
§     I2 (i2)Tech.
§     IBM
§     ICICI
§     INFOSYS
§     ISRO
§     Inautix
§     IndusLogic
§     Integra
§     Intel
§     Intergraph
§     Interwoven
§     Ivega
§     KPIT
§     Kanbay
§     Keane
§     Kshema
§     Kyocera
§     L&T Infotech
§     Lehman Brothers
§     LgSoft
§     Logica CMG
§     Lucent
§     MBT
§     Mascot
§     Mastek
§     Microsoft
§     Mindtree
§     Motorola
§     Mphasis
§     NCR
§     NESS
§     NIIT
§     NTPC
§     Nokia
§     Novell
§     Nucleus
§     Ocwen
§     OnMobile
§     Oracle
§     PCS
§     PSI Data Systems
§     Patni
§     Perot Systems
§     Persistent
§     Philips
§     Polaris
§     Quark
§     Ramco
§     Reliance
§     SAIL
§     SAP
§     SATYAM
§     SBI
§     SISL
§     SUN
§     Samsung
§     Samtel
§     Sapient
§     Sasken
§     Scadent
§     Siemens
§     Sify
§     SoftSol
§     Sonata
§     Subex
§     Sutherland
§     Symphony
§     Synopsys
§     Syntel
§     TCS
§     TELCO
§     TVS Lucas
§     Talisma
§     Tata Elxsi
§     Tata Motors
§     Tavant
§     Tech Mahindra
§     Temenos
§     ThinkSoft
§     Trilogy
§     UbiNetics
§     Verifone
§     Veritas
§     Verizon
§     Virtusa
§     WIPRO
§     Wilco
§     Wipro Infotech
§     Xansa
§     Yahoo
§     ZTE
§     Zensar
§     iSOFT

Enter your email address:






Search


Search this site:




PLACEMENT PAPERS in EMAIL:


Get Your Dream Job! Post Your Resume Today!
  Contribute YOUR Placement Paper and Experience, Win Exciting Prizes   

(Paper) HCL Placement Question Paper: Solved (C Language)

Email Newsletter FREE SMS ALERTS  FACEBOOK , TWITTER

HCL Placement Question Paper: Solved (C Language)

Instructions:1. Please ignore any case-sensitive errors and un-included libraries.
2. You may use the back of this question paper for any rough work.

Q1.main()
{
int i;
clrscr();
printf("%d", &i)+1;
scanf("%d", i)-1;
}
a. Runtime error.
b. Runtime error. Access violation.
c. Compile error. Illegal syntax
d. None of the above
Ans: d,printf( ) prints address/garbage of i,
scanf() dont hav & sign, so scans address for i
+1, -1 dont hav any effect on code
Q2.main(int argc, char *argv[])
{
(main && argc) ? main(argc-1, NULL) : return 0;
}
a. Runtime error.
b. Compile error. Illegal syntax
c. Gets into Infinite loop
d. None of the above
Ans: b) illegal syntax for using return
Q3.main()
{
int i;
float *pf;
pf = (float *)&i;
*pf = 100.00;
printf("\n %d", i);
}
a. Runtime error.
b. 100
c. Some Integer not 100
d. None of the above

Ans: d) 0
Q4.
main()
{
int i = 0xff ;
printf("\n%d", i<<2);
}
a. 4
b. 512
c. 1020
d. 1024

Ans: c) 1020

Q5.#define SQR(x) x * x
main()
{
printf("%d", 225/SQR(15));
}
a. 1
b. 225
c. 15
d. none of the above
Ans: b) 225

Q6.union u
{
struct st
{
int i : 4;
int j : 4;
int k : 4;
int l;
}st;
int i;
}u;
main()
{
u.i = 100;
printf("%d, %d, %d",u.i, u.st.i, u.st.l);
}
a. 4, 4, 0
b. 0, 0, 0
c. 100, 4, 0
d. 40, 4, 0
Ans: c) 100, 4, 0
Q7.union u
{
union u
{
int i;
int j;
}a[10];
int b[10];
}u;
main()
{
printf("\n%d", sizeof(u));
printf(" %d", sizeof(u.a));
// printf("%d", sizeof(u.a[4].i));
}
a. 4, 4, 4
b. 40, 4, 4
c. 1, 100, 1
d. 40 400 4

Ans: 20, 200, error for 3rd printf
Q8.main()
{
int (*functable[2])(char *format, ...) ={printf, scanf};
int i = 100;
(*functable[0])("%d", i);
(*functable[1])("%d", i);
(*functable[1])("%d", i);
(*functable[0])("%d", &i);
}
a. 100, Runtime error.
b. 100, Random number, Random number, Random number.
c. Compile error
d. 100, Random number
Q9.main()
{
int i, j, *p;
i = 25;
j = 100;
p = &i; // Address of i is assigned to pointer p
printf("%f", i/(*p) ); // i is divided by pointer p
}
a. Runtime error.
b. 1.00000
c. Compile error
d. 0.00000

Ans: c) Error becoz i/(*p) is 25/25 i.e 1 which is int & printed as a float,
So abnormal program termination,
runs if (float) i/(*p) -----> Type Casting
Q10.main()
{
int i, j;
scanf("%d %d"+scanf("%d %d", &i, &j));
printf("%d %d", i, j);
}
a. Runtime error.
b. 0, 0
c. Compile error
d. the first two values entered by the user

Ans: d) two values entered, 3rd will be null pointer assignment
Q11.
main()
{
char *p = "hello world";
p[0] = 'H';
printf("%s", p);
}
a. Runtime error.
b. “Hello world”
c. Compile error
d. “hello world”

Ans: b) Hello world
Q12.main()
{
char * strA;
char * strB = I am OK;
memcpy( strA, strB, 6);
}
a. Runtime error.
b. I am OK
c. Compile error
d. I am O
Ans: c) I am OK is not in " "

Q13. How will you print % character?a. printf(“\%”)
b. printf(“\\%”)
c. printf(“%%”)
d. printf(“\%%”)

Ans: c) printf(" %% ");
Q14.
const int perplexed = 2;
#define perplexed 3
main()
{
#ifdef perplexed
#undef perplexed
#define perplexed 4
#endif
printf("%d",perplexed);
}
a. 0
b. 2
c. 4
d. none of the above
Ans: c)
Q15.struct Foo
{
char *pName;
};
main()
{
struct Foo *obj = malloc(sizeof(struct Foo));
clrscr();
strcpy(obj->pName,"Your Name");
printf("%s", obj->pName);
}
a. Your Name
b. compile error
c. Name
d. Runtime error

Ans a)
Q16.struct Foo
{
char *pName;
char *pAddress;
};
main()
{
struct Foo *obj = malloc(sizeof(struct Foo));
clrscr();
obj->pName = malloc(100);
obj->pAddress = malloc(100);
strcpy(obj->pName,"Your Name");
strcpy(obj->pAddress, "Your Address");
free(obj);
printf("%s", obj->pName);
printf("%s", obj->pAddress);
}
a. Your Name, Your Address
b. Your Address, Your Address
c. Your Name Your Name
d. None of the above

Ans: d) printd Nothing, as after free(obj), no memory is there containing
obj->pName & pbj->pAddress
Q17.main()
{
char *a = "Hello ";
char *b = "World";
clrscr();
printf("%s", strcat(a,b));
}
a. Hello
b. Hello World
c. HelloWorld
d. None of the above

Ans: b)
Q18.
main()
{
char *a = "Hello ";
char *b = "World";
clrscr();
printf("%s", strcpy(a,b));
}
a. “Hello”
b. “Hello World”
c. “HelloWorld”
d. None of the above
Ans: d) World, copies World on a, overwrites Hello in a.
Q19.void func1(int (*a)[10])
{
printf("Ok it works");
}
void func2(int a[][10])
{
printf("Will this work?");
}

main()
{
int a[10][10];
func1(a);
func2(a);
}
a. Ok it works
b. Will this work?
c. Ok it worksWill this work?
d. None of the above
Ans: c)
Q20.main()
{
printf("%d, %d", sizeof('c'), sizeof(100));
}
a. 2, 2
b. 2, 100
c. 4, 100
d. 4, 4
Ans: a) 2, 2
Q21.main()
{
int i = 100;
clrscr();
printf("%d", sizeof(sizeof(i)));
}
a. 2
b. 100
c. 4
d. none of the above

Ans: a) 2
Q22.
main()
{
int c = 5;
printf("%d", main||c);
}
a. 1
b. 5
c. 0
d. none of the above
Ans: a) 1, if we use main|c then error, illegal use of pointer

Q23.main()
{
char c;
int i = 456;
clrscr();
c = i;
printf("%d", c);
}
a. 456
b. -456
c. random number
d. none of the above
Ans: d) -56
Q24.void main ()
{
int x = 10;
printf ("x = %d, y = %d", x,--x++);
}
a. 10, 10
b. 10, 9
c. 10, 11
d. none of the above

Ans: d) Lvalue required
Q25.main()
{
int i =10, j = 20;
clrscr();
printf("%d, %d, ", j-- , --i);
printf("%d, %d ", j++ , ++i);
}
a. 20, 10, 20, 10
b. 20, 9, 20, 10
c. 20, 9, 19, 10
d. 19, 9, 20, 10
Ans: c)
Q26.
main()
{
int x=5;
clrscr();
for(;x==0;x--) {
printf("x=%d\n”", x--);
}
}
a. 4, 3, 2, 1, 0
b. 1, 2, 3, 4, 5
c. 0, 1, 2, 3, 4
d. none of the above
Ans: d) prints nothing, as condition x==0 is False
Q27main()
{
int x=5;
for(;x!=0;x--) {
printf("x=%d\n", x--);
}
}
a. 5, 4, 3, 2,1
b. 4, 3, 2, 1, 0
c. 5, 3, 1
d. none of the above
Ans: d) Infinite loop as x is decremented twice, it never be 0
and loop is going on & on

Q28main()
{
int x=5;
clrscr();
for(;x<= 0;x--)
{
printf("x=%d ", x--);
}
}
a. 5, 3, 1
b. 5, 2, 1,
c. 5, 3, 1, -1, 3
d. –3, -1, 1, 3, 5

Ans: prints nothing, as condition in loop is false.
Q29.main()
{
{
unsigned int bit=256;
printf("%d", bit);
}
{
unsigned int bit=512;
printf("%d", bit);
}
}
a. 256, 256
b. 512, 512
c. 256, 512
d. Compile error
Ans: 256, 512, becoz these r different blocks, so declaration allowed
Q30.main()
{
int i;
clrscr();
for(i=0;i<5;i++)
{
printf("%d\n", 1L << i);
}
}
a. 5, 4, 3, 2, 1
b. 0, 1, 2, 3, 4
c. 0, 1, 2, 4, 8
d. 1, 2, 4, 8, 16

Ans: d) L does't make any diff.
Q31.main()
{
signed int bit=512, i=5;
for(;i;i--)
{
printf("%d\n", bit = (bit >> (i - (i -1))));
}
}
a. 512, 256, 128, 64, 32
b. 256, 128, 64, 32, 16
c. 128, 64, 32, 16, 8
d. 64, 32, 16, 8, 4
Ans: b)
Q32.main()
{
signed int bit=512, i=5;
for(;i;i--)
{
printf("%d\n", bit >> (i - (i -1)));
}
}
a. 512, 256, 0, 0, 0
b. 256, 256, 0, 0, 0
c. 512, 512, 512, 512, 512
d. 256, 256, 256, 256, 256

Ans: d) bit's value is not changed
Q33.main()
{
if (!(1&&0))
{
printf("OK I am done.");
}
else
{
printf("OK I am gone.");
}
}
a. OK I am done
b. OK I am gone
c. compile error
d. none of the above
Ans: a)
Q34main()
{
if ((1||0) && (0||1))
{
printf("OK I am done.");
}
else
{
printf("OK I am gone.");
}
}
a. OK I am done
b. OK I am gone
c. compile error
d. none of the above
Ans: a)
Q35main()
{
signed int bit=512, mBit;
{
mBit = ~bit;
bit = bit & ~bit ;
printf("%d %d", bit, mBit);
}
}
a. 0, 0
b. 0, 513
c. 512, 0
d. 0, -513
Ans: d)


hcl placement papers

Saturday, 5 March 2011

The 10 Worst Mistakes Career Changers Make

Changing careers is never easy. Half the world thinks you've lost your mind, headhunters say you'll never work again and your mother-in-law steps up the old, "I told you so" routine. But for many burned-out, bored or multitalented folks who are sitting on skills they're not getting a chance to use, changing fields is the only way to keep from losing their marbles.

Regardless of your career change strategy, never make these 10 mistakes

1. Don't look for a job in another field without some intense introspection.
Nothing is worse than leaping before you look. Make sure you're not escaping to a field that fits you just as poorly as your last. Check out these self-assessment articles.
Get thorough information about the fields you're considering by networking, reading and doing online research. Having informational interviews with alumni from your college, colleagues, friends or family is a fun way to get the scoop on different fields.

2. Don't look for "hot" fields unless they're a good fit for you.
You wouldn't try to squeeze into your skinny cousin's suit, so why try a field because it works for him? People who are trying to help you will come along and do the equivalent of whispering "plastics" in your ear. Instead of jumping at their suggestions, take time to consider your options. Decide what you really want to do. When you enter a field just because it's hot, burnout isn't far behind.

3. Don't go into a field because your friend is doing well in it.
Get thorough information about the fields you're considering by networking, reading and doing online research. Having informational interviews with alumni from your college, colleagues, friends or family is a fun way to get the scoop on different fields.

4. Don't stick to possibilities you already know about.
Stretch your perception of what might work for you. Read some job profiles and explore career fields you learn about from self-assessment exercises.


5. Don't let money be the deciding factor.
There's not enough money in the world to make you happy if your job doesn't suit you. Workplace dissatisfaction and stress is the number-one health problem for working adults. This is particularly true for career changers, who often earn less until they get their sea legs in a different field.

6. Don't keep your dissatisfaction to yourself or try to make the switch alone.
This is the time to talk to people (probably not your boss just yet). Friends, family and colleagues need to know what's going on so they can help you tap into those 90-plus percent of jobs that aren't advertised until somebody has them all sewn up.

7. Don't go back to school to get retreaded unless you've done some test drives in the new field.
You're never too old for an internship, a volunteer experience or trying your hand at a contract assignment in a new field. There are lots of ways to get experience that won't cost you anything except your time. A new degree may or may not make the world sit up and take notice. Be very sure where you want to go before you put yourself through the pain and debt of another degree program.

8. Be careful when using placement agencies or search firms.
Do some research to be sure to find a good match. Ask those who work in the field you're trying to get into or other successful career changers for suggestions. Try to find a firm that knows how to be creative when placing career changers -- not one that solely focuses on moving people up the ladder in the same field.

9. Don't go to a career counsellor or a career transitions agency expecting they can tell you which field to enter.
Career advisors are facilitators, and they'll follow your lead. They can help ferret out your long-buried dreams and talents, but you'll have to do the research and the decision making by yourself. Anyone who promises to tell you what to do is dangerous.

10. Don't expect to switch overnight.
A thorough career change usually will take a minimum of six months to pull off, and the time frequently stretches to a year or more. Changing fields is one of the most invigorating things you can do. It's like experiencing youth all over again, except with the wisdom of whatever age you are now.