What is the output of the following program ? Justify your answer.
class Check {
public static void chg (String (nm))
{
nm = "Aamna" ; // copy "Aamna" to nm
}
public void test() {
String name = "Julius" ;
System.out.println (name);
chg(name);
System.out.println(name);
}
}
Answers
Answered by
0
Answer:
Output of C programs | Set 32
Predict the output of the following C programs.
1. What will be the output of following program?
Input:
1 3
#include<stdio.h>
int main()
{
int a, b;
if(scanf("%d%d", &a, &b)==2)
printf("true");
else
printf("false");
return 0;
}
Output:
True
Explanation: Scanf function returns integer value as its return type is integer. In the above question, if you will enter two integer values, then it will return 2. It means “if condition” becomes true, otherwise “if condition” becomes false.
2. What will be the output of following program?:
#include<stdio.h>
int main()
{
int a=0;
a=a++ + a++ - a++ + ++a;
printf("%d\n", a);
return 0;
}
Similar questions