C Lang Quest Ans
C Lang Quest Ans
1 -->
#include<stdio.h> void main() { int s=0; while(s++<10) { if(s<4 && s<9) continue; printf("\n%d\t",s); } }
1) 1 2 3 4 5 6 7 8 9 2) 1 2 3 10
3) 4 5 6 7 8 9 10 4) 4 5 6 7 8 9 See Answer(s) of Question no. 4 Question No. 5 --> What is the output of the following code?
# include<stdio.h> # define a 10 main() { printf("%d..",a); foo(); printf("%d",a); } void foo() { #undef a #define a 50 }
1) 2) 3) 4) 10..10 10..50 Error 0
See Answer(s) of Question no. 5 Question No. 6 --> Array passed as an argument to a function is interpreted as 1) 2) 3) 4) Address of the array Values of the first elements of the array Address of the first element of the array Number of element of the array
See Answer(s) of Question no. 6 Question No. 7 --> How can I dynamically allocate a two-dimensional array? 1) int **array1 = (int **)malloc(nrows * sizeof(int *)); for(i = 0; i < nrows; i++) array1[i] = (int *)malloc(ncolumns * sizeof(int)); 2) int **array2 = (int **)malloc(nrows * sizeof(int *)); array2[0] = (int *)malloc(nrows * ncolumns * sizeof(int)); for(i = 1; i < nrows; i++) array2[i] = array2[0] + i * ncolumns; 3) int *array3 = (int *)malloc(nrows * ncolumns * sizeof(int)); 4) Any of the above. See Answer(s) of Question no. 7 Question No. 8 --> main()
{ char thought[2][30]={"Don`t walk in front of me..","I am not follow"}; printf("%c%c",*(thought[0]+9),*(*(thought+0)+5)); } What is the output of this program? 1) 2) 3) 4) kk Don`t walk in front of me I may not follow K
#include <stdio.h> void main() { int I=3,*j,**k; j=&I; k=&j; printf("%d%d%d",*j,**k,*(*k)); } What is the output of the above program code?
Question No. 10 --> Which of the following is the correct way of declaring a float pointer: 1) 2) 3) 4) float ptr; float *ptr; *float ptr; None of the above
See Answer(s) of Question no. 10 Question No. 11 --> The reason for using pointer is ... Choose the false option from the following sentences 1) 2) 3) 4) Accessing arrays or string elements Dynamic memory allocation Implementing linked list,trees,graphs and many other data structures All are false
See Answer(s) of Question no. 11 Question No. 12 --> The size of a structure can be determined by a. size of variable name b. size of (struct tag) 1) 2) 3) 4) Only a Only b Both a and b None of these options
See Answer(s) of Question no. 13 Question No. 14 --> Pushdown list means: 1) 2) 3) 4) Stack Queue Linked list All of the above
See Answer(s) of Question no. 14 Question No. 15 --> What is time required to insert an element in a stack with linked implementation? 1) O( 1) 2) O(log2n) 3) O(n) 4) O(n log2n) See Answer(s) of Question no. 15 Question No. 16 --> Which of the following is the feature of stack?
1) 2) 3) 4)
All operations are at one end It cannot reuse its memory All elements are of different data types Any element can be accessed from it directly
See Answer(s) of Question no. 16 Question No. 17 --> To create a linked list, we can allocate space and make something point to it, by writing: struct-name *pointer-variable; Which of the following statement will correctly allocate the space 1) 2) 3) 4) pointer-variable pointer-variable pointer-variable pointer-variable = = = = malloc(sizeof(*struct-name)); malloc(sizeof(struct struct-name)); alloc(sizeof(struct struct-name)); alloc(sizeof(*struct-name));
See Answer(s) of Question no. 17 Question No. 18 --> What result is achieved through the following code snippet?
int initialize(NODE **circle) { if ((*circle = (NODE *)malloc(sizeof(NODE))) == NULL) return 0; (*circle)->next = NULL; (*circle)->previous = NULL; return 1; }
1) 2) 3) 4) The node circle is assigned to NULL The size of the node circle is assigned to NULL Both the pointers next and previous are assigned to NULL None of these options
See Answer(s) of Question no. 18 Question No. 19 --> What would be the output of the following program?
See Answer(s) of Question no. 19 Question No. 20 --> fputs function is used to
i. write characters to a file ii. takes 2 parameters iii. returns a character iv. requires a file pointer
1) 2) 3) 4)
all are true all are false only i and ii are true only i,ii and iv are true
See Answer(s) of Question no. 21 Question No. 22 --> Time taken for addition of element in queue is 1) 2) 3) 4) O(1) O(n) O(log n) None of these options
See Answer(s) of Question no. 22 Question No. 23 --> To delete a dynamically allocated array named `a`, the correct statement is 1) 2) 3) 4) delete delete delete delete a; a[0]; []a; [0]a;
See Answer(s) of Question no. 23 Question No. 24 --> An entire structure or union variable can be assigned to another structure or union variable if 1) 2) 3) 4) The two variables have the same composition. The two variables are of same type. Assignment of one structure or union variable to another is not possible. None of these options
#include<stdio.h> void swap(int&, int&); void main() { int a = 10,b=20; swap (a++,b++); printf("\n%d\t%d\t",a, b); } void swap(int& x, int& y) { x+=2; y+=3; }
1) 2) 3) 4) 14, 24 11, 21 10, 20 Error
See Answer(s) of Question no. 25 Question No. 26 --> What will be the value of `a` after the following code is executed
See Answer(s) of Question no. 26 Question No. 27 --> The five items: A, B, C, D and E are pushed in a stack,one after the other starting from A. The stack is popped four times and each element is inserted in a queue. Then two elements are deleted from the queue and pushed back on the stack. Now one item is popped from the stack. The popped item is. 1) 2) 3) 4) A B C D
See Answer(s) of Question no. 27 Question No. 28 --> What is the output of the following code?
3) 84, 75 4) None of these options See Answer(s) of Question no. 28 Question No. 29 --> Object Oriented Technology`s use of _________ facilitates the reuse of the code and architecture and its __________ feature provides systems with stability, as a small change in requirements does not require massive changes in the system: 1) 2) 3) 4) Encapsulation; inheritance Inheritance; polymorphism Inheritance; encapsulation Polymorphism; abstraction
See Answer(s) of Question no. 29 Question No. 30 --> A recursive function would result in infinite recursion, if the following were left out: 1) 2) 3) 4) Base case Recursive call Subtraction Local variable declarations
See Answer(s) of Question no. 30 Question No. 31 --> Which of the following are class relationships? 1) 2) 3) 4) is-a relationship. Part-of relationship. Use-a relationship. All of these options.
See Answer(s) of Question no. 31 Question No. 32 --> In OOP`s, advantage of inheritance include. 1) 2) 3) 4) Providing a useful conceptual framework. Avoiding rewriting a code. Facilitating class libraries. All of these options.
See Answer(s) of Question no. 32 Question No. 33 --> What is inheritance? 1) 2) 3) 4) It is same as encapsulation. Aggregation of information. Generalization and specialization. All of these options.
See Answer(s) of Question no. 33 Question No. 34 --> Object orientated programming allows for extension of an objects function or of class function. This ability
within OOP is called ________________ . 1) 2) 3) 4) extendibility expansion capacity virtual extension scalability
See Answer(s) of Question no. 34 Question No. 35 --> UML stands for 1) 2) 3) 4) Unique Unified Unified Unified modeling language. modeling language modern language master laqnguage
See Answer(s) of Question no. 35 Question No. 36 --> Which of the following programming technique focuses on the algorithm. 1) Procedural language 2) Object oriented language 3)Object based language 4) Structural language See Answer(s) of Question no. 36 Question No. 37 --> _______ provide useful conceptual framework. 1) 2) 3) 4) Inheritance Polymorphysm Encapsulation None of these options
See Answer(s) of Question no. 37 Question No. 38 --> Which of the following is true: 1) 2) 3) 4) Class Class Class None is an object of an object. is meta class. cannot have zero instances. of these options.
See Answer(s) of Question no. 38 Question No. 39 --> The design of classes in a way that hides the details of implementation from the user is known as: 1) 2) 3) 4) Encapsulation Information Hiding Data abstraction All of these options
Goto Question no. 2 Answer of Question No. 3 --> What is the output of the following code?
Goto Question no. 3 Answer of Question No. 4 --> What is the output of the following code?
#include<stdio.h> void main() { int s=0; while(s++<10) { if(s<4 && s<9) continue; printf("\n%d\t",s); } }
3) 4 5 6 7 8 9 10 <ANS>
Goto Question no. 4 Answer of Question No. 5 --> What is the output of the following code?
# include<stdio.h> # define a 10 main() { printf("%d..",a); foo(); printf("%d",a); } void foo() { #undef a #define a 50 }
1) 10..10 <ANS>
Goto Question no. 5 Answer of Question No. 6 --> Array passed as an argument to a function is interpreted as 3) Address of the first element of the array <ANS> Goto Question no. 6 Answer of Question No. 7 --> How can I dynamically allocate a two-dimensional array? 1) int **array1 = (int **)malloc(nrows * sizeof(int *)); for(i = 0; i < nrows; i++) array1[i] = (int *)malloc(ncolumns * sizeof(int)); 2) int **array2 = (int **)malloc(nrows * sizeof(int *)); array2[0] = (int *)malloc(nrows * ncolumns * sizeof(int)); for(i = 1; i < nrows; i++) array2[i] = array2[0] + i * ncolumns; 3) int *array3 = (int *)malloc(nrows * ncolumns * sizeof(int)); 4) Any of the above. Goto Question no. 7 Answer of Question No. 8 --> main() { char thought[2][30]={"Don`t walk in front of me..","I am not follow"}; printf("%c%c",*(thought[0]+9),*(*(thought+0)+5)); } What is the output of this program? 4) K <ANS>
<ANS>
Goto Question no. 14 Answer of Question No. 15 --> What is time required to insert an element in a stack with linked implementation? 1) O( 1) <ANS>
Goto Question no. 15 Answer of Question No. 16 --> Which of the following is the feature of stack? 1) All operations are at one end Goto Question no. 16 Answer of Question No. 17 --> To create a linked list, we can allocate space and make something point to it, by writing: struct-name *pointer-variable; Which of the following statement will correctly allocate the space 1) 2) 3) 4) pointer-variable pointer-variable pointer-variable pointer-variable = = = = malloc(sizeof(*struct-name)); malloc(sizeof(struct struct-name)); alloc(sizeof(struct struct-name)); alloc(sizeof(*struct-name));
Goto Question no. 17 Answer of Question No. 18 --> What result is achieved through the following code snippet?
int initialize(NODE **circle) { if ((*circle = (NODE *)malloc(sizeof(NODE))) == NULL) return 0; (*circle)->next = NULL; (*circle)->previous = NULL; return 1; }
1) 2) 3) 4) The node circle is assigned to NULL The size of the node circle is assigned to NULL Both the pointers next and previous are assigned to NULL None of these options
Goto Question no. 18 Answer of Question No. 19 --> What would be the output of the following program?
printf("\n%d", sizeof(str)); }
3) 5 <ANS>
Goto Question no. 19 Answer of Question No. 20 --> fputs function is used to
i. write characters to a file ii. takes 2 parameters iii. returns a character iv. requires a file pointer
4) only i,ii and iv are true Goto Question no. 20 Answer of Question No. 21 --> <ANS>
Goto Question no. 21 Answer of Question No. 22 --> Time taken for addition of element in queue is 3) O(log n) <ANS> Goto Question no. 22 Answer of Question No. 23 --> To delete a dynamically allocated array named `a`, the correct statement is 1) delete a; <ANS>
Goto Question no. 23 Answer of Question No. 24 --> An entire structure or union variable can be assigned to another structure or union variable if 1) 2) 3) 4) The two variables have the same composition. The two variables are of same type. Assignment of one structure or union variable to another is not possible. None of these options
Goto Question no. 24 Answer of Question No. 25 --> What is the output of the following code?
void main() { int a = 10,b=20; swap (a++,b++); printf("\n%d\t%d\t",a, b); } void swap(int& x, int& y) { x+=2; y+=3; }
4) Error <ANS>
Goto Question no. 25 Answer of Question No. 26 --> What will be the value of `a` after the following code is executed #define square(x) x*x a = square(2+3) 3) 11 <ANS> Goto Question no. 26 Answer of Question No. 27 --> The five items: A, B, C, D and E are pushed in a stack,one after the other starting from A. The stack is popped four times and each element is inserted in a queue. Then two elements are deleted from the queue and pushed back on the stack. Now one item is popped from the stack. The popped item is. 4) D <ANS> Goto Question no. 27 Answer of Question No. 28 --> What is the output of the following code? #include void main() { int a=0,b=0; a = (b = 75) + 9; printf("\n%d, %d",a, b); } 3) 84, 75 <ANS> Goto Question no. 28 Answer of Question No. 29 --> Object Oriented Technology`s use of _________ facilitates the reuse of the code and architecture and its __________ feature provides systems with stability, as a small change in requirements does not require massive changes in the system: 1) 2) 3) 4) Encapsulation; inheritance Inheritance; polymorphism Inheritance; encapsulation Polymorphism; abstraction
Goto Question no. 29 Answer of Question No. 30 --> A recursive function would result in infinite recursion, if the following were left out: 1) 2) 3) 4) Base case Recursive call Subtraction Local variable declarations
Goto Question no. 30 Answer of Question No. 31 --> Which of the following are class relationships? 1) 2) 3) 4) is-a relationship. Part-of relationship. Use-a relationship. All of these options.
Goto Question no. 31 Answer of Question No. 32 --> In OOP`s, advantage of inheritance include. 1) 2) 3) 4) Providing a useful conceptual framework. Avoiding rewriting a code. Facilitating class libraries. All of these options.
Goto Question no. 32 Answer of Question No. 33 --> What is inheritance? 1) 2) 3) 4) It is same as encapsulation. Aggregation of information. Generalization and specialization. All of these options.
Goto Question no. 33 Answer of Question No. 34 --> Object orientated programming allows for extension of an objects function or of class function. This ability within OOP is called ________________ . 1) 2) 3) 4) extendibility expansion capacity virtual extension scalability
Goto Question no. 34 Answer of Question No. 35 --> UML stands for 2) Unified modeling language <ANS> Goto Question no. 35 Answer of Question No. 36 --> Which of the following programming technique focuses on the algorithm. 1) 2) 3) 4) Procedural language Object oriented language Object based language Structural language
Answer of Question No. 37 --> _______ provide useful conceptual framework. 1) 2) 3) 4) Inheritance Polymorphysm Encapsulation None of these options
Goto Question no. 37 Answer of Question No. 38 --> Which of the following is true: 1) 2) 3) 4) Class Class Class None is an object of an object. is meta class. cannot have zero instances. of these options.
Goto Question no. 38 Answer of Question No. 39 --> The design of classes in a way that hides the details of implementation from the user is known as: 1) 2) 3) 4) Encapsulation Information Hiding Data abstraction All of these options