Select chapter



functions (3.papers)
loops (1.papers)
arrays (2.papers)
structures (3.papers)
unions (1.papers)
pointers (7.papers)
null pointers (1.papers)
strings (2.papers)
misc c concepts (1.papers)
Data structures (5.papers)
linked lists (3.papers)
trees (1.papers)
basics (5.papers)
Hide

Sponsored Links


  

c interview questions and answers

Show Answer
Share Facebook gmail Twitter
2
string functions in c: strlen and strcat
which of the below options are true about string functions?
  1. 1. strlen - Finds size of a string
    '2. strcat - This will append one string at the end of another string
  2. 1. strlen - Finds length of a string
    2.  strcat - This will append one string at the end of another string
  3. 1. strlen - Finds size of a string
    2. strcat - This will append one string at the starting of another string
  4. 1. strlen - Finds length of a string
    2.  strcat - This will append one string at the start of another string
Show Answer
Share Facebook gmail Twitter
3
string functions in c: strncpy and strncat
which of the below options are true about std string functions.
  1. 1. strncpy- This will copy first n characters of one string into another
    2. strncat- This will append first n characters of a string at the end of
                another string
  2. 1. strncpy- This will copy last n characters of one string into another
    2. strncat- This will append first n characters of a string at the end of
                another string
  3. 1. strncpy- This will copy last n characters of one string into another
    2. strncat- This will append last n characters of a string at the end of
                another string
  4. 1. strncpy- This will copy first n characters of one string into another
    2. strncat- This will append end n characters of a string at the end of another string
Show Answer
Share Facebook gmail Twitter
4
Which of the below statements are correct about C strings?
  1. array of characters terminated by '\0' is called as a string.
  2. any array of characters is called as strings, even if it is not terminated with '\0'
  3. in a string (array of characters), some times characters will not be stored in contiguous memory locations.
  4. there is a class String to deal with strings in c.
Show Answer
Share Facebook gmail Twitter
5
Which of the below statements are correct about C strings?
  1. "A" is a string of size 1 byte
  2. 'A' is a character of size 1 byte.
  3. "A" is a string, whose length is 2.
  4. 'A' is a character of length 2 bytes.
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
11
What is the difference between memcpy and memmov functions in c?
  1. both will copy a set of bytes specified from source to destination. no difference.
  2. memcpy will copy specified bytes from source to destination, it also takes care of checkin if memory overlapping is happening between source and destination buffers.
  3. memmov will copy specified bytes from source to destination, it also takes care of checkin if memory overlapping is happening between source and destination buffers.
  4. option 3 is right, and also memmov will take care of creating destination buffer if its size is not fitting or if destination pointer is null
Show Answer
Share Facebook gmail Twitter
12
what is the difference between strcpy and memcpy functions in c?
  1. strcpy used to copy strings from source to destination, it stops when it encounters null character in source.
  2. option 1 is true & memcpy is used to copy set of bytes from source to destination of specified length, it will copy null also if it encounters. copying will be done once it reaches specified size in source buffer. memcpy can be used for copying any memory buffer to other buffer.
  3. option 1 & 2 are right, but memcpy works only with strings just like strcpy.
  4. option 3 is right, and memcpy also stops if it encounters null value in source buffer.
Show Answer
Share Facebook gmail Twitter
Read more papers :