Extract K Bits from a Given Position in Python

Chandu yadav
Updated on 30-Jul-2019 22:30:23

2K+ Views

This function is use to extract k bits from pos position and returns the extracted value. Here we use python slicing technique. Example Input:: number=170 K=5 Pos=2 Output=21 Algorithm Extractionbit(no, k, pos) /*user input number is stored in variable no, extracted bit is stored in variable k and the position of bit is pos. */ Step 1 : first convert the number into its binary form using bin(). Step 2 : remove the first two character. Step 3 : then extracting k bits from starting ... Read More

Get a List of MySQL Views

George John
Updated on 30-Jul-2019 22:30:23

3K+ Views

To get a list of MySQL views, we can use the SELECT command with LIKE operator. Let us see the syntax first. mysql> SELECT TABLE_SCHEMA, TABLE_NAME -> FROM information_schema.tables -> WHERE TABLE_TYPE LIKE 'VIEW'; The following is the output that displays the total number of views. +--------------+-----------------------------------------------+ | TABLE_SCHEMA | TABLE_NAME | +--------------+-----------------------------------------------+ | sys ... Read More

Instruction Type STAX RP in 8085 Microprocessor

karthikeya Boyini
Updated on 30-Jul-2019 22:30:23

12K+ Views

In 8085 Instruction set, STAX is a mnemonic that stands for SToreAccumulator contents in memory pointed by eXtended register denoted as “rp”.Hererp stands for register pair. This instruction uses register indirect addressing for specifying the destination. So using this instruction, the current content of Accumulator will be written to the memory location as pointed by 16-bit address as stored in the register pair. It occupies only 1-Byte in memory. Mnemonics, Operand Opcode(in HEX) Bytes STAX B 02 1 STAX D 12 1 STAX B is an example instruction of this type. It ... Read More

Instruction Type LHLD A16 in 8085 Microprocessor

Samual Sam
Updated on 30-Jul-2019 22:30:23

18K+ Views

In 8085 Instruction set LHLD is a mnemonic that stands for Load HL pair using Direct addressing from memory location whose 16-bit address is denoted as a16. So the previous content of HL register pair will get updated with the new 16-bits value. As HL pair has to be updated, so data comes from two consecutive memory locations starting at the address a16 and also from next address location. This instruction uses absolute addressing mode for specifying the data in the instruction. It occupies 3-Bytes in the memory. Mnemonics, Operand Opcode(in HEX) Bytes LHLD Address 2A ... Read More

Check if a Sentence is a Pangram in Python

Samual Sam
Updated on 30-Jul-2019 22:30:23

405 Views

Given a sentence. Our task is to check whether this sentence is pan grams or not. The logic of Pan grams checking is that words or sentences containing every letter of the alphabet at least once. To solve this problem we use set () method and list comprehension technique. Example Input: string = 'abc def ghi jkl mno pqr stu vwx yz' Output: Yes // contains all the characters from ‘a’ to ‘z’ Input: str='python program' Output: No // Does not contains all the characters from ‘a’ to 'z' Algorithm Step 1: create a string. Step 2: ... Read More

Instruction Type SHLD A16 in 8085 Microprocessor

karthikeya Boyini
Updated on 30-Jul-2019 22:30:23

11K+ Views

In 8085 Instruction set, SHLD is a mnemonic, which stands for Store HLpair using Direct addressing in memory location whose 16-bit address is denoted as a16. As HL pair has to be stored, so it has to be stored in two consecutive locations starting at the address a16. We know that H and L are 8-bit registers. So their contents will be stored in two consecutive memory locations as each memory location can hold 8-bits of data. This instruction uses absolute addressing mode for specifying the destination. It occupies 3-Bytes in the memory. Mnemonics, Operand Opcode(in HEX) Bytes ... Read More

Create Boolean Column in MySQL with False as Default Value

Ankith Reddy
Updated on 30-Jul-2019 22:30:23

7K+ Views

To create a column with ‘false’ as the default value, we can use the concept of “default” at the time of creation of the table. Note − 0 represents false and 1 represents true. Creating a table using “default” false. mysql> create table TrueFalseTable -> ( -> Adult boolean default false -> ); Query OK, 0 rows affected (0.65 sec) Inserting records with no value, since we have set “default” above. mysql> insert into TrueFalseTable values(); Query OK, 1 row affected (0.16 sec) To display records. ... Read More

Instruction Type: ADD R in 8085 Microprocessor

Samual Sam
Updated on 30-Jul-2019 22:30:23

11K+ Views

In 8085 Instruction set, ADD R is a mnemonic that stands for “Add contents of R to Accumulator”. As addition is a binary operation, so it requires two operands to be operated on. So input operands will reside on Accumulator and R registers and after addition the result will be stored back on to Accumulator. In this case, “R” stands for any of the following registers or memory location M pointed by HL pair. R = A, B, C, D, E, H, L, or M It is 1-Byte instruction so occupies only 1-Byte in memory. As R can ... Read More

Use UNION and ORDER BY Clause in MySQL

George John
Updated on 30-Jul-2019 22:30:23

6K+ Views

Union is a type of operator in MySQL. We can use ORDER BY with this to filter records. Use UNION if you want to select rows one after the other from several tables or several sets of rows from a single table all as a single result set. Let us see an example. Creating first table mysql> create table UnionDemo1 -> ( -> id int -> ); Query OK, 0 rows affected (0.59 sec) Inserting records into first table. mysql> insert into UnionDemo1 values(1), (4), (10); Query OK, ... Read More

Instruction Type ADI D8 in 8085 Microprocessor

karthikeya Boyini
Updated on 30-Jul-2019 22:30:23

7K+ Views

In 8085 Instruction set, ADI is a mnemonic, which stands for “ADd Immediate to Accumulator” and here “d8” stands for any 8-bit or 1-Byte of data. This instruction is used to add 8-bit immediate data to the Accumulator. The result of addition will be stored in the Accumulator. So the previous content of the Accumulator will be over written. It occupies 2-Bytes in memory. The flags are affected based on the result. Mnemonics, Operand Opcode(in HEX) Bytes ADI Data C6 2 Let us consider as example instruction ADI 03H of this type. As it ... Read More

Advertisements