I have a dependent variable with a dichotomous variable (yes/no) to be compared on a categorical variable with two levels. Kindly suggest whether t-test is appropriate or not?
A t test (for testing mean differences) is for continuous (metrical, interval-scale) dependent variables and binary (dichotomous) independent variables. When both your dependent and independent variables are dichotomous, you could use a chi square test for a 2x2 contingency table to examine their association.
But bear in mind that Pearson's Chi2 is an approximate test that depends on all of the expected frequencies (given a true H0) being equal to or greater than 5 (or 10 according to some more conservative folks). Standard advice for a long time has been to use Fisher's exact test (aka., the Fisher-Irwin test) for a 2x2 table if any expected counts < 5. But a nice simulation study by Ian Campbell (2007) showed that the so-called N-1 Chi2 is a better choice in many circumstances, provided no expected counts are < 1. You can read about it and find an online calculator on his website: