Technical/logical interview questions in C language –freshers must read it!!

1. What type of memory could be accessed in least time?
(a)cache memory
(b)secondary memory
(c)main memory
(d)none
Ans:A

2. void main()
 
   {
 
      int const * p=5;
 
      printf("%d",++(*p));
 
   }

What is the output?
(a) 6
(b) 5
(c) Compiler error
(d) Run time error
Ans :c

3.

 main()
 
      {
 
      static int var = 5;
 
      printf("%d ",var--);
 
      if(var)
 
            main();
 
      }

What is the output?
(a) 1 2 3 4 5
(b) infinite loop
(c) 5 4 3 2 1
(d) compiler error
Ans :c

4.

main()

{

printf("\nab");

printf("\bsi");

printf("\rha");

}

(a) has
(b) hasaiaab
(c) hai
(d) aas
Ans :c

5.

 #include 
#define a 10
main()
 
{
 
#define a 50
 
printf("%d",a);
 
}

(a) 10
(b) 50
(c) error
(d) none
Ans:B

6. Minimum number of queues needed to implement the priority queue?
(a) one
(b) two
(c) three
(d) zero
Ans:B

7. What are the notations used in Evaluation of Arithmetic Expressions using prefix and postfix forms?
(a) Reverse Polish notations
(b) Polish
(c) both
(d) none
Ans :C

8. In tree construction which is the suitable efficient data structure?
(a) Array
(b) Linked list
(c) Stack
(d) Queue
Ans :B

9. Of the following tree structure, which is, efficient considering space and time complexities?
(a) Incomplete Binary Tree
(b) Complete Binary Tree
(c) Full Binary Tree
(d) None
Ans:B

10. What operator performs pattern matching?
(a) LIKE
(b) NULL
(c) WHERE
(d) AS
Ans :A

11. What is the output of the following query?
SELECT TRUNC(1234.5678,-2) FROM DUAL
(a) 1235
(b) 1200
(c) 1234.5
(d) 1234
Ans:B

12. What is the use of the DROP option in the ALTER TABLE command?
(a) It is used to drop constraints specified on the row
(b) It is used to drop constraints specified on the table.
(c) It is used to drop constraints specified on the column
(d) all
Ans :B

13. Which is the parameter that is added to every non-static member function when it is called?
(a)‘this’ pointer
(b) ‘far’ pointer
(c)‘near’ pointer
(d) all
Ans:A

14. A collection of programs that enables user to create and maintain a database is called
(a) DBMS
(b) DB
(c) DBA
(d) All
Ans:A

15. Model based on collection of objects is
(a) E-R Model
(b) Data Model
(c) Object Oriented Model
(d) None
Ans:C

16. When one of the data elements stored within a construct is utilized as the primary key, then it is called

(a) Foreign key
(b) Natural key
(c) Primary key
(d) Alternate key
Ans:B

17. different phases of transaction?
(a) Analysis & Redo
(b) Redo & Undo
(c) Analysis & Redo & Undo
(d) None
Ans:C

18.

void main() 
    { 
     int i=7; 
     printf("%d",i++*i++); 
    }

What is the output?
(a) 56
(b) 65
(c) 5 6
(d) 6 5
Ans:A

19. Output of the following program is

main() 

{

int i=0; 

for(i=0;i<20;i++) 

{

switch(i) 

case 0:i+=5; 

case 1:i+=2; 

case 5:i+=5; 

default i+=4; 

break;} 

printf("%d,",i); 

} 

}

(a) 0,5,9,13,17
(b) 5,9,13,17
(c) 12,17,22
(d) 16,21
Ans:D

20. Find the output

main() 

{ 

int x=5; 

printf("%d %d %d\n",x,x<<2,x>>2); 

}

(a) 1 5 20
(b) 20 5 1
(c) 5 20 1
(d) 1 5 10
Ans:C

If you have questions, please ask below

Leave a Reply

  1. i am not understanding the answer the for question no. 3,4,18,19 plz send me the solution for these questions & also sum more questions on my mail..

  2. which book i use for self learning or self study of c,c++.
    and
    espicialy for .net
    for apti and interview.
    i want devlop my logic
    please please