May 27, 2016 0 Welcome to your Yipee Technology Online Aptitude Test 2 Name Email Phone Number 1. #include int main(){ int i,j; i=j=2,3; while(--i&&j++) printf("%d %d",i,j); return 0; } A.1 3 B.2 3 C.1 2 D.1 2 3 C D B A 2. Which of the following is illegal? int *ip; string s, *sp = 0; int i; double* dp = &i; int *pi = 0; 3. What will be the output of the following class equality { int x; int y; boolean isequal() { return(x == y); } } class Output { public static void main(String args[]) { equality obj = new equality(); obj.x = 5; obj.y = 5; System.out.println(obj.isequal()); } } True fasle 1 Compilation Error 4. What is the correct JavaScript syntax to change the content of the HTML element below? This is a demonstration. #demo.innerHTML = "Hello World!"; document.getElementById("demo").innerHTML = "Hello World!"; document.getElementByName("p").innerHTML = "Hello World!"; document.getElement("p").innerHTML = "Hello World!"; 5. What is the time complexity of merge sort?(Best case) O(n) O(n^2) O(n log(n)) O(log (n)) 6. void main() { char s[ ]="man"; int i; for(i=0;s[ i ];i++) printf("\n%c%c%c%c",s[ i ],*(s+i),*(i+s),i[s]); } aaaa mmmm nnnn mmmm aa nn mmm aa nnn mmmm aaaa nnnn 7. What is the correct way to open the file "time.txt" as readable? open("time.txt","read"); fopen("time.txt","r"); open("time.txt"); fopen("time.txt","r+"); 8. #include #include int main(){ void (*p)(); int (*q)(); int (*r)(); p = clrscr; q = getch; r = puts; (*p)(); (*r)("cquestionbank.blogspot.com"); (*q)(); return 0; } (A) NULL (B) cquestionbank.blogspot.com (C) c (D) Compilation error (E) None of above A B C D 9. #define int char main() { int i=65; printf("sizeof(i)=%d",sizeof(i)); } Depends on compiler sizeof(i)=1 sizeof(i)=2 sizeof(i)=65 10. #include using namespace std; class B { public: void display() { cout<<"Content of base class.\n"; } }; class D : public B { public: void display() { cout<<"Content of derived class.\n"; } }; int main() { B *b; D d; b->display(); b = &d; /* Address of object d in pointer variable */ b->display(); return 0; } A.Content of base class. Content of base class. B.Content of base class. Conitent of derived class. C.Content of derived class. Content of base class. D.Conitent of derived class. Conitent of derived class. B A D C 11. JAVA: When compiler provides default constructor? A. Only if there is no explicit constructor defined by developer. B. Each time. C. Only when there is an explicit constructor defined by developer. D. Never. C A B D 12. JAVA: 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. C B A D 13. PHP allows you to send emails directly from a script False True 14. CSS How do you add a background color for all HTML elements? h1 {background-color:#FFFFFF;} h1.all {background-color:#FFFFFF;} all.h1 {background-color:#FFFFFF;} 15. Where can the super() appear in the base class? Anywhere in the base class constructor. Anywhere in the base class. Just after the instantiating line. First line of base class constructor. 16. HTML If the image cannot be displayed then _______ specifies an alternate text for an image. value attribute text attribute caption attribute alt attribute 17. HTML C Which type of files can’t be opened using fopen()? .txt .c .bin None of the mentioned 18. Can you combine the following two statements into one? char *p; p = (char*) malloc(100); A. char p = *malloc(100); B. char *p = (char) malloc(100); C. char *p = (char*)malloc(100); D. char *p = (char *)(malloc*)(100); C B A D 19. JVM is platform independent. A.True B.False False True 20. What is the output of the following: #include int fun(int count) { printf("%d\n", count); if(count < 3) { fun(fun(fun(++count))); } return count; } int main() { fun(1); return 0; } A. 1 2 3 3 3 3 3 B. 1 2 3 C. 1 2 2 2 2 2 2 D. 1 2 A C D B 21. #include main() { struct xx { int x=3; char name[]="hello"; }; struct xx *s; printf("%d",s->x); printf("%s",s->name); } Compiler error 3 hello 3hello 22. What is the correct way to end a PHP statement? New line . ; /php 23. Which of the following approach is adapted by C++? A. Top-down B. Bottom-up C. Right-left D. Left-right B A D C 24. void print(int n) { if (n == 0) return; printf("%d", n%2); print(n/2); } What will be the output of print(12). 1000 1100 1001 0011 25. Which of the following statements is correct? A. Base class pointer cannot point to derived class. B. Derived class pointer cannot point to base class. C. Pointer to derived class cannot be created. D. Pointer to base class cannot be created. D A B C 26. Java: class A { int i; void display() { System.out.println(i); } } class B extends A { int j; void display() { System.out.println(j); } } class inheritance_demo { public static void main(String args[]) { B obj = new B(); obj.i=1; obj.j=2; obj.display(); } } a) 0 b) 1 c) 2 d) Compilation Error C D B A 27. #include 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 C B D A 28. PHP Which one of the following is the right way to clone an object in PHP? destinationObject = _clone(targetObject); destinationObject = clone targetObject; _clone(targetObject); destinationObject = clone(targetObject); 29. How do you get information from a form that is submitted using the "get" method? Request.QueryString; Request.Form; $_GET[]; 30. Which superglobal variable holds information about headers, paths, and script locations? $_SERVER $_GLOBALS $_SESSION $_GET[]; Be sure to click Submit Quiz to see your results! Time's up