2023 2024 Student Forum > Management Forum > Main Forum

 
  #2  
15th November 2014, 10:25 AM
Super Moderator
 
Join Date: Apr 2013
Re: Question Paper of Tech Mahindra

You want to get the Tech Mahindra Technical Paper, so I am giving you some questions of that paper:

1. #include
* What is wrong in the following problem
main() {
int i,j;
j = 10;
i = j++ - j++;
printf("%d %d", i,j);
}ans: 0, 12
2.#include
* What is the output of the following problem
main() {
int j;
for(j=0;j<3;j++)
foo();
}
foo() {
static int i = 10;
i+=10;
printf("%d\n",i);
}
/* Out put is (***since static int is used i value is retained between
* 20 function calls )
* 30
* 40
*/
3.#include
#include
#include
/* This is asked in PCS Bombay walk-in-interview
* What is wrong in the following code
*/
main()
{char *
c;
c = "Hello";
printf("%s\n", c);
}
/*ans:- Hello, The code is successfully running */

4. #include
/* This problem is given in PCS BOMBAY walk-in-interview.
* What is the final value of i and how many times loop is
* Executed ?
*/
main()
{int i,j,k,l,lc=0;
/* the input is given as 1234 567 */
printf("Enter the number string:<1234 567 \n");
scanf("%2d%d%1d",&i,&j,&k);
for(;k;k--,i++)
for(l=0;l
printf("%d %d\n",i,l);}
printf("LOOPS= %d\n", lc-1);
}/* Ans: i
=
16, and loop is executed for 169 times */

5.#include
/* This is given in PCS Bombay walk-in-interview */
/* What is the output of the following program */

main() {
union {
int a;
int b;
int c;
} u,v;
u.a = 10;
u.b = 20;
printf("%d %d \n",u.a,u.b);
}/* Ans :
The latest value assigned to any of the union member
will be present in the union members so answer is
20 20
*/








For full details of question paper I am uploading a pdf file which is free to download:
Attached Files
File Type: pdf Tech Mahindra Technical Paper.pdf (66.7 KB, 88 views)


Quick Reply
Your Username: Click here to log in

Message:
Options

Thread Tools Search this Thread



All times are GMT +5. The time now is 02:09 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
SEO by vBSEO 3.6.0 PL2

1 2 3 4