# Problem Solving Through Programming In C NPTEL Week 7 Solutions

This set of MCQ(multiple choice questions) focuses on the Problem Solving Through Programming In C Week 7 Solutions.

NOTE: You can check your answer immediately by clicking show answer button. Problem Solving Through Programming In C Week 7 answers” contains 10 questions.

Now, start attempting the quiz.

### Problem Solving Through Programming In C Week 7 answers

Q1. Which of the following statements are correct?
1) A string is a collection of characters terminated by ‘\0’.
2) The format specifier %s is used to print a string.
3) The length of the string can be obtained by strlen().
4) strcon() function is used to join two strings.

a) 1, 2
b) 1, 2, 3
c) 2, 4
d) 1, 3

Problem Solving Through Programming In C Week 7 answers

Q2. The right method of initializing a 2D array is

a) int abc[2][2] = {1, 2, 3, 4}
b) int abc[][] = {1, 2, 3, 4}
c) int abc[2][] = {1, 2, 3, 4}
d) All of the above

Answer: a) int abc[2][2] = {1, 2, 3, 4}

Q3. Array passed as an argument to a function is interpreted as

a) Address of all the elements in an array
b) Value of the first element of the array
c) Address of the first element of the array
d) Number of element of the array

Problem Solving Through Programming In C Week 7 answers

Q4. What will be the outupt?

``````#include<stdio.h>
int main()
{
int disp[3][4] = {{5, 6, 8, 2}, {4, 5, 3, 7}, {1, 10, 13, 15}};
printf("%d\n", disp[2][1]);
return 0;
}``````

Q5. Find the output of the following C program.

``````#include<stdio.h>
int main()
{
char a[10][8] = {"hi", "hello", "fellows"};
printf("%s", a[2]);
return 0;
}``````

a) fellows
b) h
c) fello
d) Compiler error

Problem Solving Through Programming In C Week 7 answers

Q6. What will be the output?

a) n1=18, n2=17
b) n1=18, n2=18
c) n1=17, n2=17
d) n1=17, n2=18

Q7. Consider the following C program segment:

a) gnirts
b) gnirt
c) string
d) no output is printed

Answer: d) no output is printed

Q8. If the starting address of an float array Arr[10][10] is 2000, what would be the memory address of the element Arr[5][6]? (float takes 4 bytes of memory)

a) 2268
b) 2120
c) 2224
d) 2144

Problem Solving Through Programming In C Week 7 answers

Q9. In C, the placement of elements of a two dimensional array is

a) Row wise
b) Column wise
c) Diagonal wise
d) Bottom to top wise

Q10. What will be the value of ‘i’ after the execution of the C code fragment given below?

Problem Solving Through Programming In C Week 7 answers

### Problem Solving Through Programming In C Week 7 answers

Q1. The searching operation in an array is done using

a) Key and index
b) Only key
c) Only index
d) None of these

Problem Solving Through Programming In C Week 7 answers

Q2. Find the output of the following C program

a) fellows
b) h
c) fello
d) Compiler error

Q3. What will be the output?

a) n1=18, n2=17
b) n1=18, n2=18
c) n1=17, n2=17
d) n1=17, n2=18

Problem Solving Through Programming In C Week 7 answers

Q4. Consider the following C program segment:

a) gnirts
b) gnirt
c) string
d) no output is printed

Q5. What will be the value of ‘i’ after the execution of the C code given below?

a) 0
b) 1
c) -1
d) None

Problem Solving Through Programming In C Week 7 answers

Q6. If the starting address of an float array Arr[10][10] is 2000, what would be the memory address of the element Arr[5][6]? (float takes 4 bytes of memory)

a) 2268
b) 2120
c) 2224
d) 2144

Q7. In C, the placement of elements of a two dimensional array is

a) Row wise
b) Column wise
c) Diagonal wise
d) Bottom to top wise

Problem Solving Through Programming In C Week 7 answers

Q8. What will be the output?

Problem Solving Through Programming In C Week 7 answers

Q9. What will be the output?

a) the string is empty
b) The string is not empty
c) Error
d) None of the above

Q10. What is the output of the following C code?

a) Compilation error
b) 7
c) 1
d) 2

Problem Solving Through Programming In C Week 7 answers

### Previous Year – Problem Solving Through Programming In C Week 7 answers

Q1. Which of the following statement/s are false?
I. Array elements are stored in memory in contiguous locations.
II. An integer array always terminates with ‘\0’ (NULL).

a) I
b) II
c) Both I and II
d) None

Problem Solving Through Programming In C Week 7 answers

Q2. If two strings are identical, then strcmp() function returns

a) 1
b) 0
c) -1
d) None of these

Q3. Which of the following function is more appropriate for reading in a multi word string?

a) scanf()
b) gets()
c) printf()
d) puts()

Problem Solving Through Programming In C Week 7 answers

Q4. What will be printed after execution of the following code?
#include<stdio.h>
int main()
{
int a[20] = {10, 20, 30, 40, 50, 60};
printf(“%d”, 3[a]);
return 0;
}

Q5. What will be the output of the program?

a) Array
b) Array String
c) Array\0String
d) Compilation error

Problem Solving Through Programming In C Week 7 answers

Q6. What will be the output?

a) Programming
b) Language
c) ProgrammingLanguage
d) LanguageProgramming

Q7. What will be the output?

a) n1= 8, n2=8
b) n1=9, n2=9
c) n1=8, n2=9
d) n1=9, n2=8

Q8. What will be the output?

Problem Solving Through Programming In C Week 7 answers

Q9. What will be the output?

a) assignment
b) tnemngissa
c) nothing will be printed
d) tttttttttt

Answer: c) nothing will be printed

Q10. What will be the output?

a) Two strings are equal
b) Two strings are not equal
c) Would not print anything
d) Compilation error

Answer: c) Would not print anything

Problem Solving Through Programming In C Week 7 answers

<< Prev – An Introduction to Programming Through C Week 6 Solutions

>> Next- An Introduction to Programming Through C Week 8 Solutions

`DISCLAIMER: Use these answers only for the reference purpose. Quizermania doesn't claim these answers to be 100% correct. So, make sure you submit your assignments on the basis of your knowledge.`

For discussion about any question, join the below comment section. And get the solution of your query. Also, try to share your thoughts about the topics covered in this particular quiz.