ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
tip       Ask Questions on ANYTHING, that arise in your Daily Life at     FORUM9.COM
Google
 
Categories  >>  Software  >>  Programming Languages  >>  C++  >>  C++ General
 
 


 

 
 STL interview questions  STL Interview Questions
 OOPS interview questions  OOPS Interview Questions
 C++ General interview questions  C++ General Interview Questions
Question
What is the output of printf("%d")?
 Question Submitted By :: Guest
I also faced this Question!!     Rank Answer Posted By  
 
  Re: What is the output of printf("%d")?
Answer
# 1
it is used to print one integer data type value.
 
Is This Answer Correct ?    6 Yes 3 No
Guest
 
  Re: What is the output of printf("%d")?
Answer
# 2
it will print nothing
 
Is This Answer Correct ?    3 Yes 3 No
Anita Sachdeva
 
 
 
  Re: What is the output of printf("%d")?
Answer
# 3
the output of printf("%d") is create a blankspace
 
Is This Answer Correct ?    1 Yes 5 No
Priya
 
  Re: What is the output of printf("%d")?
Answer
# 4
it will get syntaxerror
 
Is This Answer Correct ?    1 Yes 7 No
Mounika
 
  Re: What is the output of printf("%d")?
Answer
# 5
it was compiled in dev c++

prints  a value 31783972
 
Is This Answer Correct ?    2 Yes 5 No
Kumar
 
  Re: What is the output of printf("%d")?
Answer
# 6
It will print "1"
 
Is This Answer Correct ?    1 Yes 5 No
Yogendra Jain
 
  Re: What is the output of printf("%d")?
Answer
# 7
it will give output "0"
 
Is This Answer Correct ?    2 Yes 5 No
Sid
 
  Re: What is the output of printf("%d")?
Answer
# 8
It will print -26
 
Is This Answer Correct ?    0 Yes 5 No
Raj
 
  Re: What is the output of printf("%d")?
Answer
# 9
It will print the garbage value.
 
Is This Answer Correct ?    2 Yes 4 No
Kesavan
 
  Re: What is the output of printf("%d")?
Answer
# 10
int a=30;
printf("%d");

the output is 30
 
Is This Answer Correct ?    2 Yes 5 No
Uma Sankar Pradhan
 
  Re: What is the output of printf("%d")?
Answer
# 11
It will print a garbage value.
 
Is This Answer Correct ?    2 Yes 2 No
Mohanraj
 
  Re: What is the output of printf("%d")?
Answer
# 12
it will give an expression syntax error as printf must have 
an expression like ;
 
Is This Answer Correct ?    1 Yes 4 No
Mousam Sahu
 
  Re: What is the output of printf("%d")?
Answer
# 13
garbage value
 
Is This Answer Correct ?    2 Yes 3 No
Vanitha
 
  Re: What is the output of printf("%d")?
Answer
# 14
it will print some value currently on top of the stack
 
Is This Answer Correct ?    1 Yes 1 No
Anand
 
  Re: What is the output of printf("%d")?
Answer
# 15
it will give the statement missing error
bcoz printf must have the statment ilke ;
 
Is This Answer Correct ?    0 Yes 2 No
Mousam Sahu
 
  Re: What is the output of printf("%d")?
Answer
# 16
Hey people

It will not give any syntax error more specifically.. it
will not give any type of error..

The output depends on the compiler u r using...
if it is GCC of linux then O/p== garbage value
there are compilers which will give the last integer value
assigned..
example...
i=30;
printf("%d");

will give ouput 30... but for Gcc it will be garbage value.
 
Is This Answer Correct ?    2 Yes 2 No
Cooooooool Bipul
 
  Re: What is the output of printf("%d")?
Answer
# 17
printf"%d");
it just prints '0'
 
Is This Answer Correct ?    0 Yes 3 No
Reegan
 
  Re: What is the output of printf("%d")?
Answer
# 18
When insufficent argumrnts r give 2 c compiler it give
arbitrary answers
in turbo c it gives o/p =0
in other compiler it trys 2 read values from last stack top
i.e garbage
some compiler can may even crash
 
Is This Answer Correct ?    0 Yes 2 No
Creed
 
  Re: What is the output of printf("%d")?
Answer
# 19
it will eat idly
 
Is This Answer Correct ?    1 Yes 3 No
Loose
 
  Re: What is the output of printf("%d")?
Answer
# 20
it will display only garbage value
 
Is This Answer Correct ?    1 Yes 1 No
Soundar
 
  Re: What is the output of printf("%d")?
Answer
# 21
%d
 
Is This Answer Correct ?    0 Yes 5 No
Jino
 
  Re: What is the output of printf("%d")?
Answer
# 22
it will display only garbage value because
int a=12;
printf("%d");
output=12
 
Is This Answer Correct ?    1 Yes 1 No
Ashif Ali
 
  Re: What is the output of printf("%d")?
Answer
# 23
It will give a garbage value. It is tested.
 
Is This Answer Correct ?    2 Yes 1 No
Sanjiv
 
  Re: What is the output of printf("%d")?
Answer
# 24
the o/p is 0.
 
Is This Answer Correct ?    0 Yes 2 No
Shruthi
 
  Re: What is the output of printf("%d")?
Answer
# 25
The output is 0
 
Is This Answer Correct ?    0 Yes 1 No
Keshav.gadde
 

 
 
 
Other C++ General Interview Questions
 
  Question Asked @ Answers
 
What is Memory Alignment? TCS1
class HasStatic { static int I; }; Referring to the sample code above, what is the appropriate method of defining the member variable "I", and assigning it the value 10, outside of the class declaration? a) HasStatic I = 10; b) int static I = 10; c) static I(10); d) static I = 10; e) int HasStatic::I = 10; Quark1
when can we use virtual destructor? HP2
What is "map" in STL?  1
What are the advantages and disadvantages of using inline and const? TCS1
Write the program form Armstrong no in c++?  4
How would you stop a class from class from being derived or inherited?The constructer should not be Private,as object instantiation should be allowed.  14
what is pulse code modulation? Wipro1
class X { private: int a; protected: X(){cout<<"X constructor was called"<<endl;} ~X(){cout<<"X destructor was called"<<endl} }; Referring to the code above, which one of the following statements regarding "X" is TRUE? a) X is an abstract class. b) Only subclasses of X may create X objects. c) Instances of X cannot be created. d) X objects can only be created using the default copy constructor. e) Only friends can create instances of X objects. Quark2
int f() { int I = 12; int &r = I; r += r / 4; int *p = &r; *p += r; return I; } Referring to the sample code above, what is the return value of the function "f()"? a) 12 b) 15 c) 24 d) 17 e) 30 Quark2
Why do C++ compilers need name mangling? Lucent1
What C++ libraries are you proficient with? Google1
How do you link a C++ program to C functions?  2
Can inline functions have a recursion? Give the reason?  1
Write a program to reverse a linked list? Catalytic-Software2
1. What does the following do: void afunction(int *x) { x=new int; *x=12; } int main() { int v=10; afunction(&v); cout<<v; } a) Outputs 12 b) Outputs 10 c) Outputs the address of v Quark3
this is to swap to strings....but in output the whole strings are swapped leaving first as it is...why it is so #include<iostream.h> int main() { char a[]="ajeet"; char b[]="singh"; long x=*a; long y=*b; cout<<x<<":"<<y; x=x+y; y=x-y; x=x-y; *a=x; *b=y; cout<<x<<":"<<y; cout<<&a<<endl; cout<<&b<<endl; }  1
What are the differences between a struct and a class in C++? Wipro4
What is design pattern? Samsung2
How to construct virtual constructor Symphony4
 
For more C++ General Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com