Vous êtes sur la page 1sur 12

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

com/group/latestoffcampus/subscribeLive updates on Facebook @ www.facebook.com/LatestOffCampus

TITLE: GAIL (India) Ltd. Sample Programming Placement Paper Level1 (Bolded option is your answer) 1. _______special symbol allowed in a variable name? A _ (underscore) 2. Identify which of the following are declarations 1 :extern int x; 2 :float square ( float x ) { ... } 3 :double pow(double, double); A 1 and 3 3. What will you do to treat the constant 3.14 as a long double? A use 3.14L 4. A float occupies 4 bytes. If the hexadecimal equivalent of these 4 bytes are A, B, C and D, then when this float is stored in memory in which of the following order do these bytes gets stored? A Depends on big endian or little endian architecture 5. How many bytes are occupied by near, far and huge pointers (DOS)? A near=2 far=4 huge=4 6. A pointer is
Visit www.latestoffcampus.com for placement papers, interview tips & job updates. Toget freeupdates tomail http://groups.google.com/group/latestoffcampus/subscribeLive updates on Facebook @ www.facebook.com/LatestOffCampus

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

A A variable that stores address of other variable 7. What is the similarity between a structure, union and enumeration? A All of them let you define new data types 8. Which bitwise operator is suitable for checking whether a particular bit is on or off? A & operator 9. Specify the 2 library functions to dynamically allocate memory? A malloc() and calloc() 10. Which standard library function will you use to find the last occurance of a character in a string in C? A strrchr() 11. 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++; }
Visit www.latestoffcampus.com for placement papers, interview tips & job updates. Toget freeupdates tomail http://groups.google.com/group/latestoffcampus/subscribeLive updates on Facebook @ www.facebook.com/LatestOffCampus

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

return 0; } A 255 times 12. How many times the program will print "IndiaBIX" ? #include<stdio.h> int main() { printf("IndiaBIX"); main(); return 0; } A Till stack overflows 13. What does the following declaration mean? int (*ptr)[10]; A ptr is a pointer to an array of 10 integers 14. What is the purpose of "rb" in fopen() function used below in the code? FILE *fp; fp = fopen("source.txt", "rb"); A open "source.txt" in binary mode for reading 15. To scan a and b given below, which of the following scanf() statement will you use? #include<stdio.h> float a;
Visit www.latestoffcampus.com for placement papers, interview tips & job updates. Toget freeupdates tomail http://groups.google.com/group/latestoffcampus/subscribeLive updates on Facebook @ www.facebook.com/LatestOffCampus

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

double b; A scanf("%f %lf", &a, &b); 16. ________program? #include<stdio.h> int main() { typedef char (*(*arrfptr[3])())[10]; arrfptr x; return 0; } A x is an array of three function pointers 17. What will be the output of the program? #include<stdio.h> #include<stdarg.h> void fun1(int num, ...); void fun2(int num, ...); int main() { fun1(1, "Apple", "Boys", "Cats", "Dogs"); fun2(2, 12, 13, 14); return 0; } void fun1(int num, ...) { char *str; va_list ptr;
Visit www.latestoffcampus.com for placement papers, interview tips & job updates. Toget freeupdates tomail http://groups.google.com/group/latestoffcampus/subscribeLive updates on Facebook @ www.facebook.com/LatestOffCampus

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

va_start(ptr, num); str = va_arg(ptr, char *); printf("%s ", str); } void fun2(int num, ...) { va_list ptr; va_start(ptr, num); num = va_arg(ptr, int); printf("%d", num); } A Apple 12 18. _________order if calling functions in the below code? a = f1(23, 14) * f2(12/4) + f3(); A Order may vary from compiler to compiler 19. In which stage the following code #include<stdio.h> gets replaced by the contents of the file stdio.h A During preprocessing 20. _______finds the length of a string? A int xstrlen(char *s) { int length=0; while(*s!='\0') { length++; s++; } return (length);
Visit www.latestoffcampus.com for placement papers, interview tips & job updates. Toget freeupdates tomail http://groups.google.com/group/latestoffcampus/subscribeLive updates on Facebook @ www.facebook.com/LatestOffCampus

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

} 21. According to ANSI specifications which is the correct way of declaring main when it receives command-line arguments? A int main(int argc, char *argv[]) 22. What will be the output of the program? #include<stdio.h> #include<stdlib.h> union employee { char name[15]; int age; float salary; }; const union employee e1; int main() { strcpy(e1.name, "K"); printf("%s %d %f", e1.name, e1.age, e1.salary); return 0; } A No error 23. ________declaration signify? char *arr[10]; A arr is a array of 10 character pointers.
Visit www.latestoffcampus.com for placement papers, interview tips & job updates. Toget freeupdates tomail http://groups.google.com/group/latestoffcampus/subscribeLive updates on Facebook @ www.facebook.com/LatestOffCampus

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

24. __________declaration signify? char *scr; A scr is a pointer to char. 25. __________approach is adapted by C++? A Bottom-up 26. __________is correct about the statements given below? 1.All operators can be overloaded in C++. 2.We can change the basic meaning of an operator in C++. A Both I and II are false. 27. ________is incorrect? A main() cannot be declared as member function of any class. 28. Constructor is executed when _____. A an object is created 29. __________is correct about the program given below? class Bix { public: static void MyFunction(); }; int main() {
Visit www.latestoffcampus.com for placement papers, interview tips & job updates. Toget freeupdates tomail http://groups.google.com/group/latestoffcampus/subscribeLive updates on Facebook @ www.facebook.com/LatestOffCampus

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

void(*ptr)() = &Bix::MyFunction; return 0; } A The program reports linker error. 30. ________function / types of function cannot have default parameters? A main() 31. If the copy constructor receives its arguments by value, the copy constructor would A call itself recursively 32. Which of the following statements is correct? 1.An array of references is acceptable. 2.We can also create a reference to a reference. A Both 1 and 2 are incorrect. 33. _______are NOT performed by Garbage Collector? 1.Freeing memory on the stack. 2.Avoiding memory leaks. 3.Freeing memory occupied by unreferenced objects. 4.Closing unclosed database collections. 5.Closing unclosed files. A 1, 4, 5 34. What will be the output of the C#.NET code snippet given below? int num = 1, z = 5; if (!(num <= 0))
Visit www.latestoffcampus.com for placement papers, interview tips & job updates. Toget freeupdates tomail http://groups.google.com/group/latestoffcampus/subscribeLive updates on Facebook @ www.facebook.com/LatestOffCampus

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

Console.WriteLine( ++num + z++ + " " + ++z ); else Console.WriteLine( --num + z-- + " " + --z ); A77 35. __________statements are correct about the C#.NET code snippet given below? class Sample { static int i; int j; public void proc1() { i = 11; j = 22; } public static void proc2() { i = 1; j = 2; } static Sample() { i = 0; j = 0; } } A proc1() can initialize i as well as j. 36. ________is the correct way to find out the index of the second 's' in the string "She sells sea shells on the sea-shore"?
Visit www.latestoffcampus.com for placement papers, interview tips & job updates. Toget freeupdates tomail http://groups.google.com/group/latestoffcampus/subscribeLive updates on Facebook @ www.facebook.com/LatestOffCampus

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

A String str = "She sells sea shells on the sea-shore"; int i, j; i = str.IndexOf("s"); j = str.IndexOf("s", i + 1); 37. An Account class has a property called accountNo and acc is a reference to a bank object and we want the C#.NET code snippet given below to work. Which of the following options will ensure this functionality? A Declare accountNo property with both get and set accessors. 38. Which constructs an anonymous inner class instance? A System.out.println(new Runnable() {public void run() { }}); 39. What will be the output of the program? public class Test { public static void aMethod() throws Exception { try /* Line 5 */ { throw new Exception(); /* Line 7 */ } finally /* Line 9 */ { System.out.print("finally "); /* Line 11 */ } } public static void main(String args[]) {
Visit www.latestoffcampus.com for placement papers, interview tips & job updates. Toget freeupdates tomail http://groups.google.com/group/latestoffcampus/subscribeLive updates on Facebook @ www.facebook.com/LatestOffCampus

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

try { aMethod(); } catch (Exception e) /* Line 20 */ { System.out.print("exception "); } System.out.print("finished"); /* Line 24 */ } } A finally exception finished 40. class Test { private Demo d; void start() { d = new Demo(); this.takeDemo(d); /* Line 7 */ } /* Line 8 */ void takeDemo(Demo demo) { demo = null; demo = new Demo(); } } When is the Demo object eligible for garbage collection? A When the instance running this code is made eligible for garbage collection.
Visit www.latestoffcampus.com for placement papers, interview tips & job updates. Toget freeupdates tomail http://groups.google.com/group/latestoffcampus/subscribeLive updates on Facebook @ www.facebook.com/LatestOffCampus

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

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

Vous aimerez peut-être aussi