Programing Logic

Slot 1

Q1. Which argument is passed to fflush()?
A.no parameters
B.stdin
C.stdout
D.stderr
Answer: Option B


Q2. What will be the output for the below? Enter your answer only as Numeral
public Class Main
{
public static void main(string[])
{
int x=1/2;
if(x==0.5)
System.out.println(x+1);
else
System.out.println(x*2);
}
}
Answer: 0


Q3. What is the name of the method that examines a particular data entity and determines
what data elements need to be associated?

A. Entity relationship diagram
B. Logic Data modeling
C. Customer Entities
D. Functional Primitive
Answer: Option A


Q4. What will be the output of the below code?
public class Main
{
static int num=30;
static class inner
{
void msg()
{
System.out.Println(‘Num: num++);}
}
public static void main(string args[])
{
Main.Inner tw=new Main.Inner();
tw.msg()
}
}
Answer: 30


Q5. Select the correct code for opening a file for writing in binary mode
A. File*f =fwriteb(“abc.bin”)
B. File*f = fopen(“abc.bin”,”bw”)
C. File*f = fopen(“abc.bin”,”wb”)
D. File*f =fwrite(“abc.bin”,”b”)
Answer: Option C


Q6. What will be the output of the below code?


A. mango grapes
B. Compilation error
C. Collection.sort() throws Concurrent Modification Exception
D. Grapes mango
Answer: Option A

Q7. What is the name of the method that examines a particular data entity and determines
what data elements need to be associated with it?
A. Customer Entities
B. Entity Relationship Diagram
C. Logic Data Modelling
D. Functional Primitive

Answer: Option B

Q8. We cannot overload ______ operator.
A. : :
B. []
C. ()
D. +
Answer: Option A

Q9. Which of the following functions is used to accept strings with white spaces?
A.getWhiteSpaceString();
B.scanf();
C.gets();
D.getstrings();
Answer: Option C

Q10.Which data structure is used to convert expression from one form to another form?
A. Graph
B. Stack
C. LinkedList
D. Queue
Answer: Option B

Q11.What is the mathematical function used to round off 6.23 to 7?
A. floor(6.23)
B. ceil(6.23,7)
C. floor(6.23,7)
D. ceil(6.23)
Answer: Option D

Q12. Which combination of the integer variables a, b and c makes the variable m get the value
4 in the following expression?
m = (a > b) ? (( a > c ) ? a : c) : ((b > c ) ? b : c )
A. a=6, b=3, c=5
B. a=6, b=5, c=3
C. a=5, b=4, c=5
D. a=3, b=4, c=2
Answer: Option D


Q13. Which of the following options best suits for ‘Memory Leak Occurred’
A. Resource allocation pending while debugging the code
B. Program releases resources allocated in the memory
C. Program does not free the memory which is allocated dynamically
D. Occurs due to address assignment failure.
Answer- Option C

Slot 2

Q1..Given here is a scenario. Consider the graph algorithm and answer the given question.

John wants to go to different locations of the city in which he is. He has listed all of them down. However he wants to visit one location before visiting some other location What application of graphs he uses to determine that location?

  1. DFS

  2. Dijkstra’s

  3. BFS

  4. Topological Sorting

Answer: Option D

 

Q2. What will be the output? public class