Subjects
PRICING
TEST PREP
SIGN IN
Start Free Trial
Sneha L.
Software Engineer
Tutor Satisfaction Guarantee
SQL Programming
TutorMe
Question:

What’s wrong in the following query? SELECT subject_code, AVG (marks) FROM students WHERE AVG(marks) > 75 GROUP BY subject_code;

Sneha L.
Answer:

The WHERE clause cannot be used to restrict groups. The HAVING clause should be used. SELECT subject_code, AVG (marks) FROM students HAVING AVG(marks) > 75 GROUP BY subject_code;

Java Programming
TutorMe
Question:

A program to implement traversals of binary tree.

Sneha L.
Answer:

import java.io.*; class TreeNode { int data; TreeNode left,right; TreeNode(int x) { data=x; left=right=null; } } class BinTree { TreeNode root; BinTree() { root=null; } void insert(int x) { TreeNode p=new TreeNode(x); TreeNode ptr,prev; if(root==null){ root=p; return; } ptr=root;prev=null; while(ptr!=null) { prev=ptr; if(x<ptr.data) ptr=ptr.left; else ptr=ptr.right; } if(x<prev.data) prev.left=p; else prev.right=p; } void inorder() { inorder(root); System.out.println(); } void inorder(TreeNode root) { if(root !=null) { inorder(root.left); System.out.print(root.data+" "); inorder(root.right); } } void preorder() { preorder(root); System.out.println(); } void preorder(TreeNode root) { if(root!=null) { System.out.print(root.data +" "); preorder(root.left); preorder(root.right); } } void postorder() { postorder(root); System.out.println(); } void postorder(TreeNode root) { if(root!=null) { postorder(root.left); postorder(root.right); System.out.print(root.data +" "); } } } class BinTreeTest2 { public static void main(String args[])throws IOException { BinTree t1=new BinTree(); int x,c; BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); do { System.out.println("1 To insert an element"); System.out.println("2 To traverse in inorder"); System.out.println("3 To traverse in preorder"); System.out.println("4 To traverse in postorder"); System.out.println("5 To Exit"); System.out.println("\n\nEnter your Choice"); c=Integer.parseInt(br.readLine()); switch(c) { case 1: System.out.println("\n\nEnter an element"); x=Integer.parseInt(br.readLine()); t1.insert(x); break; case 2:System.out.print("\n\nInorder==>"); t1.inorder(); break; case 3:System.out.print("\n\nPreorder==>"); t1.preorder(); break; case 4: System.out.print("\n\nPostorder==>"); t1.postorder(); break; } } while(c!=5); } }

Trigonometry
TutorMe
Question:

If x+y+z=$$\pi$$, prove the trigonometric identity $$\cot(\frac{x}{2})+\cot(\frac{y}{2})+\cot(\frac{z}{2})$$ = $$\cot(\frac{x}{2})*\cot(\frac{y}{2})*cot(\frac{z}{2})$$

Sneha L.
Answer:

x+y+z=$$\pi$$, so $$\frac{x}{2}+\frac{y}{2}+\frac{z}{2}=\frac{\pi}{2}$$; $$\frac{z}{2}=\frac{\pi}{2}-(\frac{x}{2}+\frac{y}{2})$$ Since $$\cot(\alpha) = \frac{1}{\tan(\alpha)}$$, we get $$\cot(\alpha) = \frac{cos(\alpha)}{sin(\alpha)}$$ Then, $$cot(\frac{x}{2})+cot(\frac{y}{2})+cot(\frac{z}{2}) = \frac{cos(\frac{x}{2})}{sin(\frac{z}{2})}+\frac{cos(\frac{y}{2})}{sin(\frac{y}{2})}+\frac{cos(\frac{z}{2})}{sin(\frac{z}{2})}$$ = $$ \frac{cos(\frac{x}{2})*sin(\frac{y}{2})+cos(\frac{y}{2})*sin(\frac{x}{2})}{sin(\frac{x}{2})*sin(\frac{y}{2})} +\frac{cos(\frac{z}{2})}{sin(\frac{z}{2})}$$ = $$ \frac{sin(\frac{x}{2}+\frac{y}{2})}{sin(\frac{x}{2})*sin(\frac{y}{2})} + \frac{cos(\frac{z}{2})}{sin(\frac{z}{2})}$$ = $$\frac{ cos(\frac{z}{2})}{sin(\frac{x}{2})*sin(\frac{y}{2})} + \frac{cos(\frac{z}{2})}{sin(\frac{z}{2})}$$ = $$cos(\frac{z}{2})*(\frac{sin(\frac{z}{2}) + sin(\frac{x}{2})*sin(\frac{y}{2})}{sin(\frac{x}{2})*sin(\frac{y}{2})*sin(\frac{z}{2})}) $$ = $$cos(\frac{z}{2})*(\frac{cos(\frac{x}{2}+\frac{y}{2})+sin(\frac{x}{2})*sin(\frac{y}{2})}{sin(\frac{x}{2})*sin(\frac{y}{2})*sin(\frac{z}{2})})$$ = $$cos(\frac{z}{2})*(\frac{cos(\frac{x}{2})*cos(\frac{y}{2})-sin(\frac{x}{2})*sin(\frac{y}{2})+sin(\frac{x}{2})*sin(\frac{y}{2})}{sin(\frac{x}{2})*sin(\frac{y}{2})*sin(\frac{z}{2})})$$ = $$cos(\frac{z}{2})*(\frac{cos(\frac{x}{2})*cos(\frac{y}{2})}{sin(\frac{x}{2})*sin(\frac{y}{2})*sin(\frac{z}{2})})$$ = $$\cot(\frac{x}{2})*\cot(\frac{y}{2})*cot(\frac{z}{2})$$

Send a message explaining your
needs and Sneha will reply soon.
Contact Sneha
Ready now? Request a lesson.
Start Session
FAQs
What is a lesson?
A lesson is virtual lesson space on our platform where you and a tutor can communicate. You'll have the option to communicate using video/audio as well as text chat. You can also upload documents, edit papers in real time and use our cutting-edge virtual whiteboard.
How do I begin a lesson?
If the tutor is currently online, you can click the "Start Session" button above. If they are offline, you can always send them a message to schedule a lesson.
Who are TutorMe tutors?
Many of our tutors are current college students or recent graduates of top-tier universities like MIT, Harvard and USC. TutorMe has thousands of top-quality tutors available to work with you.