NPTEL | Week 0 | Assignment 0 | Programming in Java | Answer Sheet

Answer Sheet

NPTEL

Week 0 | Assignment 0

Total Questions : 15


Question 1: In C Programming what is the use of the `%d` format specifier in the `printf()` function?

  1. Print Double type value
  2. Print Integer type value
  3. Print character type value
  4. Print string type value

Answer: B

Hint: "In C programming, the %d format specifier in the printf function is used to print integer type values."


Question 2: Consider the Following code and answer the question.

C
int main(){
        int a[8] = {3,1,0,5,2,7,6,4};
}

What is the value of a[a[a[3]]]? Select your correct answer from the following options?

  1. Program is with compile-time error.
  2. program is with run-time error
  3. NULL
  4. 4

Answer: D

Hint: a[3] = 5 , a[5]=7, a[7]=4 | a[a[a[3]]] => a[a[5]] => a[7] 


What's Your Reaction?

like
0
dislike
0
love
0
funny
0
angry
0
sad
0
wow
0