C and Java Programming Fundamentals
Test your knowledge of C and Java programming languages including pointers, operators, expressions, threads, and serialization
Questions
Which conversion is not possible?
- int to float
- float to int
- char to float
- All are possible
Can a static variable be Serialized
- True
- False
Which of the following pairs is not supported in Java
- Multiple Inheritance and Overloading
- Operator Overloading and Overriding
- Multiple Inheritance and Operator Overloading
- Pointers and Single Inheritance
Which of the below methods in Java is not used with threads
- wait()
- run()
- Sleep()
- begin()
What will be the output of the following program : #define Swap if (a != b) { \ temp=a; \ a = b; \ b = temp; \ //Swapping Done } void main() { int a=10,b=5,temp; Swap; printf("a=%d a=%d",a,b); }
- Compile-Time Error
- a=5 b=10
- a=10 b=5
- None of the above
What will be the output of the following program : void main() { int val=50; void ptr; ptr=&val; printf("%d %d",val,(int *)ptr); }C
- Compile-Time Error
- 50 50
- 50 0
- None of the above
What will be the output of the following program : void main() { int a=5,b=6; Printf("%d %d %d",a,b,--a*++b); }
- Compile-Time Error
- 5 6 30
- 4 7 28
- None of the above
What will be the output of the following program : void main() { int val=5; void *ptr; *(int )ptr=5; val=ptr; printf("%d %d",(int )val,(int *)ptr); }
- Compile-Time Error
- Unpredictable
- 5 5
- None of the above
What will be the output of the following program : void main() { int val=2; val = - --val- val--- --val; printf("%d",val); }
- Compile-Time Error
- 3
- -1
- 0
What will be the output of the following program : void main() { int i, n =10; for (i=1; i<n--; i+=2) printf("%d\n", n-i); }
- 84
- 840
- 852
- 864
What will be the output of the following program : void main() { printf("%f",123.); }
- 123
- Compile-Time Error
- 123.00
- 123.000000
What will be the output of the following program : void main() { printf("%d",sizeof(integer)); }
- 2
- 4
- Compile-Time Error
- None of the above