Section - Computer Science 1. With respect to the C++ programming language, which is the parameter that is added to every non-static member function when it is called? (i) this pointer (ii) that pointer (iii) datatype 2. A process executes the code: (i) 3 (ii) 4 (iii) 7 (iv) 8 fork (); fork (); fork (); 3. Consider the following piece of code: if( a > 10 ) if( b < 5 ) b = a * 10; else if( a < 5 ) if ( b > 10 ) b = a * b; else if( c > 5 && b == 10 ) if( c < 10 ) c = b * a; else c = a * c; The compiler will (i) associate the first else statement with if( b < 5 ) (ii) associate the first else statement with if( a > 10 ) (iii) throw an error outright (iv) none of the above 4. What will be the result of the following C language program? void int const *p = 5; printf("%d",++(*p));
(i) 6 (ii) 5 (iii) Linker error (iv) Compiler error 5. What will be the result of the following C language program? int a = 0; int b = 20; char x = 1; char y = 10; if(a,b,x,y) printf("welcome"); (i) Welcome (ii) Blank (iii) Compiler error (iv) Linker error 6. Increasing the Random Access Memory (RAM) of a computer typically improves performance because (i) Virtual memory increases (ii) Larger RAMs are faster (iii) Fewer page faults occur (iv) Fewer segmentation faults occur 7. What will be the result of the following C language program? struct date; struct student char name[30]; struct date dob; stud; struct date int day, month, year; ; scanf("%s%d%d%d", stud.rollno, &student.dob.day, &student.dob.month); (i) Compiler error: Undefined structure dob (ii) Compiler error: Undefined structure name (iii) Compiler error: Undefined structure date (iv) Linker error
8. What does the following C language declaration mean? int (*decl)[30] (i) array[30] of pointer to int (ii) function returning pointer to int 30 (iii) pointer to array[30] of int 9. Which of the following statements is not true? (i) A memory leak occurs when a program loses the ability to free a block of dynamically allocated memory. (ii) Objects that point to other objects are called null objects. (iii) A handle class is a class that maintains a pointer to an object that is programmatically accessible through the public interface of the handle class. (iv) A common form of an action class is a simple class containing just one virtual function. 10. Which of the following statements is not true? (i) NULL can be a value for pointer type variables. (ii) VOID is type identifier which has no size. (iii) null *ptr = VOID (iv) void *ptr = NULL 11. What will be the result of the following C language program? (i) 258 0 (ii) 1 0 (iii) 1 2 (iv) 2 1 int i = 258; int *iptr = &i; printf("%d %d", *((char*)iptr), *((char*)iptr+1) ); 12. In a C++ language program, will an inline function be compiled inline always? (i) Yes, always (ii) Only sometimes (iii) No, never 13. The stack is where the malloc() gets memory. TRUE / FALSE
14. What will be the output of the following lines of program code? fork(); printf("hello World!"); (i) Hello World! (ii) Hello World!Hello World! (iii) Blank 15. In following C language program, which statement would you add in the function fun so that the address of a gets stored in j? int *j; void fun(int **); fun(&j); void fun(int **k) int a = 0; /* Add the statement here*/ (i) **k = &a (ii) *j = &a (iii) *k = &a (iv) *a = &k 16. For the following tree, the pre-order traversal can be represented by (i) F, G, H, I, A, B, C, D, E, (ii) F, B, G, A, D, I, C, E, H (iii) A, B, E, D, C, F, G, H, I (iv) A, B, C, D, E, F, G, H, I
17. A thread is usually defined as a light weight process because an operating system (OS) maintains smaller data structures for a thread than for a process. In relation to this, which of the followings is true? (i) On per-thread basis, the OS maintains only CPU register state (ii) The OS does not maintain a separate stack for each thread (iii) On per-thread basis, the OS does not maintain virtual memory state (iv) On per thread basis, the OS maintains only scheduling and accounting information 18. Sorting is not possible by using which of the following methods? (i) Insertion (ii) Selection (iii) Deletion (iv) Exchange 19. There are 8, 13, 14 and 15 nodes in four different trees. Which of them could have formed a full binary tree? (i) 8 (ii) 13 (iii) 14 (iv) 15 20. Which of the following statements is not true? (i) Kernel threads need not be associated with a process whereas every user thread belongs to a process (ii) User level threads are unknown to the kernel whereas the kernel is aware of the kernel threads (iii) Kernel threads are less expensive to maintain that user threads (iv) Thread creation typically uses less resources than process creation 21. Assume that a disk drive holds 10 GB of data. How many such disk drives would be required to hold 4 exabytes of data. (i) 40,000 (ii) 400,000 (iii) 400,000,000 (iv) 400,000,000,000 22. What will be the result of the following C++ language program? class base public: void basefun() cout<<"from base"<<endl; ; class deri:public base public: void basefun() cout<< "from derived"<<endl; ; void SomeFunc(base *baseobj)
baseobj->basefun(); int base baseobject; SomeFunc(&baseObject); deri deriobject; SomeFunc(&deriObject); (i) from derived from derived (ii) from base from derived (iii) from derived from base (iv) from base from base 23. Which of the following statements is not true? (i) To provide the value of a private variable to the outside world, the programmer can write a public member function, usually classified as an accessor function. (ii) The header file describes the interface to a class. (iii) Storage is allocated for the structure when a variable of that structure type is declared. (iv) Accessor functions allow for the passing of values into the class and the setting of private or protected data members. 24. Consider the following function prototype: size_t getlength( void ) const; The compiler will. (i) Will throw an error outright (ii) Will throw an error if the definition includes any code that inadvertently assigns a value to any variable in the enclosing class (iii) Will throw an error if the definition includes any code at all 25. The smallest integer that can be represented by an 8-bit number in 2 s complement form is (i) -256 (ii) -128 (iii) -127 (iv) 0