Hi Guest

MobileUser

1 HomePage 1 Jobs 1 WalkIn 1Articles  

Cat Exam

 :) Latest Topic
VB.NET
Perl
COBOL
Pascal
FORTRAN
BASIC
Ada
C++
Scala
ASP.NET
 C
 :) Hot Jobs
 
 :) Latest Articles


  

 


Choose the correct option of C Language
Question Posted on 01 Feb 2021

Home >> 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



 
 Input Your Comments Or suggestions(If Any)
 Name
 Email(optional)
 Comments


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?






 
Top Searches:asp net questions vb net questions sql query uddl questions class javascript Questions sharepoint interview questions and concept silverlight questions and concept wcf questions beans general knowledge ajax questions
PHP | Biztalk | Testing | SAP | HR |