C Programming MCQ Questions | c interview questions

Introduction

In this article, you will find basic to most puzzled interview queries questions. This article is very useful for those who are preparing for an interview in IT company. Whether you are experienced or

techstudy.org

Kindle Paperwhite High Resolution Display Tablet | Rs. 9999


41) An array elements are always stored in ________ memory locations.
  1. Random
  2. Sequential
  3. Sequential and Random
  4. None of the above

⇒ Answer: (B) Sequential

42) What is String concatenation means in C?
  1. Comparing the two strings to define the larger one.
  2. Extracting a substring out of a string.
  3. Combining two strings.
  4. Merging two strings.

⇒ Answer: (C) Combining two strings.

43) The function sprintf() works like printf(), but operates on __________ in C?
  1. string
  2. stderr
  3. Data file
  4. None of the above

⇒ Answer: (A) string

44) What will be the output of the program?

  1. #include<stdio.h>
  2. void main()
  3. {
  4. printf(5+"Good Morningn");
  5. }
  1. Morning
  2. Good morning
  3. M
  4. None of the above

⇒ Answer: (A) Morning

45) What will be the output of the following C code?

  1. #include<stdio.h>
  2. #include<string.h>
  3. void main()
  4. {
  5. char str[] = "Tech\0Study";
  6. printf("%s", str);
  7. }
  1. Tech
  2. Tech Study
  3. Tech\0study
  4. Study

⇒ Answer: (A) Tech

A string is a collection of characters terminated by '\0'.


     

46) What is the return value of the following statement if it is placed in C program? strcmp("ABC", "ABC");
  1. 0
  2. 1
  3. -1
  4. 33

⇒ Answer: (A) 0

47) The library function used to find the last occurrence of a character in a string is
  1. laststr()
  2. strstr()
  3. strrchr()
  4. None of the aboe

⇒ Answer: (C) strrchr()

48) Which of the following function is more appropriate for reading in a multi-word string?
  1. puts()
  2. printf()
  3. gets()
  4. scanf()

⇒ Answer: (C) gets()

49) What will be the output of the program?

  1. #include<stdio.h>
  2. #include<string.h>
  3. void main()
  4. {
  5. char str1[20] = "Hello", str2[20] = " World";
  6. printf("%s", strcpy(str2, strcat(str1, str2)));
  7. }
  1. Hello
  2. WorldHello
  3. Hello World
  4. World

⇒ Answer: (C) Hello World

50) What does the following declaration means in C?

  1. int(*ptr)[10];
  1. ptr is an pointer to array
  2. ptr is an array of 10 integers
  3. ptr is a pointer to an array of 10 integers
  4. ptr is array of pointers to 10 integers

⇒ Answer: (C) ptr is a pointer to an array of 10 integers

« 1 2 3 4 5

Responses




Popular Posts

Facebook

Founded in 2016, Tech Study passionately delivers stylish and dynamic innovative information to programmer and technology lovers. http://www.techstudy.org/.