Hcl Computer questions |   7324

Hcl Computer questions

HCL

 

COMPUTER AWARENESS

 

1. What details should never be found in the top level of a top-down design?

(a) Details

(b) Coding

(c) Decisions

(d) None of the above

Ans. (c)

 

2. In an absolute loading scheme, which loader function is accomplished by assembler

(a) Reallocation

(b) Allocation

(c) Linking

(d) Both (a) and (b)

Ans. (d)

 

3. Banker's algorithm for resource allocation deals with

(a) Deadlock prevention

(b) Deadlock avoidance

(c) Deadlock recovery

(d) None of these

Ans. (b)

 

 

4. Thrashing can be avoided if

(a) The pages, belonging to the working set of the programs, are in main memory

(b) The speed of CPU is increased

(c) The speed of I/O processor are increased

(d) All of the above

Ans. (a)

 

5. Which of the following communications lines is best suited to interactive processing applications?

(a) Narrowband channels

(b) Simplex channels

 (c) Full-duplex channels

(d) Mixed band channels

Ans. (b)

 

6. A feasibility document should contain all of the following except

(a) Project name

(b) Problem descriptions

(c) Feasible alternative

(d) Data flow diagrams

Ans. (d)

 

7. What is the main function of a data link content monitor?

(a) To detect problems in protocols

(b) To determine the type of transmission used in a data link

(c) To determine the type of switching used in a data link

(d) To determine the flow of data

Ans. (a)

 

8. Which of the following is a broadband communications channel?

(a) Coaxial cable

(b) Fiber optic cable

(c) Microwave circuits

(d) All of the above

Ans. (d)

 

9. Which of the following memories has the shortest access time?

(a) Cache memory

(b) Magnetic bubble memory

(c) Magnetic core memory

(d) RAM

Ans. (a)

 

10. A shift register can be used for

(a) Parallel to serial conversion

(b) Serial to parallel conversion

(c) Digital delay line

(d) All the above

Ans. (d)

 

11. In which of the following page replacement policies, Balady's anomaly occurs?

(a) FIFO

(b) LRU

(c) LFU

(d) NRU

Ans. (a)

 

12. Subschema can be used to

(a) Create very different, personalised views of the same data

(b) Present information in different formats

(c) Hide sensitive information by omitting fields from the sub-schema's description

(d) All of the above

Ans. (d)

 

13. A 12 address lines maps to the memory of

a. 1k bytes

b. 0.5k bytes

c. 2k bytes

d. none

Ans: b

 

14. In a processor these are 120 instructions . Bits needed to implement this instructions

[a] 6

[b] 7

[c] 10

[d] none

Ans: b

 

15. In a compiler there is 36 bit for a word and to store a character 8bits are needed. IN this to store a character two words are appended .Then for storing a K characters string, How many words are needed.

[a] 2k/9

[b] (2k+8/9

[c] (k+8/9

[d] 2*(k+8/9

[e] none

Ans: a

 

C LANGUAGE

 

1. Identify which of the following are declarations

1 : extern int x;

2 : float square ( float x ){... }

3 : double pow(double, double);

A. 1    

B. 2

C. 1 and 3      

D. 3

 

2.  What will be the output of the program If the integer is 4bytes long?

#include<stdio.h>

int main()

{

    int ***r, **q, *p, i=8;

    p = &i;

    q = &p;

    r = &q;

    printf("%d, %d, %d\n", *p, **q, ***r);

    return 0;

}

 

A. 8, 8, 8        

B. 4000, 4002, 4004

C. 4000, 4004, 4008  

D. 4000, 4008, 40163.

 

3. What function should be used to free the memory allocated by calloc() ?

A. dealloc();   

B. malloc(variable_name, 0)

C. free();         

D. memalloc(variable_name, 0)

 

4. Point out the error in the program

#include<stdio.h>

int main()

{

    int a=10;

    void f();

    a = f();

    printf("%d\n", a);

    return 0;

}

void f()

{

    printf("Hi");

}

 

A. Error: Not allowed assignment

B. Error: Doesn't print anything

C. No error

D. None of above

 

5. What does the following declaration mean?

int (*ptr)[10];

A. ptr is array of pointers to 10 integers

B. ptr is a pointer to an array of 10 integers

C. ptr is an array of 10 integers

D. ptr is an pointer to array

 

6.  Point out the error in the program?

typedef struct data mystruct;

struct data

{

    int x;

    mystruct *b;

};

 

A. Error: in structure declaration

B. Linker Error

C. No Error

D. None of above

 

7. In the following code what is 'P'?

typedef char *charp;

const charp P;

 

A. P is a constant       

B. P is a character constant

C. P is character type 

D. None of above

 

8. Which of the following is the correct usage of conditional operators used in C?

A. a>b ? c=30 : c=40;

B. a>b ? c=30;

C. max = a>b ? a>c?a:c:b>c?b:c        

D. return (a>b)?(a:b)

 

9. What will be the output of the program ?

#include<stdio.h>

int main()

{

    char p[] = "%d\n";

    p[1] = 'c';

    printf(p, 65);

    return 0;

}

 

A. A   

B.a

C. c     

D. 65

 

10. What will be the output of the program (myprog.c) given below if it is executed from the command line?

cmd> myprog one two three

 

/* myprog.c */

#include<stdio.h>

#include<stdlib.h>

int main(int argc, char **argv)

{

    printf("%s\n", *++argv);

    return 0;

}

 

A. myprog      

B. one

C. two

D. three

 

11.  The comma operator (,) is primarily used in conjunction with

A. 'for' statement

B. 'if-else' statement

C. 'do-while' statement

D.All of the above

E. None of the above

 

12.  To execute a C++ program, you first need to translate the source code into object code. This process is called

A. coding       

B. compiling

C. sourcing     

D. translating

 

13.  The rules of a programming language are called its _____

A. code          

B. guidelines

C. procedures 

D. regulations

E. syntax

 

14.  An array element is accessed using

A. a first-in-first-out approach

B. the dot operator

C. a member name

D. an index number

 

15.  The program can access the private members of a class

A. directly

B. only through other private members of the class

C. only through other public members of the class

D. None of the above - the program cannot access the private members of a class in any way

 

 

 

 

STRUCTURES IN C  & JAVA

 

1.         class A

{

    A( ){}

}

 

class B extends A

{ }

Which statement is true?

A. Class B'S constructor is public.

B. Class B'S constructor has no arguments.

C. Class B'S constructor includes a call to this( ).

D. None of these.

Answer:  B

 

2.         interface DoMath

{

 double getArea(int rad);

}

interface MathPlus

{

    double getVol(int b, int h);

}

/* Missing Statements ? */

which two code fragments inserted at end of the program, will allow to compile?

   1. class AllMath extends DoMath { double getArea(int r); }

   2. interface AllMath implements MathPlus { double getVol(int x, int y); }

   3. interface AllMath extends DoMath { float getAvg(int h, int l); }

   4. class AllMath implements MathPlus { double getArea(int rad); }

   5. abstract class AllMath implements DoMath, MathPlus { public double getArea(int rad){return rad * rad * 3.14; }}

A. 1 only        

B. 2 only

C. 3 and 5      

D. 1 and 4

Answer: C

 

3.  Which two statements are true for any concrete class implementing the java.lang.Runnable interface?

   1. You can extend the Runnable interface as long as you override the public run() method.

   2. The class must contain a method called run() from which all code for that thread will be initiated.

   3. The class must contain an empty public void method named run().

   4. The class must contain a public void method named runnable().

   5. The class definition must include the words implements Threads and contain a method called run().

   6. The mandatory method must be public, with a return type of void, must be called run(),and cannot take any arguments.

A. 1 and 3      

B. 2 and 4

C. 1 and 5      

D. 2 and 6

Answer:  D

 

 

4.         /* Missing statements ? */

public class NewTreeSet extends java.util.TreeSet

{

    public static void main(String [] args)

    {

        java.util.TreeSet t = new java.util.TreeSet();

        t.clear();

    }

    public void clear()

    {

        TreeMap m = new TreeMap();

        m.clear();

    }

}

which two statements, added independently at beginning of the program, allow the code to compile?

    1. No statement is required

   2. import java.util.*;

   3. import.java.util.Tree*;

   4. import java.util.TreeSet;

   5. import java.util.TreeMap;

A. 1 only        

B. 2 and 5

C. 3 and 4      

D. 3 and 4

Answer:  B

 

5.  Which three statements are true?

   1. The default constructor initialises method variables.

   2. The default constructor has the same access as its class.

   3. The default constructor invokes the no-arg constructor of the superclass.

   4. If a class lacks a no-arg constructor, the compiler always creates a default constructor.

   5. The compiler creates a default constructor only when there are no other constructors for the class.

A. 1, 2 and 4  

B. 2, 3 and 5

C. 3, 4 and 5  

D. 1, 2 and 3

Answer:  B

 

6.  What will be the output of the program?

public class Foo

    public static void main(String[] args)

    {

        try

        {

            return;

        }

        finally

        {

            System.out.println( "Finally" );

        }

    }

}

A. Finally

B. Compilation fails.

C. The code runs with no output.

D. An exception is thrown at runtime.

Answer:  A

 

7.  What will be the output of the program?

try

{

    int x = 0;

    int y = 5 / x;

}

catch (Exception e)

{

    System.out.println("Exception");

}

catch (ArithmeticException ae)

{

    System.out.println(" Arithmetic Exception");

}

System.out.println("finished");

A. finished     

B. Exception

C. Compilation fails.  

D. Arithmetic Exception

Answer:  C

 

8.  What will be the output of the program?

public class X

    public static void main(String [] args)

    {

        try

        {

            badMethod(); 

            System.out.print("A");

        } 

        catch (Exception ex)

        {

            System.out.print("B"); 

        }

        finally

        {

            System.out.print("C");

        }

        System.out.print("D");

    } 

    public static void badMethod()

    {

        throw new Error(); /* Line 22 */

    }

}

A. ABCD

B. Compilation fails.

C. C is printed before exiting with an error message.

D. BC is printed before exiting with an error message.

Answer: C

 

9.  What will be the output of the program?

public class X

    public static void main(String [] args)

    {

        try

        {

            badMethod(); 

            System.out.print("A"); 

        }

        catch (RuntimeException ex) /* Line 10 */

        {

            System.out.print("B");

        }

        catch (Exception ex1)

        {

            System.out.print("C");

        }

        finally

        {

            System.out.print("D");

        }

        System.out.print("E");

    }

    public static void badMethod()

    {

        throw new RuntimeException();

    }

}

A. BD

B. BCD

C. BDE          

D. BCDE

Answer:  C

 

10.  What will be the output of the program?

public class RTExcept

{

    public static void throwit ()

    {

        System.out.print("throwit ");

        throw new RuntimeException();

    }

    public static void main(String [] args)

    {

        try

        {

            System.out.print("hello ");

            throwit();

        }

        catch (Exception re )

        {

            System.out.print("caught ");

        }

        finally

        {

            System.out.print("finally ");

        }

        System.out.println("after ");

    }

}

A. hello throwit caught

B. Compilation fails

C. hello throwit Runtime Exception caught after

D. hello throwit caught finally after

Answer:  D

 

 

APTITUDE SECTION

 

1. A container contains 40 litres of milk.From this container 4 litres of milk was taken out and replaced by water. This process was repeated further two times. How much milk is now contained by the container.

            A.  26.34 litres            B.  27.36 liters

            C.  28 litres                  D.  29.16 litres

 

2. Tea worth Rs. 126 per kg are mixed with a third variety in the ratio 1: 1 : 2. If the mixture is worth Rs. 153 per kg, the price of the third variety per kg will be

            A.  Rs. 169.50             B.  Rs.1700

            C.  Rs. 175.50            D.  Rs. 180

 

3. A milk vendor has 2 cans of milk.The first contains 25% water and the rest milk.The second contains 50% water. How much milk should he mix from each of the containers so as to get 12 litres of milk such that the ratio of water to milk is 3 : 5 ?

            A.  4litres, 8 litres        B.  6litres, 6 litres

            C.  5litres, 7 litres        D.  7litres, 4 litres

 

4.         Two vessels A and B contain spirit and water in the ratio 5 : 2 and 7 : 6 respectively. Find the ratio in which these mixture be mixed to obtain a new mixture in vessel C containing spirit and water in the ration 8 : 5 ?

            A.  4 : 3           B.  3 : 4

            C.  5 : 6           D.  7 : 9

5. A can contains a mixture of two liquids A and B in the ratio 7 : 5. When 9 litres of mixture are drawn off and the can is filled with B, the ratio of A and B becomes 7 : 9. How many litres of liquid A was contained by the can initially?

            A.  10              B.  20

            C.  21              D.  25

 

6. A rectangular parking space is marked out by painting three of its sides.If the length of the unpainted side is 9 feet, and the sum of the lengths of the painted sides is 37 feet, then what is the area of the parking space in square feet?

            A.  46              B.  81

            C.  126            D.  252 litres

 

7. The length of a rectangulat plot is 20 metres more than its breadth. If the cost of fencing the plot @ Rs. 26.50 per metre is Rs. 5300, what is the length of the plot in metres?

            A.  40              B.   50

            C.  200            D.  120

 

8. There are two sections A and B of a class, consisting of 36 and 44 students respectively. If the average weight of sections A is 40 kg and that of section b is 35 kg. Find the average weight of the whole class?

            A.  36.25         B.  37.25

            C.  38.35         D.  39.25

 

9 . A batsman makes a score of 87 runs in the 17th inning and thus increases his averages by 3.Find his average after 17th inning?

            A.  19              B.  29

            C.  39              D.  49

 

10.  The banker's discount on Rs. 1800 at 12% per annum is equal to the true discount on Rs.1872 for the same time at the same rate. Find the time?

            A.  3 months               B.  4 months

            C.  5 months                D.  6 months

11. The banker's gain on a bill due due 1 year hence at 12% per annum is Rs. 6. The true discount is

            A.  Rs.72         B.  Rs.36

            C.  Rs.54         D.  Rs.50

 

12. A boat can travel with a speed of 13 km / hr in still water. If the speed of the stream is 4 km / hr. find the time taken by the boat to go 68 km downstream?

            A.  2 hours      B.  3 hours

            C.  4 hours       D.  5 hours

 

13. The speed of a boat in still water is 15 km/hr and the rate of current is 3 km/hr. The distance travelled downstream in 12 minutes is

            A.  1.2 km                   B.  1.8 km

            C.  2.4 km                   D.  3.6 km

 

14. Today is Wednesday what will be the day after 94 days ?

            A.  Monday                 B.  Tuesday

            C.  Wednesday           D.  Sunday

 

15.  A clock is set at 5 a.m. The clock loses 16 minutes in 24 hours. What will be the true time when the clock indicates 10 p.m. on 4th day?

            A.   9 p.m        B.   10 p.m

            C.   11 p.m      D.   12 p.m

 

16. Find the compound interest on Rs.16,000 at 20% per annum for 9 months, compounded quartely.

            A.  Rs. 2552                B.  Rs. 2512

            C.  Rs. 2572                D.  Rs. 2592

 

17. The value of (4.7×13.26 + 4.7×9.43+4.7×77.31) is

            A.  0.47           B.  47

            C.  470            D.  4700

 

18. A ladder learning against a wall makes an angle of 60° with the ground. If the length of the ladder is 19 m, find the distance of the foot of the ladder from the wall.

            A.   9 m           B.   9.5 m

            C.  10.5 m       D.  12 m

 

19. The value of log343 7 is

            A.  1/3             B.  - 3

            C.  - 1/3           D.  3

 

20. In a division sum, the divisor is 10 times the quotient and 5 times the remainder. If the remainder is 46, the divident is

            A.  4236          B.  4306

            C.  4336          D.  5336

 

 

feedback