eval in Python

This article discusses a built-in function in Python, eval. It is an interesting hack/utility in Python which lets a Python program run Python code within itself. The eval() method parses the expression passed to it and runs python expression(code) within the program. The syntax of eval is: eval(expression, globals=None, locals=None) expression: this string is parsed… Read More »

Using final with Inheritance in Java

Prerequisite – Overriding in java, Inheritance final is a keyword in java used for restricting some functionalities. We can declare variables, methods and classes with final keyword. Using final with inheritance During inheritance, we must declare methods with final keyword for which we required to follow the same implementation throughout all the derived classes. Note… Read More »

Association, Composition and Aggregation in Java

Association Association is relation between two separate classes which establishes through their Objects. Association can be one-to-one, one-to-many, many-to-one, many-to-many. In Object-Oriented programming, an Object communicates to other Object to use functionality and services provided by that object. Composition and Aggregation are the two forms of association. Output: Neha is employee of Axis In above… Read More »

What are the benefits of interning as content writer at GeeksforGeeks?

Content Writing internships generally are available at GeeksforGeeks round the year and open to all the students who are good at article writing and at the same time knowledgeable enough to write about a particular topic. Most of the articles that get published on GeeksforGeeks are contributed by students and working professionals only.Our review team… Read More »

Dynamic Method Dispatch or Runtime Polymorphism in Java

Prerequisite: Overriding in java, Inheritance Method overriding is one of the ways in which Java supports Runtime Polymorphism. Dynamic method dispatch is the mechanism by which a call to an overridden method is resolved at run time, rather than compile time. When an overridden method is called through a superclass reference, Java determines which version(superclass/subclasses)… Read More »

Find politeness of a number

Given an integer n. Find politeness of number n. Politeness of a number is defined as the number of ways it can be expressed as the sum of consecutive integers. Input: n = 15 Output: 3 Explanation: There are only three ways to express 15 as sum of consecutive integers i.e., 15 = 1 +… Read More »

Builtin functions of GCC compiler

These are three important builtin functions in GCC compiler: _builtin_popcount(x): This function is used to count the number of one’s(set bits) in an integer. Example: if x = 4 binary value of 4 is 100 Output: No of ones is 1. Output: Count of 1s in binary of 5 is 2 __builtin_clz(x): This function is… Read More »