Quiz Competition

Is this your test? Login to manage it. If not, you can make an assessment just like it.

This is a non-interactive preview of the quiz content.

1.
What will be output if you will compile and execute the
following c code?

#include
int main(){
int i=320;
char *ptr=(char *)&i;
printf("%d",*ptr);
return 0;
2.
What will be output if you will compile and execute the
following c code?

#include
#define x 5+2
int main(){
int i;
i=x*x*x;
printf("%d",i);
return 0
3.
What will be output if you will compile and execute the
following c code?

#include
int main(){
int a=2;
if(a==2){
a=~a+2<<1;
printf("%d",a);
}
else{
break;
}
return 0;

}
4.
What will be output if you will compile and execute the
following c code?

#include
#include
int main(){
char *str=NULL;
strcpy(str,"cquestionbank");
printf("%s",str);
return 0;

}
5.
The ASCII value of Y:
6.
What will be output if you will compile and execute the
following c code?

#include
#define max 5;
int main(){
int i=0;
i=max++;
printf("%d",i++);
return 0;

}
7.
What will be output if you will compile and execute the
following c code?
#include
int main(){
int a=10;
printf("%d %d %d",a,a++,++a);
return 0;

}
8.
data type of "int" can store:
9.
char x=10;
printf("%d",~x); Output is:
10.
printf(“%u”,&a); The output of this statement is:
11.
All of the following are valid expressions in C++
a = 2 + (b = 5);
a = b = c = 5;
a = 11 % 3
12.
What is the output of this program?
1. #include
2. using namespace std;
3. int main()
4. {
5. typedef int num;
6. num a = 10, b = 15;
7. num c = a + b + a - b;
8. cout << c;
9. return 0;
10. }
13.
What is the error in the following class definitions?
Abstract class xy
{
abstract sum (int x, int y) { }
}
14.
Which of the following statements is preferred to create a string "Welcome to Java"?
15.
What is the output of the following code?

public class Test {
public static void main(String[] args) {
String s1 = "Welcome to Java!";
String s2 = s1;

if (s1 == s2)
System.out.println("s1 and s2 reference to the same String object");
else
System.out.println("s1 and s2 reference to different String objects");
}
}
16.
16What is the output of running class C?

class A {
public A() {
System.out.println(
"The default constructor of A is invoked");
}
}

class B extends A {
public B() {
System.out.println(
"The default constructor of B is invoked");
}
}

public class C {
public static void main(String[] args) {
B b = new B();
}
}
17.
What is the return value of "SELECT".substring(0, 5)?
18.
The following program displays __________.

public class Test {
public static void main(String[] args) {
String s = "Java";
StringBuilder buffer = new StringBuilder(s);
change(s);
System.out.println(s);
}

private static void change(String s) {
s = s + " and HTML";
}
}
19.
What is displayed by the following statement?
System.out.println("Java is neat".replaceAll("is", "AAA"));
20.
Fill in the code to complete the following method for computing factorial.

/** Return the factorial for a specified index */
public static long factorial(int n) {
if (n == 0) // Base case
return 1;
else
return _____________; // Recursive call
}
21.
What is wrong in the following code?

class TempClass {
int i;
public void TempClass(int j) {
int i = j;
}
}

public class C {
public static void main(String[] args) {
TempClass temp = new TempClass(2);
}
}
22.
Which of the following statements are correct?
23.
When you run the following applet from a browser, what is displayed:

import javax.swing.*;

public class Test extends JApplet {
public Test() {
System.out.println("Default constructor is invoked");
}

public void init() {
System.out.println("Init method is invoked");
}
}
24.
What will be the output of the C#.NET code snippet given below?
byte b1 = 0xF7;
byte b2 = 0xAB;
byte temp;
temp = (byte)(b1 & b2);
Console.Write (temp + " ");
temp = (byte)(b1^b2);
Console.WriteLine(temp);
25.
Suppose n is a variable of the type Byte and we wish, to check whether its fourth bit (from right) is ON or OFF. Which of the following statements will do this correctly?
26.
Which of the following ways to create an object of the Sample class given below will work correctly?
class Sample
{
int i;
Single j;
double k;
public Sample (int ii, Single jj, double kk)
{
i = ii;
j = jj;
k = kk;
}
}
27.
Which of the following is the correct way to define the constructor(s) of the Sample class if we are to create objects as per the C#.NET code snippet given below?
Sample s1 = new Sample();
Sample s2 = new Sample(9, 5.6f);
28.
What will be the output of the C#.NET code snippet given below?
namespace IndiabixConsoleApplication
{
class Sample
{
static Sample()
{
Console.Write("Sample class ");
}
public static void Bix1()
{
Console.Write("Bix1 method ");
}
}
class MyProgram
{
static void Main(string[ ] args)
{
Sample.Bix1();
}
}
}
29.
Which of the following will be the correct output for the C#.NET code snippet given below?
String s1 = "ALL MEN ARE CREATED EQUAL";
String s2;
s2 = s1.Substring(12, 3);
Console.WriteLine(s2);
30.
If s1 and s2 are references to two strings, then which of the following is the correct way to compare the two references?
31.
Which of the following statements are correct?
1. String is a value type.
2. String literals can contain any character literal including escape sequences.
3. The equality operators are defined to compare the values of string objects as well as references.
4. Attempting to access a character that is outside the bounds of the string results in anIndexOutOfRangeException.
5. The contents of a string object can be changed after the object is created.
32.
Which of the following statements is correct about the C#.NET program given below?
using System;
namespace IndiabixConsoleApplication
{
class MyProgram
{
static void Main(string[] args)
{
int index = 6;
int val = 44;
int[] a = new int[5];
try
{
a[index] = val ;
}
catch(IndexOutOfRangeException e)
{
Console.Write("Index out of bounds ");
}
Console.Write("Remaining program");
}
}
}
33.
Which Do…Loop statement should be used to process test scores where a test score over 100 is a signal to stop the processing?
34.
Which of the following will be the correct output for the C#.NET code snippet given below?
String s1 = "Nagpur";
String s2;
s2 = s1.Insert(6, "Mumbai");
Console.WriteLine(s2);
35.
Examine the following program and determine the output
#include
using namespace std;
int operate (int a, int b)
{
return (a * b);
}
float operate (float a, float b)
{
return (a/b);
}
int main()
{
int x=5, y=2;
float n=5.0, m=2.0;
cout << operate(x,y) <<"\t";
cout << operate (n,m);
return 0;
}
36.
Observe following function declaration and choose the best answer:
int divide ( int a, int b = 2 )
37.
3.4E - 38 is equivalent to ?
38.
Which of the following statement is correct?
39.
Which language is not a true object-oriented programming language?
40.
What is the correct syntax for referring to an external script called "xxx.js"?
41.
Which of the following way can be used to indicate the LANGUAGE attribute?
42.
Which of the following is the structure of an if statement?
43.
What will be the result of the following code?
#define TRUE 0
while(TRUE)
{
printf(“Wipro-BITS”);
}
printf(“BITS PILANI”);
44.
What will be the output of the following statements ?

int x[4] = {1,2,3}; printf("%d %d %D",x[3],x[2],x[1]);
45.
What are the two advantage of function objects than the function call?
46.
What does the data type defined by union will do?
47.
What will be the output of following program
main()
{
int x=5;
printf(“%d,%d,%d\n”,x,x< <2,x>>2);
}
48.
___________ namespace is not defined in the .NET class library.
49.
Which of the following define the rules for .Net Languages?
50.
for(i=1,j=0;i<10;i++)
j +=i;
System.out.println(i);