Dear Reader, given are 3 questions asking you to calculate distances based on the travel data given in questions. Though these are simple, they can consume time at times. Hence a good practice is necessary to solve these questions in time.
Question 1
Dear CareersValley Reader,
For HCL interviews, its good to stay prepared on expected areas like OS concepts, C programming concepts, OOPS, networking etc. Below we can discuss three sample tech interview questions.
HCL placement papers generally give substancial weightage to technical questions, especially from C and basic computer science related concepts. A good knowledge in C is very important and can help you a lot in acheiving your dream.
Below let us see some important sample HCL questions for you to practice.
1) The letters P, Q, R, S, T, U and V, not necessarily in that order represents seven
consecutive integers from 22 to 33.
• U is as much less than Q as R is greater than S.
• V is greater than U.
• Q is the middle term.
• P is 3 greater than S.
Can you find the sequence of letters from the lowest value to the highest value?
1) At University of Probability, there are 375 freshmen, 293 sophomores, 187 juniors, & 126 seniors. One student will randomly be chosen to receive an award.
What percent chance is there that it will be a junior? Round to the nearest whole percent.
Answer
19%
1) e(int n)
{
if(n>0)
{
(not clear)
printf("%d",n);
e(--n);
}
return
}
1) Atomicity is _____
a)Either all actions are carried out or none are. Users should not have to worry about the effect of incomplete transactions. DBMS ensures this by undoing the actions of incomplete transactions.
1) ______ is copying the three sets of files (database files, redo logs, and control file) when the instance is shut down. This is a straight file copy, usually from the disk directly
to tape. You must shut down the instance to guarantee a consistent copy.
a) cold backup
b) hot backup
c) Armstrong Rules
Here are some solved questions from HCL Placement Papers
1) #include<stdio.h>
main()
{
struct xx
{
int x=3;
char name[]="hello";
};
struct xx *s=malloc(sizeof(struct xx));
printf("%d",s->x);
printf("%s",s->name);
}
Answer:
Compiler Error
Explanation:
Initialization should not be done for structure members inside the structure declaration
2) main()
{
int *j;
{
int i=10;
j=&i;
}
printf("%d",*j);
}
Answer:
10
Explanation:
The variable i is a block level variable and the visibility is inside that block only. But the lifetime of i is lifetime of the function so it lives upto the exit of main
function. Since the i is still allocated space, *j prints the value stored in i since j points i.
3) int i,j;
for(i=0;i<=10;i++)
{
j+=5;
assert(i<5);
}
Answer:
Runtime error: Abnormal program termination. assert failed (i<5), ,
Explanation:
asserts are used during debugging to make sure that certain conditions are satisfied. If assertion fails, the program will terminate reporting the same. After debugging use,
#undef NDEBUG and this will disable all the assertions from the source code. Assertion is a good debugging tool to make use of..
4) main()
{
int i;
printf("%d",scanf("%d",&i)); // value 10 is given as input here
}
Answer:
1
Explanation:
Scanf returns number of items successfully read and not 1/0. Here 10
is given as input which should have been scanned successfully. So
number of items read is 1.
1) main()
{
static char names[5][20]={"pascal","ada","cobol","fortran","perl"};
int i;
char *t;
t=names[3];
names[3]=names[4];
names[4]=t;
for (i=0;i<=4;i++)
printf("%s",names[i]);
}
Answer: