What will be output if you will compile and execute the
following c code?
#include<stdio.h>
int main(){
int i=320;
char *ptr=(char *)&i;
printf("%d",*ptr);
return 0;
What will be output if you will compile and execute the
following c code?
#include<stdio.h>
#define x 5+2
int main(){
int i;
i=x*x*x;
printf("%d",i);
return 0;
}
What will be output if you will compile and execute the
following c code?
#include<stdio.h>
int main(){
char c=125;
c=c+10;
printf("%d",c);
return 0;
}
What will be output if you will compile and execute the
following c code?
#include<stdio.h>
int main(){
float a=5.2;
if(a==5.2)
printf("Equal");
else if(a<5.2)
printf("Less than");
else
printf("Greater than");
return 0;
}
What will be output if you will compile and execute the
following c code?
#include<stdio.h>
int main(){
int i=4,x;
x=++i + ++i + ++i;
printf("%d",x);
return 0;
}
What will be output if you will compile and execute the
following c code?
#include<stdio.h>
int main(){
int a=10;
printf("%d %d %d",a,a++,++a);
return 0;
What will be output if you will compile and execute the
following c code?
#include<stdio.h>
int main(){
char *str="Hello world";
printf("%d",printf("%s",str));
return 0;
}
What will be output if you will compile and execute the
following c code?
#include <stdio.h>
#include <string.h>
int main(){
char *str=NULL;
strcpy(str,"cquestionbank");
printf("%s",str);
return 0;
}
What will be output if you will compile and execute the
following c code?
#include <stdio.h>
#include <string.h>
int main(){
int i=0;
for(;i<=2;)
printf(" %d",++i);
return 0;
}
What will be output if you will compile and execute the
following c code?
#include<stdio.h>
int main(){
int x;
for(x=1;x<=5;x++);
printf("%d",x);
return 0;
}
Consider the following program:
import myLibrary.*;
public class ShowSomeClass
{
// code for the class...
}
What is the name of the java file containing this program?
Which of the following is TRUE?
Consider the following code snippet
String river = new String(“Columbia”);
System.out.println(river.length());
What is printed?
What is different between a Java applet and a Java application?
Consider
public class MyClass{
public MyClass(){/*code*/}
// more code...
}
To instantiate MyClass, you would write?
What is garbage collection in the context of Java?
A constructor
Which of the following may be part of a class definition?
What is byte code in the context of Java?
You read the following statement in a Java program that compiles and
executes.
submarine.dive(depth);
What can you say for sure?
Given the following code fragment:
int A[];
int i = 0;
A = new int A[4];
while (i < 4)
{
A[i] = 10;
i = i + 1;
}
What is the value of A[3]?