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
Nadusha1986 [10]
4 years ago
5

Write regular expressions for the following languages:

Computers and Technology
1 answer:
Leno4ka [110]4 years ago
6 0

Answer:

a) ^.{9}[0][0-1]*$

b) (?=.*^[0-1]*$)(?=.*^(?!.*00(.*00))).*

Explanation:

You can check the expression with the code in python, please see the image with the expressions evaluated for different cases.

a) First, we check if the position number 10 contains a zero by using the expression .{9}[0] and then we check that the input contains just numbers from zero to one (binary numbers) by using [0-1]

b) To understand this expression we need to know that  ?=.* helps us evaluate two different expression and if one of the two is false the result is false (and gate), the first expression to be evaluated is [0-1] an it checks that the input contains just numbers from zero to one, the second expression 00(.*00) checks that there is not more than one pair of zeros.

You might be interested in
If number is 20, what is printed to the console after this code is executed?
exis [7]

Answer:

Option a is the correct answer for the above question

Explanation:

  • The above question code has one for-loop which runs two times only for the value of number=20.
  • It is because when the if-condition will true then the loop will be exit because it holds the break statement which exits the for-loop when the if-condition will be true.
  • So when the first time 20 will divide by 3 then if-condition will fail, but when the 20 will be divide by the 5, then the if condition will be true and the 5 will be printed as output.
  • Then the second if-condition will false because it will be true for the 20 value of i.
  • Hence option a is the correct answer while the other is not correct because others will not hold the output of this code.
3 0
3 years ago
Write a while loop that prints
Nana76 [90]

Answer:

The program to this question as follows:

Program:

#include <iostream> //defining header file

using namespace std;

int main() //defining main method

{

int squ=0,n=0; //defining variable

cout<<"Square between 0 to 100 :"; //message

while(n<100) //loop for calculate Square

{

n=squ*squ; //holing value in n variable

cout<<n<<" "; //print Square

squ++; //increment value by 1

}

cout<<endl; //for new line

n=1; //change the value of n

cout<<"Positive number, which is divisible by 10: "; //message

while (n< 100) //loop for check condition

{

if(n%10==0) //check value is divisible by 10

{

cout<<n<<" ";//print value

}

n++; //increment value of n by 1

}

cout<<endl; //for new line

cout<<"Powers of two less than n: "; //message

n=1; //holing value in n

while (n< 100) //loop for check condition

{

cout<<n<<" ";//print value

n=n*2; //calculate value

}

return 0;

}

Output:

Square between 0 to 100 :0 1 4 9 16 25 36 49 64 81 100  

Positive number, which is divisible by 10: 10 20 30 40 50 60 70 80 90  

Powers of two less than n: 1 2 4 8 16 32 64  

Explanation:

In the above program, two integer variable "squ and n" is defined, then three while loop is declared, which is used to calculate different values, that can be described as follows:

  • In the first while loop both "n and squ" variable is used, in which n is used for check range and "squ" is used to calculate the square between 1 to 100.
  • The second, while it is used to calculate the positive number, which is divisible by 10, in this only n variable is used, that calculates the value and check its range.
  • Then the last while loop is used which is used to calculate the double of the number, which is between 1 to 100 range.  
6 0
4 years ago
What is a task that an internet database allows you to perform
Ira Lisetskai [31]
The Internet Database allows you to view a ton of knowledge all from the comfort of your own in less then 16 seconds.
8 0
3 years ago
Read 2 more answers
Which table option enables you to combine the contents of several cells into one cell?
iren [92.7K]

Answer:

C. Merge Cells

Explanation:

7 0
3 years ago
Read 2 more answers
What does HTML stand for?
Wittaler [7]

Hypertext Markup Language

5 0
3 years ago
Read 2 more answers
Other questions:
  • Într-o școală sunt n clase, fiecare având un număr diferit de elevi. Școală primește m pachete cu cărți, fiecare cu un număr dif
    15·1 answer
  • How can an installation be a tool for community building?
    9·1 answer
  • Which of the following is true regarding packaged software and custom software? Group of answer choices Packaged software are ap
    13·1 answer
  • What data unit is addressed based on the IP address of the recipient?
    8·1 answer
  • What devise did george stbitz contribute?
    13·1 answer
  • The ____ contains app buttons that allow you to quickly run the File Explorer or Microsoft Edge apps.
    12·1 answer
  • Read a sentence from the console.
    6·1 answer
  • Consider this C Program C++ Program Java Program or C# Program. It reads integers from the
    8·1 answer
  • How to create create a database in mysql using clv files
    11·1 answer
  • What is the name for the base-2 system used by computers to represent
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!