Você está na página 1de 8

Visit www.latestoffcampus.com for placement papers, interview tips & job updates. Toget freeupdates tomail https://groups.google.

com/group/latestoffcampusLive updates on Facebook @ https://www.facebook.com/LatestOffCampus

TITLE: HAL Sample Programming Placement Paper Level1 (Bolded option is your answer) 1. What are the different types of real data type in C ? A float, double B short int, double, long int C float, double, long double D double, long int, float

2. What will you do to treat the constant 3.14 as a long double? A use 3.14LD B use 3.14L C use 3.14DL D use 3.14LF

3. Which statement will you add in the following program to work it correctly? #include<stdio.h> int main() { printf("%f\n", log(36.0)); return 0; } A B C D #include<conio.h #include<stdlib.h #include<math.h #include<dos.h > > > > 4. We want to round off x, a float, to an int value, The correct way to do is A y = (int)(x + 0.5) Dy= (int)((int)x + 0.5) 5. Which of the following statement obtains the remainder on dividing 5.5 by 1.3 ?
Visit www.latestoffcampus.com for placement papers, interview tips & job updates. Toget freeupdates tomail https://groups.google.com/group/latestoffcampusLive updates on Facebook @ https://www.facebook.com/LatestOffCampus

B y = int(x + 0.5)

C y = (int)x + 0.5

Visit www.latestoffcampus.com for placement papers, interview tips & job updates. Toget freeupdates tomail https://groups.google.com/group/latestoffcampusLive updates on Facebook @ https://www.facebook.com/LatestOffCampus

A rem = (5.5 % 1.3)

B rem = modf(5.5, 1.3)

C rem = fmod(5.5, 1.3)

D Error

6. How will you free the allocated memory ? A remove(varname); B free(varname); C delete(varname); Ddalloc(varname);

7. Which header file should be included to use functions like malloc() and calloc()? A memory.h B stdlib.h C string.h D dos.h

8. How will you free the memory allocated by the following program? #include<stdio.h> #include<stdlib.h> #define MAXROW 3 #define MAXCOL 4 int main() { int **p, i, j; p = (int **) malloc(MAXROW * sizeof(int*)); return 0; } A memfree(int B dealloc(p); C malloc(p, 0); p); 9. What is stderr ? A standard error B standard error C standard error D standard types streams error
Visit www.latestoffcampus.com for placement papers, interview tips & job updates. Toget freeupdates tomail https://groups.google.com/group/latestoffcampusLive updates on Facebook @ https://www.facebook.com/LatestOffCampus

D free(p);

Visit www.latestoffcampus.com for placement papers, interview tips & job updates. Toget freeupdates tomail https://groups.google.com/group/latestoffcampusLive updates on Facebook @ https://www.facebook.com/LatestOffCampus

10. How many times the while loop will get executed if a short int is 2 byte wide? #include<stdio.h> int main() { int j=1; while(j <= 255) { printf("%c %d\n", j, j); j++; } return 0; } A Infinite times B 255 times

C 256 times

D 254 times

11. Which of the following cannot be checked in a switch-case statement? A Character B Integer C Float D enum

12. How many times the program will print "IndiaBIX" ? #include<stdio.h> int main() { printf("IndiaBIX"); main(); return 0; }
Visit www.latestoffcampus.com for placement papers, interview tips & job updates. Toget freeupdates tomail https://groups.google.com/group/latestoffcampusLive updates on Facebook @ https://www.facebook.com/LatestOffCampus

Visit www.latestoffcampus.com for placement papers, interview tips & job updates. Toget freeupdates tomail https://groups.google.com/group/latestoffcampusLive updates on Facebook @ https://www.facebook.com/LatestOffCampus

A Infinite times

B 32767 times

C 65535 times

D Till stack overflows

13. In a file contains the line "I am a boy\r\n" then on reading this line into the array str using fgets(). What will str contain? A "I am a boy\r\n\0" B "I am a boy\r\0" C"I am a boy\n\0" D "I am a boy"

14. Which of the following operations can be performed on the file "NOTES.TXT" using the below code? FILE *fp; fp = fopen("NOTES.TXT", "r+"); A Reading B Writing C Appending D Read and Write 15. Which files will get closed through the fclose() in the following program? #include<stdio.h> int main() { FILE *fs, *ft, *fp; fp = fopen("A.C", "r"); fs = fopen("B.C", "r"); ft = fopen("C.C", "r"); fclose(fp, fs, ft); return 0; } A "A.C" "B.C" B "B.C" "C.C" "C.C"

C "A.C"

D Error in fclose()

Visit www.latestoffcampus.com for placement papers, interview tips & job updates. Toget freeupdates tomail https://groups.google.com/group/latestoffcampusLive updates on Facebook @ https://www.facebook.com/LatestOffCampus

Visit www.latestoffcampus.com for placement papers, interview tips & job updates. Toget freeupdates tomail https://groups.google.com/group/latestoffcampusLive updates on Facebook @ https://www.facebook.com/LatestOffCampus

16. To scan a and b given below, which of the following scanf() statement will you use? #include<stdio.h> float a; double b; A scanf("%f %f", &a, &b);

B scanf("%Lf %Lf", &a, &b);

C scanf("%f %Lf", D scanf("%f &a, &b); %lf", &a, &b);

17. Which of the following type of class allows only one object of it to be created? A Virtual class B Abstract class C Singleton class D Friend class

18. Which of the following is not the member of class? A Static function B Friend function C Const function D Virtual function

19. Which of the following concepts means determining at runtime what method to invoke? A Data hiding B Dynamic Typing C Dynamic binding D Dynamic loading

20. Which of the following cannot be friend? A Function B Class C Object D Operator function

21. Which of the following is an abstract data type?

Visit www.latestoffcampus.com for placement papers, interview tips & job updates. Toget freeupdates tomail https://groups.google.com/group/latestoffcampusLive updates on Facebook @ https://www.facebook.com/LatestOffCampus

Visit www.latestoffcampus.com for placement papers, interview tips & job updates. Toget freeupdates tomail https://groups.google.com/group/latestoffcampusLive updates on Facebook @ https://www.facebook.com/LatestOffCampus

A int

B double

C string

D Class

22. Which of the following cannot be used with the keyword virtual? A class B member functions C constructor D destructor

23. Which one of the following options is correct about the statement given below? The compiler checks the type of reference in the object and not the type of object. A Inheritance B Polymorphism C Abstraction D Encapsulation 24. Which of the following concepts is used to implement late binding? A Virtual function B Operator function C Const function D Static function

25. Which of the following ways are legal to access a class data member using this pointer? A this->x B this.x C*this.x D *this-x

26. Which of the following is not a type of inheritance? A Multiple B Multilevel C Distributive D Hierarchical

27. Which of the following header file includes definition of cin and cout? A istream.h B ostream.h C iomanip.h D iostream.h

Visit www.latestoffcampus.com for placement papers, interview tips & job updates. Toget freeupdates tomail https://groups.google.com/group/latestoffcampusLive updates on Facebook @ https://www.facebook.com/LatestOffCampus

Visit www.latestoffcampus.com for placement papers, interview tips & job updates. Toget freeupdates tomail https://groups.google.com/group/latestoffcampusLive updates on Facebook @ https://www.facebook.com/LatestOffCampus

28. Which of the following keyword is used to overload an operator? A overload B operator C friend D override

29. Which of the following provides a reuse mechanism? A Abstraction B Inheritance C Dynamic binding D Encapsulation

30. A constructor that accepts __________ parameters is called the default constructor. A one B two C no D three

31. To ensure that every object in the array receives a destructor call, always delete memory allocated as an array with operator __________ A destructor B delete C delete[] D kill[]

32. Which one of the following will declare an array and initialize it with five numbers? A Array a = new Array(5); B int [] a = C int a [] = new {23,22,21,20,19} int[5]; ; 33. public class Test { } What is the prototype of the default constructor? A Test( ) B Test(void) C public Test( ) D int [5] array;

D public Test(void)

34. You want a class to have access to members of another class in the same package. Which is the most restrictive access that accomplishes this objective?
Visit www.latestoffcampus.com for placement papers, interview tips & job updates. Toget freeupdates tomail https://groups.google.com/group/latestoffcampusLive updates on Facebook @ https://www.facebook.com/LatestOffCampus

Visit www.latestoffcampus.com for placement papers, interview tips & job updates. Toget freeupdates tomail https://groups.google.com/group/latestoffcampusLive updates on Facebook @ https://www.facebook.com/LatestOffCampus

A public

B private

C protected

D default access

35. What is the narrowest valid returnType for methodA in line 3? public class ReturnIt { returnType methodA(byte x, double y) /* Line 3 */ { return (long)x / y * 2; } } A int B byte C long

D double

36. Given a method in a protected class, what access modifier do you use to restrict access to that method to only the other members of the same class? A final B static C private D protected

Visit www.latestoffcampus.com for placement papers, interview tips & job updates. Toget freeupdates tomail https://groups.google.com/group/latestoffcampusLive updates on Facebook @ https://www.facebook.com/LatestOffCampus

Você também pode gostar