Home » Aptitude Questions and Answers » C Aptitude Questions and Answers

C printf based Aptitude Questions and Answers



This section contains Aptitude Questions and Answers on C language C printf based (with multiple answers) with explanation.
Submitted by Ashish Varshney, on February 21, 2018

List of C programming printf based Aptitude Questions and Answers

1) What will be the answer of the code?

int main()
{
	int a=1,b=2,c=3;
	printf("%d %d %d");
	return 0;
}
  1. Garbage value
  2. compile_time Error
  3. 3 2 1
  4. None of above

2) What will be the answer of the code?

#define print  "%sincludehelp "
int main()
{
	int a=1,b=2,c=3;
	printf(print,print);
	return 0;
}
  1. Garbage value
  2. includehelp %sincludehelp
  3. %sincludehelpincludehelp
  4. None of the above

3) What will be the output?

int main()
{
	int a=34;
	printf("%d %i %p %n",a,a,a,a);
	return 0;
}
  1. 34 34 00 22
  2. compile_time Error
  3. 34
  4. None of these.

4) What will be the output?

int main()
{
	char *str="includehelp";
	printf("%s",str+7);
	return 0;
}
  1. help
  2. includehelp
  3. ehelp
  4. None of these

5) What will be the output?

int main()
{
	printf("%d",printf("includehelp"));
	return 0;
}
  1. 11includehelp
  2. includehelp11
  3. compile_time error
  4. None of these

6) What will be the output?

int main()
{
	int n=0;
	while(n<printf("MENU\n"))
	{
		n++;
	}
	return 0;
}
  1. MENU
    MENU
    MENU
    MENU
    MENU
    MENU
  2. MENU
    MENU
    MENU
    MENU
    MENU
  3. compile_time error
  4. None of these






Was this page helpful? YES NO

Are you a blogger? Join our Blogging forum.



Comments and Discussions





© https://www.includehelp.com (2015-2018), Some rights reserved.




close Like other websites, this site uses cookies to deliver relevant ads based on your interest, by using our website, you acknowledge that you have read our privacy policy.