We show that for a certain class of convex functions f, including the exponential functions x↦eλx with λ>0 a real number, and all the powers x↦xβ, x≥0 and β≥2 a real number, with a unique small exception, if (d1,...,dn) ranges over the degree sequences of graphs with n vertices and m edges and m≤n−1, then the maximum of ∑if(di) is uniquely attained by the degree sequence of a quasi-star graph, namely, a graph consisting of a star plus possibly additional isolated vertices. This result significantly extends a similar result in Ismailescu and Stefanica (2002). Dually, we show that for a certain class of concave functions g, including the negative exponential functions x↦1−e−λx with λ>ln(2) a real number, all the powers x↦xα, x≥0 and 0<α≤[Formula presented] for x≥0, if (d1,...,dn) ranges over the degree sequences of graphs with n vertices and m edges, then the minimum of ∑ig(di) is uniquely attained by the degree sequence of a quasi-complete graph, i.e., a graph consisting of a complete graph plus possibly an additional vertex connected to some but not all vertices of the complete graph, plus possibly isolated vertices. This result extends a similar result in the same paper.