# Fidelity Technical Questions

Posted on :10-03-2016

Q1. Predict the output of

char *concat (char *s1,char *s2)
{
int l1 = strlen(s1), l2 = strlen(s2), i, j;
char s[256];
strcpy(s,s2);
for (i=l1, j=0; j < l2; j++, i++)
s[i] = s2[j] ;
s[i] =
return s;
main()
{
puts(concat("NEWDELHI", "KOLKATA"));
}

A) KOLKATA
B) NEWDELHI KOLKATA
C) KOLKATA NEWDELHI
D) NEWDELHI

ANS: A

Q2. Analyse the following code snippet : Class Temp
{
private:
char m_acEmpName[25];
public:
char* GetFirstChar()
{
strcpy(m_acEmpName,"Hello");
return this->m_acEmpName;
}
};
int main(int argc, char ** argv)
{
Temp oTempObject; cout<
}

A) Displays the first character of the string
B) Displays the complete string Hello
C) Error
D) Displays the last character of the string

ANS: B

Q3. # define preprocessor command can be used for defining

A) macros
B) for loop
C) symbolic constants
D) -both (A) and (C)

ANS: D

Q4. Which one of the following statement is true regarding creation of a thread?

A) less than the time required to create a new process
B) equal the time required to create a new process
C) greater than the time required to create a new process
D) none of the above

ANS: A

Q5. Assume that i ,j and k are integer variables and their values are 8,5 and 0 respectively.
What will be the values of variables i and k after executing the following expressions ?

k=(j>=5) ? (i<5) ? i-j-i : k-j : i ;
i+ = (k)?(i)?(k):(i):(k);

A) -3 and 3
B) 3 and -5
C) 3 and -3
D) -5 and 3

ANS: D

Q6. Virtual memory allows :

A) Execution of a process that may be completely in memory
B) A program to be larger than the physical memory
C) A program to be larger than the secondary storage
D) Execution of a process without being in physical memory

ANS: B

FreshersLive - No.1 Job site in India. Here you can find latest 2020 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.

 ✖