1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Vaselesa [24]
3 years ago
9

How many bit strings of length 12 contain the substring 111000?

Computers and Technology
1 answer:
ELEN [110]3 years ago
7 0

Answer:

448 strings

Explanation:

Each bit string can be filled by two ways either 0 or 1. If the bit strings of length contain the substring '111000' we therefore need a substring of length 6.

The selection of bits starts from the 1st bit to 7th bit enclosing the substring 111000 and ensuring that the length 6 are all filled. So, there will be  7 ways to contain this substring.

The total ways to contain this substring = 7*2^6 =448

Therefore 448 strings of length 12 contain the substring '111000'.

You might be interested in
create a new Java application called "CheckString" (without the quotation marks) according to the following guidelines.** Each m
jok3333 [9.3K]

Answer:

The Java code is given below

Explanation:

import java.io.*;

import java.util.Scanner;

import java.util.ArrayList;

public class StringCheck{

//There are several implementation approaches. This is one example framework/outline which might be helpful. Please feel free to try other approaches.

public static void checkWord(String word) throws Exception {

// Uses charAt method to test if the first letter of string variable word

// is a character. If not, throw new exception

if(Character.isLetter(word.charAt(0))){

 return;

}else{

 throw new Exception("This is not a word");

}

}

public static String getWord() {

// Declare a local scanner

// Prompt the user to enter a word

// Think about using a loop to give the user multiple opportunities to correctly enter a string

// Read into a string

// Call checkWord method passing the string as a parameter

// checkWord can throw an exception; call checkWord in a try/catch block

// Return the string to main if a valid string

Scanner sc = new Scanner(System.in);

boolean st = true;

String word = null;

while(st){

 System.out.println("Enter a Word : ");

 word = sc.next();

 try{

  checkWord(word);

  st = false;

 }catch(Exception e){

  System.out.println(e);

  st = true;

 }

}

sc.close();

return word;

}

public static void writeFile(String[] arrayToWrite, String filename) throws IOException {

// Example using FileWriter but PrintWriter could be used instead

// Create a FileWriter object

FileWriter fileWordStream = new FileWriter(filename);

// Use a loop to write string elements in arrayToWrite to fileWordStream

for(int i = 0;i<arrayToWrite.length;i++){

fileWordStream.write(arrayToWrite[i]+System.lineSeparator());

}

fileWordStream.flush();

fileWordStream.close();

// In the loop use the lineSeparator method to put each string on its own line

}

public static ArrayList readFile(String filename) throws FileNotFoundException, IOException {

// Declare local ArrayList

ArrayList<String> words = new ArrayList<>();

// Create a new File object using filename parameter

File file = new File(filename);

// Check if the file exists, if not throw a new exception

if(!file.exists()){

 throw new FileNotFoundException("File not Found");

}

// Create a new BufferedReader object      

Scanner fsc = new Scanner(file);

// use a loop and the readLine method to read each string (on its own line) from the file

while(fsc.hasNextLine()){

words.add(fsc.nextLine());

}

fsc.close();

// return the filled ArrayList to main

return words;

}

public static void main(String[] args) {

// create a string with literal values to write to the file

String[] testData = {"cat", "dog", "rabbit"};

// Create an ArrayList for reading the file

ArrayList<String> words = new ArrayList<>();

// Declare a string variable containing the file name "data.txt"

String file = "data.txt";

// Call getWord, assign the returned string to a variable and display it

String word = getWord();

System.out.println("The word is : "+word);

// Call writeFile and readFile methods in a try block

try{

writeFile(testData,file);

words = readFile(file);

// Printout the contents of the ArrayList after the call to readFile

for(int i = 0;i<words.size();i++){

 System.out.println(words.get(i));

}

}catch(FileNotFoundException e){

System.out.println(e);

}catch(IOException e){

System.out.println("IOException: error occured in input output");

}

// catch two types of exceptions

}

}

4 0
4 years ago
What should you do before you share your information on the internet?
satela [25.4K]

You have to think about, what could happen to you if you shared this information.

Hope this helped!

~Izzy

4 0
3 years ago
Haya noticed that college students needed to dress up for presentations but never seemed to have any ties, or at least not very
VashaNatasha [74]

Answer:

I believe it's B

Explanation:

...but is it?

3 0
4 years ago
Which wireless communication is typically limited to six feet of distance?
Nutka1998 [239]

Answer:

Bluetooth

Explanation:

Bluetooth is a standard to share data between Mobil devises, typically less than 10 m (33 ft), up to 100 m (330 ft), but the Bluetooth 5.0 has a range of 40–400 m (100–1,000 ft), in addition, NFC is something similar because needs a separation of 10 cm or less, and with RFID we can read to hundreds of meters.

3 0
3 years ago
Oxidation reactions occur when a substance is combined with _____.
Debora [2.8K]
The answer for this is B. Oxygen
3 0
3 years ago
Read 2 more answers
Other questions:
  • Write in general about ergonomic injuries and also mention the symptoms that computer users exhibit when they experience these s
    11·2 answers
  • 1 Explain the difference between using a computer program and programming a computer.
    12·1 answer
  • WILL GIVE MEDAL NEED HELP ASAP
    7·1 answer
  • This diagram shows a number of computing devices connected to the Internet with each line representing a direct connection.
    11·1 answer
  • Ted is looking for a reliable source for his paper. Which of the following sites would be considered reliable?
    5·1 answer
  • A website must have a unique address with all the following features
    14·1 answer
  • Need the answer for this code hs will give brainly
    7·1 answer
  • Why RAM is necessary in a computer​
    9·1 answer
  • .... is a way to engage people at different locations in synchronous interaction ( fill in the blank space)​
    14·1 answer
  • You are the network administrator for a city library. Throughout the library, there are several groups of computers that provide
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!