1. Given this snippet of codes, what is the expected output?
void func(int *x, int y)
{
*x = *x + y;
y = 2;
}
void main()
{
int x = 10, y = 10;
func(&x, y);
printf("x: %d, y: %d", x, y);
}
x= ? y=?
2.
Given this snippet of codes, what is the expected output?
void func(int *x, int y)
{
*x = *x + y;
x = 10;
}
void main()
{
int x = 10, y = 10;
func(&x, y);
printf("x: %d, y: %d", x, y);
}
x=?, y=?
Please explain, thanks!
1. Given this snippet of codes, what is the expected output? void func(int *x, int y)...
Three is 3 questions please answer them all Question 1 int main(void) { int x = 10, y = 20; if (x == y); printf ("\n%d %d",x,y); } Output as you would see on the compiler: Question 2 int main(void) { int x = 3, y = 5; if (x == 3) printf ("\n%d",x); else ; printf("%d", y); return 0; Output as you would see on the compiler: Question 3 int main(void) { int x = 3; float y =...
Consider the following program: # include <iostream> int x = 3, y = 5; void foo(void) { x = x + 2; y = y + 4; } void bar(void) { int x = 10; y = y + 3; foo( ); cout << x << endl; cout << y << endl; } void baz(void) { int y = 7; bar( ); cout << y << endl; } void main( ) { baz( ); } What output does this program...
OPERATING SYSTWM Question 31 What is the output of this C program? #include #include void main() int mptr, *cptr mptr = (int*)malloc(sizeof(int)); printf("%d", "mptr); cptr = (int)calloc(sizeof(int),1); printf("%d","cptr); garbage 0 000 O garbage segmentation fault Question 8 1 pts If this program "Hello" is run from the command line as "Hello 12 3" what is the output? (char '1'is ascii value 49. char '2' is ascii value 50 char'3' is ascii value 51): #include<stdio.h> int main (int argc, char*argv[]) int...
What is the output of the following program? int main(void) { int x, y, z; x = 5; y= test(x); z= x + y; cout<< setw(4)<<x <<” + “<<setw(4)<<y<<”=” << setw(4)<<z<<endl; return 0; } int test (int x) { int w; w = x + 10; return (w); }
(a)How many times does the code snippet given below display "Hello"? int x = 1; while (x != 15) { System.out.println ("Hello"); x++; } (b)What is the output of the following code fragment? int i = 1; int sum = 0; while (i <= 5) { sum = sum + i; i++; } System.out.println("The value of sum is " + sum); Quie 2 What is the output of the following snipped code? public class Test {...
QUESTION 1 What is the output of the following code snippet? int main() { bool attendance = false; string str = "Unknown"; attendance = !(attendance); if (!attendance) { str = "False"; } if (attendance) { attendance = false; } if (attendance) { str = "True"; } else { str = "Maybe"; } cout << str << endl; return 0; } False True Unknown Maybe QUESTION 2 What is the output of the following code snippet? #include <iostream> #include <string> using...
c program void funcint x, int *y) { 1. Whof the Rings gical ASA All of the above 1.0.2.4) What will be the out of the de int, pat) A) 10 12 (1.03.2) What will be the output of the following int , printf(d, a,b); A) & B) 17 11.12 D) 17.25 13. (L032) An array is a group of memory locations related by the fact that they all have my name and pe A) different different B) same, different...
1. What is the output of the following program? include <stdio.h> int wilma (int x) if (x<5) x = 7; return (x) int main (void) int x-1 x=wilma (x) ; printf ("%d", x); return (0) b)3 c) 4 d) 7 a) 1 e) none of these
Consider the following program: # include <iostream> using namesapce std; void Func(int a, int bl double number-25.0: int main) f int x-18, y-20; cout<c"Before: x- kex<" and y-eyecendl; Fundxy 1// end of main void Funcfint a, int b) int sum a+b; a-200; b-300; numberanumber+1.0 Which of the statements below are correct? (Select only the correct answers. There may be more than one) D A The statement double number-25.0; declares a global variable number B. The variables x and y are...
A) Complete the following C program to produce the following output: Output: x = 1, y = 2, z = 3 x = 10, y = 15.000000, z = 4 x = 10, y = 15.000000, z = 50 Program: #include int main(void) { // complete this line printf(" x = %d, y = %d, z = %d \n", x, y, z); { // complete this line // complete this line printf(" x = %d, y = %f, z =...