crackyourinterview.com


To improves our performance please Like Share Subscribe(Will boost us)

Choose the correct option of C Language
Question Posted on 01 Feb 2021Home >> Programming Languages >> C >> Choose the correct option of C Language

Choose the correct option of C Language
Below are the different questions of C language and choose the correct answers
(1)Find output of below code
#include
int main()
{
  static int a=5;
  if(--a)
  {
   main();
   printf("%d ",a);
  }
  return 0;
}
Choose the correct options from below list
(i)1 2 3 4
(ii)4 3 2 1
(iii)0 0 0 0
(iv)Compiler Error


(2)Find output of below code
#include
int main()
{
  static int i=5;
  if (--i)
  {
   printf("%d ",i);
   main();
  }
}
Choose the correct options from below list
(i)1 2 3 4
(ii)4 3 2 1
(iii)0 0 0 0
(iv)Compiler Error


(3)Find output of below code
#include
int main()
{
  int x = 5;
  int * const ptr = &x;
  ++(*ptr);
  printf("%d", x);
  return 0;
}
Choose the correct options from below list
(i)Compiler Error
(ii)Runtime Error
(iii)6
(iv)5


(4)Find output of below code
#include
int main()
{
  int x = 5;
  int const * ptr = &x;
  ++(*ptr);
  printf("%d", x);
  return 0;
}
Choose the correct options from below list
(i)Compiler Error
(ii)Runtime Error
(iii)6
(iv)5


(5)Find output of below code
#include
int main()
{
  typedef static int *i;
  int j;
  i a = &j;
  printf("%d", *a);
  return 0;
}
Choose the correct options from below list
(i)0
(ii)Runtime Error
(iii)Garbage Value
(iv)Compiler Error

Answer:-
(1)(iii)0 0 0 0
(2)(ii)4 3 2 1
(3)(iii)6
(4)(i)Compiler Error Reason:-++(*ptr) is incorrect
(5)(iv)Compiler Error Reason:- typedef static int *i;
0
0



.


Most Visited Questions:-

Deep Learning Questions Answers
Below are the different Deep Leaning Questions and answer a More...

Continuous Integration Questions Answers
Below are the 20 odd questions for CI or Continuous Integra More...

Derived relationships in Association Rule Mining are represented in the form of __________.
Derived relationships in Association Rule Mining are repres More...

What is Gulpjs and some multiple choice questions on Gulp
Gulpjs is an open source whihc helps in building Javascript More...

Microservices Architecture Questions Answers
Below are the different questions on Microservices Architec More...




Other Important Questions

Choose the correct option of C Language

How to open file in c program with syntax and file pointer?

Swaping of value of two variables in c through pointer?

Code to print Even number in c Language

What would be the output of the following C program use of sizeof?






@2014-2022 Crackyourinterview (All rights reserved)
Privacy Policy - Disclaimer - Sitemap