1st, find the longest carbon chain containing triple bond (in this case).
7 carbons ---> hept- (prefix)
triple bond ---> -yne (suffix)
heptyne
2nd, assign a number to each of these carbons orderly.
There are 2 routes for assigning the numbers, one in black and one in red.
The red one should be rejected because the position of triple is at carbon no. 4 while the black one is at no. 3, choose the smaller no. of carbon which is triple bonded (in this case).
triple bond at C no. 3,
hept-3-yne
3rd, find out the postion of substituents (methyl group = CH3-).
There are 2 methyl groups, one is at no. 2 and other one is at no. 6.
These give 2,6-dimethyl for neming the substituents.
Finally, group the names together (substituents are put at the front alphabetically).
2,6-dimethylhept-3-yne
About the alkene one, try to do it yourself.