Fresher Technical Interview Questions

6
 T echnical Inter view Questions: What is your strongest and favorite programming language? Dierence b/w and !ava? What are the dierent storage classes in ? o """#$tern% register % auto and static"""" &ow do you print an address? 'ns: (p in printf to print the address) What are macros ? what are its advantages and disadvantages? o 'ns: *acros are processor directive which will be replaces at compile time)  The disadvant ages with macr os is that they +ust rep lace the code th ey are not function calls) ,imilarly the advantage is they can reduce time for replacing the same values) Dierence b/w call by reference and pass by value?  'ns: -aas by value +ust passes the value from caller to calling function so the called function cannot modify the values in caller function) o .ut pass by reference will pass the address to the caller function instead of value if called function reuires to modify any value it can directly modify ) Write synta$ of switch? an I write the synta$ without default? What is the bene0t of using an enum rather than a 1de0ne constant?  The use of an enumeration constant 2enum3 has many advan tages over usi ng the traditional symbolic constant style of 1de0ne) These advantages include a lower maintenance reuirement% improved program readability% and better debugging capability) The 0rst advantage is that enumerated constants are generated automati4 cally by the compiler) onversely% symbolic constants must be manually assigned values by the programmer) 5or instance% if you had an enumerated constant type for error codes that could occur in your program% your enum de0nition could loo6 something li6e this:  What is the diference between array_name and &array_name? 7ne is a pointer to the 0rst element in the array8 the other is a pointer to the array as a whole) 'n array is a type) It has a base type 2what it9s an array of 3% a sie 2unless it9s an ;incomplete; array3% and a value 2the value of the whole array3) <ou can get a pointer to this value: What is pointer? o 'ns: -ointer is a variable in a program is something with a name% the value of which can vary) o  The way compiler and lin6 er handles t his is that i t assigns) o ' speci0c bloc6 of memory within the computer to hold the values of that variable)

description

Hi

Transcript of Fresher Technical Interview Questions

Page 1: Fresher Technical Interview Questions

7/18/2019 Fresher Technical Interview Questions

http://slidepdf.com/reader/full/fresher-technical-interview-questions 1/6

 Technical Interview Questions:

What is your strongest and favorite programming language?

Dierence b/w and !ava?

What are the dierent storage classes in ?

o """#$tern% register % auto and static""""

&ow do you print an address? 'ns: (p in printf to print the address)

What are macros ? what are its advantages and disadvantages?

o 'ns: *acros are processor directive which will be replaces at compile

time) The disadvantages with macros is that they +ust replace the code they are not

function calls),imilarly the advantage is they can reduce time for replacing the same

values) Dierence b/w call by reference and pass by value?

  'ns: -aas by value +ust passes the value from caller to calling function

so the called function cannot modify the values in caller function)o .ut pass by reference will pass the address to the caller function

instead of value if called function reuires to modify any value it can

directly modify) Write synta$ of switch? an I write the synta$ without default?

What is the bene0t of using an enum rather than a 1de0ne constant?

 The use of an enumeration constant 2enum3 has many advantages over using the

traditional symbolic constant style of 1de0ne) These advantages include a lower

maintenance reuirement% improved program readability% and better debugging

capability) The 0rst advantage is that enumerated constants are generated

automati4 cally by the compiler) onversely% symbolic constants must be manually

assigned values by the programmer) 5or instance% if you had an enumeratedconstant type for error codes that could occur in your program% your enum de0nition

could loo6 something li6e this:

 What is the diference between array_name and &array_name?

7ne is a pointer to the 0rst element in the array8 the other is a pointer to the array

as a whole)

'n array is a type) It has a base type 2what it9s an array of 3% a sie 2unless it9s an

;incomplete; array3% and a value 2the value of the whole array3) <ou can get a

pointer to this value:

What is pointer?

o 'ns: -ointer is a variable in a program is something with a name% the

value of which can vary)o  The way compiler and lin6er handles this is that it assigns)

o ' speci0c bloc6 of memory within the computer to hold the values of

that variable)

Page 2: Fresher Technical Interview Questions

7/18/2019 Fresher Technical Interview Questions

http://slidepdf.com/reader/full/fresher-technical-interview-questions 2/6

What is the di b/w null and void pointer?

'ns: =ull pointer has the value >) oid is generic pointer introduced by '=,I)

@eneric pointer can hold the address of any data type) Di b/w 'rrays and structures?

What is Data structures and why we are learn and where we can use those?

What are the sorting techniues are available?

'dvantages of macros over function?

Write a c program to print &ello world without using any semicolon)

'ns: ,olution: A

void main23B

  if2printf2;&ello world;33B

  C

C

,olution:

void main23B

  while2Eprintf2;&ello world;33B

  C

C

,olution: F

void main23B

  switch2printf2;&ello world;33B

  C

C

,wap two variables without using third variable)

#include<stdio.h>

int main(){

Page 3: Fresher Technical Interview Questions

7/18/2019 Fresher Technical Interview Questions

http://slidepdf.com/reader/full/fresher-technical-interview-questions 3/6

  int a=5,b=10;

//process one

  a=ba;

  b=a!b;

  a=a!b;

  print"(a= $d b= $d,a,b);

//process t%o

  a=5;

  b=10;

  a=ab!(b=a);

  print"(&na= $d b= $d,a,b);

//process three

  a=5;

  b=10;

  a=a'b;

  b=a'b;

  a=b'a;

  print"(&na= $d b= $d,a,b);

 //process "our

  a=5;

  b=10;

  a=b!a!1;

  b=ab1;

  a=ab1;

  print"(&na= $d b= $d,a,b);

 

//process "ie

  a=5,

  b=10;

  a=ba,b=a!b,a=a!b;

  print"(&na= $d b= $d,a,b);

Page 4: Fresher Technical Interview Questions

7/18/2019 Fresher Technical Interview Questions

http://slidepdf.com/reader/full/fresher-technical-interview-questions 4/6

  return 0;

*

Why we use do4while loop in c? 'lso tell any properties which you 6now?

What is the meaning of prototype of a function?

Prototype of a function

+eclaration o" "unction is no%n as protot-pe o" a

"unction. rotot-pe o" a "unction means

(1) hat is return t-pe o" "unction

() hat parameters are %e passin2

(3) 4or eample protot-pe o" print" "unction is6

int print"(const char 7, 8);

9.e. its return t-pe is int data t-pe, its "irst

parameter constant character pointer and second

parameter is ellipsis i.e. ariable number o"

ar2uments.

 Write a c program to find size of

structure without using sizeof operator?

:planation6

struct  {

  int a;  "loat b;

  char c;

*;

int main(){

  struct  7ptr=(struct  7)0;

Page 5: Fresher Technical Interview Questions

7/18/2019 Fresher Technical Interview Questions

http://slidepdf.com/reader/full/fresher-technical-interview-questions 5/6

  ptr;

  print"(i?e o" structure is6 $d,7ptr);

  return 0;

*

1. Write a program to find factorial of the given number...

2. Write a program to check whether the given number is even or odd.

3. Write a program to swap two numbers using a temporary variable.

4. Write a program to swap two numbers without using a temporary variable.

5. Write a program to swap two numbers using bitwise operators.

6. Write a program to find the greatest of three numbers.

7. Write a program to find the greatest among ten numbers.

8. Write a program to check whether the given number is a prime.

9. Write a program to check whether the given number is a palindrome c number.

10.Write a program to check whether the given string is a palindrome .

11.Write a program to generate the Fibonacci series.

12.Write a program to print"Hello World"without using semicolon anywhere in the code.

13.Write a program to print a semicolon without using a semicolon anywhere in the code.

14.Write a program to compare two strings without using strcmp() function.

15.Write a program to concatenat e two strings without using strcat() function.

16.Write a program to delete a specified line from a text file.

17.Write a program to replace a specified line in a text file.

18.Write a program to find the number of lines in a text file..

19.Write a C program which asks the user for a number between 1 to 9 and shows the number. If the

user

inputs a number out of the specified range, the program should show an error and prompt the user

for a

valid input.

20.Write a program to display the multiplica tion table of a given number..

21.WAP to check a string is Caliondrom e or not. // Maventic question.

22.WAP to print DONE,witho ut using any loop. // asked to my frnd in any company.

23.WAP to print DONE,witho ut using any loop and any conditonal clause or operators. // asked to

me as a cross question of 22th question by the person i asked 22th ques.

Page 6: Fresher Technical Interview Questions

7/18/2019 Fresher Technical Interview Questions

http://slidepdf.com/reader/full/fresher-technical-interview-questions 6/6

24. WAP to find out the longest word in a string.

25.Prog of WORLD MAP. // this code was written by someone,i forgot his name,he won award for

this code as short and best c code. JUST FOR FUN //

26.WAP to print the triangle of letters in increasing order of lines..

27.WAP to print'xay'in place of every'a'in a string.// DOC Update on 24-jan-12.

28.Count the Total Number of 7 comming between 1 to 100.

 /* I made this code in a way that u can give Upper limit i.e. 100,Lower limit i.e. 1 and the specific

number u wants to count in between i.e. 7 */ // asked by: Vishwa Pratap Rana..

29. Code for duplicate' s removal,by Amit Aru.. // Similar question was asked in Maventic 2nd round

to me,,

30. WAP to find out if a given number is a power series of 2 or not,withou t any loop and without

using % modulo operator..